# Space generated by theorem labels (XeTeX)

With the thmtools package, combining \begin{foo}[name=bar,label=x] with the line \newtheorem{foo}{Foo} in the preamble typesets to Foo xxx (bar), where xxx is a number. After the (bar) there is an extra space which is about 6pt. To remove it completely, as I have seen at Extra space before labeled theorem body with thmbox or thmtools+thmbox, it is sufficient to add % after the label=x] part. The point is, if I add any number of \,s after it, they get completely ignored, whereas \hspaces, \quads and \qquads don't. Try typesetting:

%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
\documentclass[a4paper]{report}
\usepackage[italian]{babel}
\usepackage{thmtools}
\newtheorem{foo}{Foo}

\begin{document}
\begin{foo}[name=bar,label=x]\hspace{5cm}
With the space.
\end{foo}
\begin{foo}[name=bar2,label=x2]
Without the space.
\end{foo}
\begin{foo}[name=bar3,label=x3]\,\,\,\,\,\,\,\,
With 8 \verb"\,"s.
\end{foo}
\end{document}


On my computer, the \,s don't produce any space, whereas the \hspace does. Why does that happen?

Adding % after the label seems not to eliminate the space. Since this has generated a couple of overful \hboxes, I'd like to know how I can remove it.

%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
\documentclass[a4paper]{report}
\usepackage[italian]{babel}
\usepackage{thmtools}
\newtheorem{foo}{Foo}

\begin{document}
\begin{foo}[name=bar,label=x]%
With the \verb"%".
\end{foo}
\begin{foo}[name=bar2,label=x2]
Without the \verb"%".
\end{foo}
\end{document}


-
As David explains, the command \, is a bit dangerous. On the other hand a string of \, is surely wrong. –  egreg Mar 20 '14 at 22:49
On the edited additional question, I'm not sure why you'd expect a % there to have an effect. White space never affects the start of a paragraph or list item. –  David Carlisle Mar 25 '14 at 13:48
A theorem is a list item, and the space between (bar) and With is \labelsep so adding \setlength{\labelsep}{0pt} before \begin{foo} suppresses it. –  David Carlisle Mar 25 '14 at 13:57
The reason was that I thought, since it has that effect in \label{}%, as stated in the link I put in the question, by extension, it should do the same if placed there. Obviously that was wrong thinking :). –  MickG Mar 25 '14 at 16:07

The \, do generate space (as you can see in your image) but it is vertical space:

...\kern 1.70374
...\kern 1.70374
...\kern 1.70374
...\kern 1.70374
...\kern 1.70374
...\kern 1.70374
...\kern 1.70374
...\kern 1.70374
...\glue(\parskip) 0.0 plus 1.0
...\glue(\baselineskip) 2.0
...\hbox(7.5+2.5)x345.0, glue set 225.66599fil
....\hbox(7.5+2.5)x67.92326
.....\glue 0.0
.....\glue 0.0
.....\glue -5.0
.....\hbox(7.5+2.5)x67.92326
......\glue 5.0
......\OT1/cmr/bx/n/10 F
......\kern-0.95833
......\OT1/cmr/bx/n/10 o
......\kern0.31944
......\OT1/cmr/bx/n/10 o
......\glue 3.83331 plus 1.91666 minus 1.27777
......\OT1/cmr/bx/n/10 3


\hspace generates a \hskip but \, if not in math mode generates a kern which doesn't automatically start a paragraph, so in vertical mode (as here) it adds vertical space. probably it ought to have been defined with \leavevmode

-
Yes, it ought to. ;-) –  egreg Mar 20 '14 at 22:48
Has anyone noticed my last edit, which added an issue to the question? No because it's been a while and no-one has answered :). –  MickG Mar 25 '14 at 13:04
@MickG It's best to ask new questions rather than edit old ones, really. –  David Carlisle Mar 25 '14 at 13:46