# How to make underscript format as an underscript in an inline cell?

This question maybe a little tiny.

Firstly, let's input underscript Ctrl+4 in an inline cell.

InlineFormula inline cell $$\underset{n\to\infty}{\text{li}}$$

However, if we use $$\lim$$, we get $$\lim_{n\to \infty }$$ .

Note: it looks the same in my Notebook as Subscript by Ctrl+- $$\lim _{n\to \infty }$$

### TextStyleCell with InlineFormula Inline cells:

For clarity, here's the Cell expression:

cellExpression = Cell[
TextData[{
"subscript: ",
Cell[BoxData[SubscriptBox["lim",RowBox[{"n","->","\[Infinity]"}]]],"InlineFormula"],
" underscript: ",
Cell[BoxData[UnderscriptBox["lim",RowBox[{"n","->","\[Infinity]"}]]],"InlineFormula"]
}],
"Text"
];


and this is what it looks like in my notebook:

CellPrint[cellExpression]


So how to show $$\underset{n\to\infty}{\text{lim}}$$ in Notebook's InlineFormula cell?

Further, you'll see that when exported to TeX, they are same.

StringCases[
ExportString[cellExpression,"TeX"],
"\\begin{document}"~~x__~~"\\end{document}" :> StringTrim@x
]

(*
{subscript: $$\lim _{n\text{-$$>$$}\infty }$$ underscript: $$\lim_{n\text{-$$>$$}\infty }$$}
*)


Here is a way to do what you want:

First I typeset the desired text cell with an inline equation, then I copy it as a Cell Expression:

Make sure that you typeset the limit using Underscript and not Subscript. It will still show up as a subscript, but we can now change its appearance by appending an option to the Cell expression that has been copied above. The popup menu above can only be accessed if you highlight the cell bracket, not the text itself.

To modify the limit positioning, I prepared the following code with some blank space into which you now paste the copied cell expression:

Here, it's important to copy the raw code, so don't say yes in the paste dialog that pops up:

What you get should look something like this:

CellPrint[
Append[Cell[
TextData[{"This is a text cell with the inline formula ",
Cell[BoxData[
FormBox[RowBox[{RowBox[{UnderscriptBox["lim",
RowBox[{"x", "\[Rule]", "0"}]],
RowBox[{"f", "(", "x", ")"}]}], "=", "0"}],
"Text", CellChangeTimes -> {{3.5818712143081923*^9,
3.5818712462119017*^9}, {3.581872565746663*^9,
3.581872576573649*^9}}]

,
UnderscriptBoxOptions ->
{
LimitsPositioning ->
False
}]
]


And if you execute this code, the following cell will have the limit typeset in "display style":

Edit

To answer the question in the comment: you can find out which objects are going to be converted to "subscripted" instead of "underscripted" by executing the command

Options[Cell, LimitsPositioningTokens]

(*
==> {LimitsPositioningTokens -> {"\[Sum]", "\[Product]",
"\[Intersection]", "\[Union]", "\[UnionPlus]", "\[Wedge]",
"\[Vee]", "lim", "max", "min", "\[CirclePlus]", "\[CircleMinus]",
"\[CircleTimes]", "\[CircleDot]"}}
*)

• Hi, Is limit so special only? How many keywords like limit are so special? Jul 4 '13 at 1:35
– Jens
Jul 4 '13 at 2:23
• ha, Good to know about that, so we can also add user defined Symbols? Jul 4 '13 at 2:26
• Yes, that's right. According to the docs, this option may be subject to change, though. So better use sparingly.
– Jens
Jul 4 '13 at 2:30

The easiest way to fix this is to adjust the stylesheet so that inline cells have script level 0.

SetOptions[
EvaluationNotebook[],
StyleDefinitions -> Notebook[
{
Cell[StyleData[StyleDefinitions->"Default.nb"]],
Cell[StyleData["InlineCell"], ScriptLevel->0, FontFamily->"Times"]
},
StyleDefinitions->"PrivateStylesheetFormatting.nb"
]
]


I threw in a FontFamily spec because I think it looks better. At any rate, here is a what a text cell with an inline cell looks like with this stylesheet: