In a notebook, type in


then select it and use Copy As → LaTeX. The resulting LaTeX code is

\text {theta}^2

Now try

(* \theta ^2 *)

Note that theta turned into \theta in the second case.

Why is there a difference between copying and using TeXForm directly? How can I control whether spelt-out names of greek letters, such as theta, will be converted into the actual Greek letter, i.e. \theta?

One possible, but slightly inconvenient way to prevent the processing of such names is to replace them with strings, theta -> "theta". I do not usually mind this processing (I actually prefer it), I am simply looking for a way to control it.


1 Answer 1


It has something to do with these: Convert`TeX`BoxesToTeX[ToBoxes[theta^2]] and Convert`TeX`ExpressionToTeX[theta^2]. That and copying from a notebook deals with boxes and TeXForm deals with expressions. Convert`TeX`ExpressionToTeX calls Convert`TeX`BoxesToTeX with the option

"BoxRules" -> System`Convert`TeXFormDump`$GreekWords

but copying as TeX does not.

Managing TeXForm

TeXForm[expr] applies the list of rules System`Convert`TeXFormDump`$GreekWords when it is typeset.


Block[{System`Convert`TeXFormDump`$GreekWords = {}},
 CellPrint@ExpressionCell[TeXForm[theta^2], "Output"]

Note that

Block[{System`Convert`TeXFormDump`$GreekWords = {}},

does not work because the output is TeXForm[theta^2], which is then typeset after exiting the Block[]. One can set the value of $GreekWords globally, so that TeXForm[theta^2] would be typeset without converting words to letters.

Managing CopyAs > LaTeX

This is but a partial answer. Setting the following option should work to make CopyAs > LaTeX convert Greek letter names to letters, assuming System`Convert`TeXFormDump`$GreekWords retains its default value:

  "BoxRules" -> System`Convert`TeXFormDump`$GreekWords];

On a Mac, it works when I use the context menu (CTRL-click, CopyAs > LaTeX). However, I find it does not work with the menu-bar command Edit > CopyAs > LaTeX. (I have no clue why as yet, nor how it works on other systems.)

  • $\begingroup$ FrontEnd`CopyAsTeX does not override the default options to Convert`TeX`BoxesToTeX, fwiw. $\endgroup$
    – Michael E2
    Commented Nov 26, 2016 at 14:39
  • $\begingroup$ This works though: Block[{...}, ToString[theta^2, TeXForm]] or Block[{...}, ToString@TeXForm[...]]. Great spelunking, thanks! $\endgroup$
    – Szabolcs
    Commented Nov 26, 2016 at 16:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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