Custom Mathematica Shortcut: Copy as LateX

  • Context: Mathematica 
  • Thread starter Thread starter aimforclarity
  • Start date Start date
  • Tags Tags
    Latex Mathematica
Click For Summary
SUMMARY

This discussion outlines how to customize Mathematica 8.0 by modifying the MenuSetup.tr file to enable the shortcut Ctrl+Shift+C for copying content in LaTeX format instead of plain text. Users should locate the lines containing "&LaTeX" and "Plain &Text" and replace them with specific MenuItem commands to achieve this functionality. The discussion also touches on the MenuEvaluator feature, which allows for custom behavior when menu items are selected, and suggests using the FrontEndExecute command for modifications directly within a Mathematica notebook.

PREREQUISITES
  • Familiarity with Mathematica 8.0 interface and file structure
  • Basic understanding of LaTeX formatting
  • Knowledge of editing configuration files in software applications
  • Awareness of Mathematica's FrontEndExecute command
NEXT STEPS
  • Research how to use FrontEndExecute in Mathematica for configuration changes
  • Explore the MenuEvaluator feature in Mathematica for creating custom menu behaviors
  • Learn about advanced LaTeX formatting techniques for Mathematica outputs
  • Investigate other customizable shortcuts in Mathematica 8.0
USEFUL FOR

Mathematica users, particularly those looking to enhance their workflow with LaTeX formatting, as well as developers interested in customizing the Mathematica interface and functionality.

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