# Why does a new command create a space?

In the below code, I create my own little macro which makes a subsubsection heading. I then call the macro and type out verbatim what the macro says, and I get a different spacing.

\documentclass{article}
\newcommand{\eepoint}[1]{\vspace{3mm}\par\refstepcounter{subsubsection}\noindent{\bf \thesubsubsection.}   {\em #1.}
}
\begin{document}
\eepoint{A buncha stuff} And some more stuff
\vspace{3mm}\par\refstepcounter{subsubsection}\noindent{\bf \thesubsubsection.}   {\em A buncha stuff.} And some more stuff
\end{document}


What is that space that is added there?

I actually like it: I think it looks nice. So if I type out everything the macro says manually, how do I produce the exact same spacing?

Also, sometimes when I do it manually, I get a little indent. (It hasn't shown up in this MWE for some reason: often the 0.0.2. line is indented just a little). Any ideas about fixing this?

• The end of line after {\em #1} – egreg Nov 24 '16 at 14:26
• If you used a real heading or list item code latex would take some care not to have this failing (mostly by not using \noindent) – David Carlisle Nov 24 '16 at 14:27
• – David Carlisle Nov 24 '16 at 14:29
• The end of the definition of \eepoint contains the phrase {\em #1.} . TeX' reading apparatus attaches a space at the end of each line of input. Thus there is a space at the closing brace that gets tokenized as space token. This space token will be "spit out" whenever \eepoint gets expanded. (Can be avoided by % at ends of lines.) In the document-body, the call \eepoint{A buncha stuff} And some more stuff also contains a space behind the closing brace which gets tokenized too. Therefore summa sumarum you get two consecutive space tokens, each of them delivering horizontal space. – Ulrich Diez Nov 24 '16 at 22:14
• If you like more horizontal space, consider using the \quad-command. Afaik it delivers horizontal space in the width of the capital letter M. Or \qquad delivers horizontal space in the width twice of the capital letter M. If you do so, consider using \ignorespaces at the end of the definition of your macro for ensuring spaces after the closing brace of the argument of \eepoint don't deliver additional horizontal space. – Ulrich Diez Nov 24 '16 at 22:19

You can adjust the spacing to whatever values you need but

\documentclass{article}

\makeatletter
\newcommand\eepoint[1]{\@startsection{subsubsection}{3}{\z@}%
{3.25ex\@plus 1ex \@minus .2ex}%
{-1em}%
{\normalfont\normalsize\bfseries}{\mdseries\itshape#1}}
\makeatother

\begin{document}
\eepoint{A buncha stuff} And some more stuff
\vspace{3mm}\par\refstepcounter{subsubsection}\noindent{\bf \thesubsubsection.}   {\em A buncha stuff.} And some more stuff
\end{document}


done this way LaTeX will take care of white space in the document

\eepoint{A buncha stuff} And some more stuff


is the same as

\eepoint{A buncha stuff}And some more stuff


or

\eepoint{A buncha stuff}
And some more stuff


Also page breaking near the heading etc.