6

I like to use the $$\sum S_{i}$$ or something similar. But I get the dot . or the comma , placed in an awkward position. I work around this problem sometimes by using $ \sum S$, but this is not good to stress things. Then again to be more specific, I use

\begin{equation}
...
\end{equation}

but I have noted that I overuse the latter so I want to somehow have the comma typeset the correct way when I use $$ something $$. Please note that in some languages comma is used to separate connected clauses -- this differs from English! But, suppose I want to use $$....$$, where ... or how can I write ...in other words it means $$...$$. where I have used the period. Using it as-is, it comes after the equation on the next line. How can I fix this?

In the example below, how can I fix the comma or the dot?

$$\sum S$$, where I have nothing really to say in this example.

It is $$\sum S$$.

3

1 Answer 1

11

As @Gonzalo mentioned in his comment, you should use \[...\] instead of $$...$$ for displayed math equations. Consider reading more about this (and other LaTeX2e tabu's) by viewing the l2tabu documentation.

Regardless, you have two choices, depending on whether you write a displaystyle \[...\] or textstyle \(...\) (or $...$) math expression:

  • In displaystyle math mode, everything after the \] is flushed to the next paragraph, including punctuation. So, to have punctuation contained with the displayed equation, just include it as you would normally within text. Here's an example:

    This is some paragraph text, and you can see that
    \[
      a^2+b^2=c^2.
    \]
    Here is the next paragraph.
    

    Punctuation in display math

    Although I added some whitespace to accentuate the displaystyle math format, this is not really necessary. That is, the following example will produce the same result:

    This is more paragraph text, and you can see that \[a^2+b^2=c^2.\] Here is the next paragraph.
    

    However, even though the output is perhaps the main purpose of a (La)TeX project, readability of code adds to its longevity.

  • In textstyle math you can do the same as above, although it is better to use:

    This is some paragraph text, and you can see that $a^2+b^2=c^2$.
    Here is the next sentence.
    

    Punctuation in text math

    If you do want displaystyle math in textstyle math mode, then you can force that using:

    This is some paragraph text, and you can see that $\displaystyle\sum S_i$.
    Here is the next sentence.
    

    displaystyle equation in textstyle math mode

    Note, however, that your interline spacing will be off. Or, even if it is maintained, there may be some overlap with symbols that are extensible in displaystyle math mode.

You must log in to answer this question.

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