I would like to use TeXForm to generate LaTeX output as usual. However, I use subscripted variables such as c_t. Unfortunately, when using Symbolize from the package Notation for this end, TeXForm does not work as expected. While I expected output such as c_t, I receive:

Symbolize[ParsedBoxWrapper[SubscriptBox["_", "_"]]];


Can anyone think of a better solution?


  • $\begingroup$ Perhaps StringReplace? $\endgroup$ Jan 19, 2015 at 18:25
  • $\begingroup$ Could you provide an example please? $\endgroup$
    – user191919
    Jan 19, 2015 at 18:27
  • $\begingroup$ StringReplace[yourSymbolizedVariable // ToString, StringExpression[b : __, "\[UnderBracket]Subscript\[UnderBracket]", e : __] :> StringJoin["Subscript[", b, ",", e, "]"]] // ToExpression // TeXForm $\endgroup$ Jan 19, 2015 at 23:48

2 Answers 2


Adding TraditionalForm for symbolized expressions

When you load Notation` package it automatically assigns definitions to MakeExpression and MakeBoxes function. Those definitions call NotationMakeExpression and NotationMakeBoxes functions respectively.

After symbolizing expression with a pattern, special definition is assigned to NotationMakeExpression function. This definition forces Mathematica to perform some tasks when expression, matching symbolized pattern, is encountered. A symbol, with name reflecting symbolized expression, is constructed, then special rules for this symbol are assigned to NotationMakeBoxes. These rules tell Mathematica what is box representation of constructed symbol in StandardForm.

Since only definitions for StandardForm are added, specially constructed symbol looks like symbolized expression in StandardForm and possibly other forms that use StandardForm boxes, but not in other forms.

TeXForm uses boxes from TraditionalForm not StandardForm. To solve your problem in general way for all symbolized subscripted expressions you could inspect NotationMakeBoxes definition and assign correct TraditionalForm to all symbols that have SubscriptBox assigned to StandardForm.

Let's define some functions that will do this automatically. We start with function that converts boxes in StandardForm to boxes in TraditionalForm:

SetAttributes[standardToTraditionalBoxes, HoldAllComplete]
standardToTraditionalBoxes[boxes_] := 
    Function[expr, MakeBoxes[expr, TraditionalForm], HoldAllComplete] @@
        MakeExpression[boxes, StandardForm]

Now a function converting NotationMakeBoxes down value to proper MakeBoxes definition for TraditionalForm:

            Notation`NotationMakeBoxes[sym_Symbol, StandardForm],
    ] :>
        SubscriptBox[x_, y_]
] := (
        sym /: MakeBoxes[sym, TraditionalForm] = 

And final function traversing down values:

updateSubscriptTraditionalForm[] := 
   Scan[addSubscriptTraditionalForm, DownValues[Notation`NotationMakeBoxes]]

updateSubscriptTraditionalForm function should be evaluated after all symbolized expressions were read by Mathematica and before using TeXForm.

Small test

Load Notation` and symbolize all expressions with subscripts:

Symbolize[ParsedBoxWrapper[SubscriptBox["_", "_"]]]

Now some strange test expression:

f[a + b]Sin[c]

in FullForm gives:


in TeXForm, before evaluating updateSubscriptTraditionalForm, gives:


and after updateSubscriptTraditionalForm evaluation, TeXForm gives:

f(a+b)_{\sin (c)}

Old answer using TeXUtilities package

After using Symbolize ct looks in FullForm like this:


So result you're getting is a "correct" translation to TeX of above expression.

(* \text{c$\mathsym{\UnderBracket}$Subscript$\mathsym{\UnderBracket}$t} *)

To get desired result you can add formatting rule to this expression using my TeXUtilities package.

Format[c\[UnderBracket]Subscript\[UnderBracket]t, TeXForm] = TeXVerbatim["c_t"];

(* c_t *)
  • $\begingroup$ Can I tell it to consider this the general formatting rule for subscripts? $\endgroup$
    – user191919
    Jan 20, 2015 at 18:36
  • $\begingroup$ @user191919 Unfortunately no. Format needs to assign formatting to specific symbols and after symbolization each expression with subscript is a separate symbol. But I've edited my answer and added different approach which should solve general problem. $\endgroup$
    – jkuczm
    Jan 20, 2015 at 23:49

As @jkuczm says, TeXForm is based on TraditionalForm. So, use the WorkingForm option to Symbolize to get it to work with TeXForm:

Symbolize[ParsedBoxWrapper[SubscriptBox["_","_"]], WorkingForm->TraditionalForm]


Subscript[c, t] //TeXForm


  • $\begingroup$ This did the trick for me. For some reason the @jkuczm answer threw an error. $\endgroup$
    – Sterling
    Jan 26, 2021 at 19:57

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.