Search code examples
latexpunctuation

Punctuation in LaTeX formulas


It seems to be common practice, when writing mathematics, to add punctuation to displayed formulas.

Is there any trick to avoid putting the punctuation mark inside the formula?

I want to avoid

Consider the function
\[ \sin(x).\]

I'd rather have something like:

Consider the function
\[ \sin(x)\].

But of course the full stop is displayed below the formula.

Is there a clever way to separate formulas and punctuation in LaTeX?


Solution

  • You can load the breqn package (compatible with amsmath) and have this behaviour inbuilt with its dmath environment:

    Consider the function
    \begin{dmath}\sin(x)\end{dmath}.
    

    Will output the same as \[\sin(x).\], i.e., as if the dot was inside the expression.

    As a bonus, you'll also get automatic line-breaking in your math equation.