3
$\begingroup$

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]

enter image description here

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 }\)}
*)
$\endgroup$
4
$\begingroup$

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]"}}
*) 
$\endgroup$
  • $\begingroup$ Hi, Is limit so special only? How many keywords like limit are so special? $\endgroup$ – HyperGroups Jul 4 '13 at 1:35
  • $\begingroup$ See my updated answer. $\endgroup$ – Jens Jul 4 '13 at 2:23
  • $\begingroup$ ha, Good to know about that, so we can also add user defined Symbols? $\endgroup$ – HyperGroups Jul 4 '13 at 2:26
  • $\begingroup$ Yes, that's right. According to the docs, this option may be subject to change, though. So better use sparingly. $\endgroup$ – Jens Jul 4 '13 at 2:30
2
$\begingroup$

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:

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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