Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If I use the following function to define me a fancy subscript:

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


fancySubscript[var_Symbol, tag_String, index_Integer] /;
  Not[ValueQ[var]] := Subscript[var, tag <> ToString[index]]

fancySubscript[var_Symbol, tags : {_String ..}, index_Integer] /; 
  Not[ValueQ[var]] := fancySubscript[var, #, index] & /@ tags

fancySubscript[var_Symbol, tags : {_String ..}, indices : {_Integer ..}] /; 
  Not[ValueQ[var]] := fancySubscript[var, tags, #] & /@ indices

I can use the following now:

fancySubscript[b, {"b"}, Range@3]

$\left( \begin{array}{c} b_{\text{b1}} \\ b_{\text{b2}} \\ b_{\text{b3}} \\ \end{array} \right)$

With the notation module by symbolizing the subscripts: the values are now :


1. Problem
But when I want to refer to such a variable in the list above and write with the shortcuts in a cell by typing b then Ctrl+_ then 1.

The variable is a new symbol because i did not use Quotes ""


How can we circumvent this that I can still write all variables in the cell and they are parsed and interpreted as the one defined in the fancySubscript command?

It is not so easy because, when I would use something like this:

fancySubscript[b, {b}, Range@3]

I would get an infinite loop, because it is no more a string, hm...

2. Problem:

I cannot assign it back to the variable b:

 b=fancySubscript[b, {"b"}, Range@3]

This gives an infinite loop, but when I try this:

btemp=fancySubscript[b, {"b"}, Range@3]

This should work, and not give an inifinte loop, because btemp contains the new defined symbols and they should then be assigned to b again, but also here mathematica trys to run a recursion which I dont understand??

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.