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.

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.

share|improve this question
    
@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. –  halirutan Jan 5 at 3:17

2 Answers 2

up vote 5 down vote accepted

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.

share|improve this answer
    
Thx. It seems "Shift" is not neccessary. –  zhangwfjh Jan 5 at 3:10
    
@zhangwfjh Yes, I have noticed this too (now). I have updated my answer and I included a link to the official shortcut keys. –  halirutan Jan 5 at 3:14
    
Quite useful. Thanks again. –  zhangwfjh Jan 5 at 3:20
    
@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. –  Vitaliy Kaurov Jan 5 at 13:20

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.

share|improve this answer

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.