If I want to insert a math formula, usually just a math symbol, in text paragraph, LaTeX put the formula to the next line and put it in the middle of the line?

How can I just insert between text?

  • This is my text $\lambda$ where a symbol comes?
    – user11232
    Commented Feb 1, 2015 at 4:35
  • 3
    It would have taken you less time to type your title in your favourite search engine and find, for example, this: personal.ceu.hu/tex/math.htm
    – anderstood
    Commented Feb 1, 2015 at 5:12
  • 1
    @anderstood Thanks for the URL you provide, and know I know what the matter is. Using the weak environment $...$ rather than $$...$$ or \[...\] solve my problem.
    – Peter Zhu
    Commented Feb 1, 2015 at 6:08
  • @PeterZhu Glad you inserted the comment with $...$, because I was having a hard time finding which one to use when I looked at the URL provided by anderstood.
    – MikeyE
    Commented Apr 23, 2018 at 9:33

1 Answer 1


I think what Harish was intending to suggest in his comment is that you can use single dollar-sign delimited strings to shift into math mode and insert a formula.

So if you wanted to typeset "The expected rate of events is λ." you would write

The expected rate of events is $\lambda$. 

Were you to instead use \[ … \] or $$ … $$ to delimit your text, it would put the formula on the next line because this defines a displayed equation, which is placed on its own line, and (usually) centered.

See below (On \[ … \] vs. $$ … $$) for a further explanation of why you would choose between \[ … \] and $$ … $$.

The quick heuristic would be:

  • if you're writing LaTeX for CLI and local compilation, \[ … \]
  • if you are writing to display maths in a browser, $$ … $$.

So were you to typeset the previous example as:

The expected rate of events is \[\lambda\]. 

that would be rendered as:

The expected rate of events is



Note that the period is also placed after a new line because of the way that equation environments work.


As pointed out by Ethan in the comments, often if you are going to use this notation, it is more common to type:

The expected rate of events is \[

This makes explicit in the plaintext representation of your maths that you intend it to be on its own line.

See the attached image for a rendered example of what I mean.

enter image description here

On \[ … \] vs. $$ … $$

Though using double dollar signs ($$) to delimit displayed math mode in LaTeX is discouraged — see Why is \[ … \] preferable to $$? — this is not always feasible if you want your LaTeX to be rendered appropriately by MathJax based LaTeX interpreters that are common on web based text editors that provide maths typesetting support.

For example, the Jupyter notebook is designed to display both code and markup stored in JSON format, where mathematical content is LaTeX formatted plaintext that is interpreted via MathJax. However, if you use \[ … \] instead of $$ … $$ your LaTeX will refuse to render correctly because of the way that JSON requires escaping slashes (\). You can instead use \\[ … \\] but then this can cause other issues with interpreting LaTeX inside the delimiters forcing you to use nonvalid LaTeX to be able to write (for example) subscripts by escaping underscores. In this case and with other JSON based storage solutions for encoding plaintext, $$ … $$ is preferable in order to avoid these issues around \ and escaping.

Note: the Cross Validated StackExchange website explicitly encourages the use of $$ … $$. Or – more accurately – it encourages using:

  • 2
    It's good practice to put the \[ on its own line, followed by the math content, then the \] on its own new line. That way the shape of the document in your editor resembles what it will look like when compiled, and is easier to edit as necessary. Commented Aug 15, 2015 at 17:47
  • Thanks @EthanBolker! I edited to include your point (which is a good one). I generalized it to also account for $$ cases, since that is often encouraged when using MathJax, including on StackExchange websites, see Cross Validated's help documentation on LaTeX formatting.
    – mpacer
    Commented Dec 24, 2015 at 1:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .