0

I get different spacing results when I define a \hspace directly or as a macro.

Directly:

\documentclass{article}

\title{Title}
\author{Daniel Domingues \hspace{0.2cm}$\diamond$\hspace{0.2cm} Ricardo Cruz \hspace{0.2cm}$\diamond$\hspace{0.2cm} Rui d'Orey}

\begin{document}
\maketitle
\end{document}

Case 1

As a macro:

\documentclass{article}

\def\whatever{\hspace{0.2cm}$\diamond$\hspace{0.2cm}}

\title{Title}
\author{Daniel Domingues \whatever Ricardo Cruz \whatever Rui d'Orey}

\begin{document}
\maketitle
\end{document}

Case 2

It looks better when I use \hspace directly without the macro. Why is that?

lockstep
  • 250,273
Ricardo Cruz
  • 1,770
  • 1
  • 22
  • 34
  • 1
    This is a FAQ and must be a duplicate. the space character after \whatever is absorbed as the terminator for the macro name so does not make a token. the space character after } does make a token so produces a word space in addition to the stated space of .2cm. – David Carlisle Apr 19 '15 at 10:21
  • It is usually best not to have a space before or after \hspace, looking at the source you might think there was .2cm of white space but there s \hspace{.2cm} R produces one inter-word space, .2cm space and one more inter-word space. – David Carlisle Apr 19 '15 at 10:23
  • 1
    Rewrite the \author instruction as \author{Daniel Domingues\whatever Ricardo Cruz\whatever Rui d'Orey} -- note: no space before the two instances of \whatever -- and you'll less, but more even, spacing. OTOH, if you want more (as well as more even) spacing, write \author{Daniel Domingues \whatever\ Ricardo Cruz \whatever Rui d'Orey}. – Mico Apr 19 '15 at 10:24
  • That was quick ! --- you guys are awesome, thank you! – Ricardo Cruz Apr 19 '15 at 11:09

0 Answers0