Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Which one is more common way to type LaTeX or are there any standards?

Thus $x=2$.


Thus $x=2.$
share|improve this question
I wouldn't add the period into the math environment since its not part of the equation. –  Chris Dec 12 '13 at 12:29
In your question you are using inline mode. So I am agree with Chris. In your comment you are using the displaymath mode. I have never end a sentence with a displaymath formula. –  Marco Daniel Dec 12 '13 at 12:34
@practicing: This is then a question how you express your sentences. I wouldn't let a sentence begin or end with a formula. –  Chris Dec 12 '13 at 12:44
@practicing except don't use $$ in latex. (There is no good answer to getting end of sentence punctuation into a display, if you have to do it, something like quad\text{.} but arranging the wording nor to require it is best. Sentence punctuation should be using teh text fonts not the math ones (although you can't always tell with a . :-) –  David Carlisle Dec 12 '13 at 12:45
I can't see a reason to disallow sentences that end with a formula. It's grammatically sound if done properly, e.g. 'We have now shown that $a=b$.' A longer formula would need to be shown in displaymath mode, but there is still no reason why it can't end a sentence. –  Ian Thompson Dec 12 '13 at 12:56
show 6 more comments

2 Answers

The case of displayed formulas is a matter of opinion, I'll tell about it later. For punctuation after an inline formula, there is no doubt: it doesn't belong to the formula, so it should be typed outside it.

Here's the relevant excerpt from the TeXbook

\subsection Punctuation.  When a formula is followed by a ^{period}, ^{comma},
^{semicolon}, ^{colon}, ^{question mark}, ^{exclamation point}, etc., put the
^{punctuation} {\sl after\/} the |$|, when the formula is in the text; but
put the punctuation {\sl before\/} the |$$| when the formula is displayed.
For example,
If $x<0$, we have shown that $$y=f(x).$$
\TeX's spacing rules within paragraphs work best when the
^{punctuation marks} are not considered to be part of the formulas.

with a scanning of the output

enter image description here

Of course one shouldn't use $$ in LaTeX, but the idea is the same.

The difference between

If $x<0$, we have shown that $y=f(x)$. Therefore …


If $x<0,$ we have shown that $y=f(x).$ Therefore …

is actually seen only when “British” spacing is used, because in the former case the period is considered as sentence ending, while in the latter it isn't. Here's the output, with \nonfrenchspacing in force:

enter image description here

If \frenchspacing is in force, instead, the result is exactly the same

enter image description here

but this doesn't mean one is allowed to put punctuation in the formula: it's logically wrong.

When displayed formulas are concerned, there are various schools of thought; but there's no doubt that, if punctuation is used, it must be inside the displayed formula:

  1. put punctuation at the end of the formula, with no added space;

  2. put punctuation at the end of the formula, with some added space;

  3. no punctuation at the end of the formula, the context will make readers able to add it by themselves.

I adhere to current number 1, following Knuth's advice. I find that following current 2 leaves punctuation hanging from nowhere, particularly if the added space is a quad. A thin (\,) or medium (\:) space might help to clear away from ambiguities in some cases, but where ambiguity is possible, rewording is usually the best strategy.

Of course one must adhere to only one of those conventions across a document.

share|improve this answer
British spacing has to die! Sort of related to: meta.tex.stackexchange.com/a/3426/21891 –  Jubobs Dec 12 '13 at 14:11
And don't worry too much about the "punctuation for sentences ending in displayed formula" issue if you are preparing the document for a commercial publisher. House styles overrule whatever you personally like. (I had just dealt with some author proofs where every other displayed equation there is a change log of the form "removed \; before punctuation".) –  Willie Wong Dec 12 '13 at 14:14
@Jubobs “Fog in Channel, continent cut off”. –  egreg Dec 12 '13 at 14:23
there may be another difference if \mathsurround is not equal to zero... –  lvaneesbeeck Dec 26 '13 at 13:21
@lvaneesbeeck If one chooses to set \mathsurround to a nonzero value, the punctuation should go outside the formula anyway. –  egreg Dec 26 '13 at 13:31
add comment

Assuming that we are talking about inline mathematics, it would seem strange to me (and judging by the comments, to others as well) to put the full stop inside the math environment. This is because it is not part of the mathematics. The mathematics is the last "part of the sentence", and the sentence ends afterwards, so that is where the full stop should go. So I say the following version is correct:

Thus $x = 2$.

However, when I have punctuation at the end of a quotation I always put it outside the quotation marks, for the same reason.

``I think it will rain this afternoon'', she said.

There are some writers who regard this as wrong (they think the comma should go inside the quotes). Maybe they would see my opinion about putting the full stop "inside the dollar signs" as wrong, too. :-)

In the case of displayed mathematics, however, you will want the full stop (or comma, or semicolon) to be displayed along with the mathematics, not hanging out by itself at the start of the next line of text. So there you have no choice but to put the punctuation within the math environment:

Thus \[x = 2.\]
share|improve this answer
I am not sure if LateX would induce a linebreak for punctation marks only. I have have seen this behavious a lot of times with Word, but never with LaTeX (which doesn't have to mean anything, since its anecdotal evidence). –  Chris Dec 12 '13 at 13:42
add comment

Your Answer


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.