Custom Mathematica Shortcut: Copy as LateX

In summary, the conversation discusses how to modify the MenuSetup.tr file in Mathematica to change the copy function to copy in LaTeX format instead of plain text. It also mentions the use of MenuEvaluator to define custom behavior for menu items and how to modify the config file from within a Mathematica notebook using the FrontEndExecute command.
  • #1
aimforclarity
33
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
  • #2
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
 

1. How can I use the "Copy as LateX" shortcut in Mathematica?

To use the "Copy as LateX" shortcut in Mathematica, simply select the expression or output you want to copy, and press the shortcut keys "Command+C" on Mac or "Ctrl+C" on Windows. This will automatically copy the selected item in LateX format to your clipboard.

2. Can I customize the "Copy as LateX" shortcut in Mathematica?

Yes, you can customize the "Copy as LateX" shortcut in Mathematica by going to the "Format" menu, selecting "Edit Keyboard Shortcuts", and then finding the "Copy As LateX" command. From there, you can assign a new shortcut key combination of your choice.

3. How can I paste the copied LateX expression into a document?

To paste the copied LateX expression into a document, open your desired document and use the shortcut keys "Command+V" on Mac or "Ctrl+V" on Windows. This will paste the expression in LateX format into your document.

4. Does the "Copy as LateX" shortcut work for all types of expressions in Mathematica?

Yes, the "Copy as LateX" shortcut works for all types of expressions in Mathematica, including mathematical equations, graphs, tables, and more. It will automatically convert the selected item into LateX format for easy use in documents.

5. Can I use the "Copy as LateX" shortcut to copy multiple expressions at once?

Yes, you can use the "Copy as LateX" shortcut to copy multiple expressions at once by selecting them all and then pressing the shortcut keys "Command+C" on Mac or "Ctrl+C" on Windows. This will copy all selected expressions in LateX format to your clipboard.

Back
Top