# How to make underscript like underscript in InlineFormula of lim in Notebook and (inline)Latex

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:

subscript $\lim _{n\to \infty }$underscript $\lim_{n\to \infty }$

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


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

Further, you'll see that when export to Tex, they are same.

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

(*
{subscript $$\lim _{n\to \infty }$$superscript $$\lim_{n\to \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? –  HyperGroups Jul 4 '13 at 1:35
See my updated answer. –  Jens Jul 4 '13 at 2:23
ha, Good to know about that, so we can also add user defined Symbols? –  HyperGroups 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