Mathematica Custom Mathematica Shortcut: Copy as LateX

  • Thread starter Thread starter aimforclarity
  • Start date Start date
  • Tags Tags
    Latex Mathematica
AI Thread Summary
Editing the MenuSetup.tr file in Mathematica allows users to customize the copy function to output LaTeX format instead of plain text. By modifying specific lines related to "Plain &Text" and "&LaTeX", users can set the shortcut Strl+Shift+C to copy content in LaTeX format. After making these changes and restarting Mathematica, the new functionality will be active. Additionally, the discussion touches on the MenuEvaluator feature, which enables custom actions when a menu item is selected, and suggests that users can modify the configuration from within a notebook using the FrontEndExecute command. For further details, users are directed to the relevant documentation.
aimforclarity
Messages
31
Reaction score
0
This can be very useful, so I thought i'd share.
If you edit the

Code:
> Wolfram Research\Mathematica\8.0\SystemFiles\FrontEnd\TextResources\Windows\MenuSetup.tr
file you can make Strl+Shift+C copy not plain but in LateX format. Very useful. Look for the line in the file that says "&LaTeX" and the one that says "Plain &Text". The & sign gives the underscore letter in the menu. Then replace them with the following:
Code:
    		MenuItem["Plain &Text", FrontEnd`CopySpecial["PlainText"]],
			MenuItem["&LaTeX",
				KernelExecute[ToExpression["FrontEnd`CopyAsTeX[]"]], MenuKey["C", Modifiers->{"Control", "Shift"}],
				MenuEvaluator -> Automatic],

Restart Matematica and you are done.

The question i would have is if anyone knows what *MenuEvaluator* does, or if you know how to do this modification from a notebook in mathematica rather than modifying the config file.
 
Physics news on Phys.org
The MenuEvaluator is a special Mathematica feature that lets you define a function or expression to evaluate when a menu item is selected. It's essentially like a callback that can be used for custom menus or menu items. You can use it to create custom behavior when a menu item is selected, such as executing a certain command or performing a calculation. To modify the config from within a Mathematica notebook, you can use the FrontEndExecute command to edit the file. For more information on this command, please see the following documentation page: https://reference.wolfram.com/language/ref/FrontEndExecute.html
 
Back
Top