Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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 }\)}
*)
share|improve this question

1 Answer 1

up vote 4 down vote accepted

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:

text

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:

paste

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

paste dialog

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"}], 
        TraditionalForm]], FormatType -> "TraditionalForm"], "."}], 
   "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":

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]"}}
*) 
share|improve this answer
    
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

Your Answer

 
discard

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

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