# Math symbol at end of sentence adds space -> How to avoid?

When I am using a math symbol at the end of a sentence, LaTeX is adding a space before the period. An example would be:

I start a sentence, which I will end with an symbol like $\Omega_{W}$.
Start of next sentence...


=> produces

How can I suppress this added space between symbol and period?

The according MWE is:

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[german]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\begin{document}
I start a sentence, which I will end with an symbol
like $\Omega_{W}$. Start of next sentence...
\end{document}

• to reduce the spacing in this case you can type $\Omega_{W}\!$. – user4686 Sep 11 '17 at 19:02

The space is inserted because of \scriptspace, which is automatically added when a math atom has a subscript or superscript. Its default value is 0.5pt and we can see its effect by changing the value:

\documentclass{article}

\begin{document}

I start a sentence, which I will end with an symbol
like $\Omega_{W}$. Start of next sentence...

\scriptspace=20pt

I start a sentence, which I will end with an symbol
like $\Omega_{W}$. Start of next sentence...

I start a sentence, which I will end with an symbol
like $\Omega_{W}\kern-\scriptspace$. Start of next sentence...

\end{document}


The last example shows how to remove the added space (the command is independent of the current value of \scriptspace).

This added space doesn't show up in the \showoutput listing, because it's added at a different level, precisely when transforming a math list into a horizontal list. See rules 18b, 18c and 18d in the TeXbook, Appendix G.

• +1 also for mine. Very good. Hi David and Egreg. – Sebastiano Sep 11 '17 at 20:45
• Actually the extra space does appear in \showoutput but not as a separate entity: one gets \hbox(5.46666+0.0)x9.70013, shifted 1.79999 for the subscript W, whereas a \scriptstyle W gives \hbox(5.46666+0.0)x9.20013 which is the 0.5pt narrower. – Andrew Swann Sep 13 '17 at 7:31