I've been trying to find a way to make a keyboard shortcut to copy a selection of mathematica code to tex form, then copy it to my clipboard, since right clicking-> copy as-> LaTeX is very tedious. I can speed this process up a little by right clicking->Y->L, but it's still quite tedious. I can do this for the last output, but I have to type


which is also quite tedious.

Additionally, I can select an input OR output cell and copy as LaTeX, but I cannot do both at the same time. This is annoying if I want to show the input as LaTeX, and then the answer, for example when integrating:

    In[34]:= Integrate[Sin[x], {x, -10, 6}]

    Out[34]= -Cos[6] + Cos[10] 

I have previously been selecting the integrate cell, right clicking copy as LaTeX and repeating for the output.


This may be helpful:

 DockedCells -> {
    "copy as tex",
    SelectionMove[ButtonNotebook[], Previous, CellGroup];

If your insertion point is right below the input/output cell group, then clicking the button (which should be showing up in a docked cell at the top of the notebook) will briefly select that input/output cell group and copy them as TeX. I tested this on Windows (version 10.3) and it should work on any recent version of Mathematica.

If this is useful you can make a few improvements: Change EvaluationNotebook[] to $FrontEnd to have the docked cell appear on any notebook. Also: create addition buttons which move the selection to only the previous output cell or only the previous input cell.

Screen shot:

enter image description here

  • $\begingroup$ This is definitely an improvement! I thought about using a button, but lacked the knowledge to create it, so thank you! Is there a way I could automatically include "\\" between the two lines? $\endgroup$ – ZufolgeWeierstrass Mar 4 '16 at 12:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.