8
$\begingroup$

I'm creating a styled notebook showing a simple theorem. I can set cell style as text or theorem or code to satisfy my requirement. But when I explain the theorem, I need to embed formula (not necessary for a whole line) into text. How can I do that. I didn't find any style for that.

$\endgroup$
1
  • $\begingroup$ @Nasser I didn't know that Ctrl+9 is sufficient because the doc says otherwise and I use this rarely. Btw, you can close an inline cell by pressing Ctrl+0. $\endgroup$
    – halirutan
    Jan 5, 2014 at 3:17

2 Answers 2

7
$\begingroup$

Pretty easy: This is called an Inline Cell and you can start one with Ctrl+(. For the inline cell you can specify whatever style you like.

Mathematica graphics

Edit

It seems Ctrl+9 is sufficient to start a new inline cell. The official shortcut listing says that you should type a (, therefore, I assumed that you need the Shift too.

$\endgroup$
5
  • $\begingroup$ Thx. It seems "Shift" is not neccessary. $\endgroup$
    – zhangwfjh
    Jan 5, 2014 at 3:10
  • $\begingroup$ @zhangwfjh Yes, I have noticed this too (now). I have updated my answer and I included a link to the official shortcut keys. $\endgroup$
    – halirutan
    Jan 5, 2014 at 3:14
  • $\begingroup$ Quite useful. Thanks again. $\endgroup$
    – zhangwfjh
    Jan 5, 2014 at 3:20
  • $\begingroup$ @zhangwfjh TraditionalForm is my choice for inline formulas. But I don't think you can impose it via CTRL+) because it is not a style and needs evaluation. What I do is usually keep a separate list of inline formulas all in TraditionalForm. Then you can just copy-paste them inside your text as they are. $\endgroup$ Jan 5, 2014 at 13:20
  • $\begingroup$ It never even occurred to me that shift+9 and ( are the same keys until now. $\endgroup$
    – Matt G
    Oct 2, 2016 at 12:35
8
$\begingroup$

I would like to expand a bit the answer of Vitaly Kaurov in the comments to the answer of halirutan. I type inline formulas usually as it is described in the halirutan answer. However, sometimes, though, rarely it does not work, and I need to apply the way Vitaly described. Then it may be done as follows:

  1. In the text cell type your text. For instance "some text".
  2. Make Ctrl+9 to start the inline math cell
  3. Type the expression that should further be visualized as a formula. Assume we want there to be an indefinite integral of Exp[-x]. Then type

    Integrate[Exp[-x],x]//Defer//TraditionalForm

  4. Close the inline cell Ctrl+0. You may type some more text further, if needed.
  5. Mark the content of the inline math cell.
  6. Go to Menu/Evaluation/Evaluate in Place. Done.

So the difference with respect to what Vitaly proposed is that each formula is evaluated at once and there is no need to keep the list of the inline formulas.

In contrast to what I have written here I find that keeping a list of all the inline formulas used in the document, might be advantageous. Indeed, very often right after typing the formula in I find that it should be preferably shown in a slightly different way. It is faster to rewrite an already existing expression then to write it down anew.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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