Do starred commands eat up spaces after them, like unstarred ones do? That is, is \somecommand* nextword equivalent to \somecommand*nextword?

And: Does it depend on the particular way a starred command is defined?

Edit: Note that the original version of my question left out me considering only zero-argument commands. I was assuming this, and it was mostly clear (albeit implicit) from the question statement. User @tohecz has written a valuable answer (to the pre-edit version) addressing this detail.

Note that I'm asking about commands with a star at the end of their name (\somecommand*), not about whether the command was defined using a starred defining command (e.g. with \newcommand*).

  • This should be fairly easy to test or am I missing something? Behavior really should be the same as without the *, unless the macro was designed to do things differently based on the presence or absence of the *. Commented Feb 11, 2013 at 5:07
  • @PeterGrill Yeah :-) I was gonna test it but then found that there are a handful of different ways of doing things (e.g. what's in the UK TeX FAQ). I figured someone might already know this already, if the answer is method-independent (for the methods that are presently used). Commented Feb 11, 2013 at 5:12

4 Answers 4


No they don't:

enter image description here

\usepackage{suffix,xparse}% http://ctan.org/pkg/{suffix,xparse}
  \mycmdA@star% \mycmd*
  \mycmdA@nostar% \mycmd
Here is \mycmdA and \mycmdA* in one line. \par
Here is \mycmdB and \mycmdB* in one line. \par
Here is \mycmdC and \mycmdC* in one line.
  • By the way, see my comment in the tohecz thread. Commented Feb 12, 2013 at 0:58

As the other answers show, they do not. However, the spaces get "eaten" if the macro takes other arguments after *:




\section {Hello}
\section* {World!}


enter image description here

In general, TeX ignores all spaces when looking for an argument (unless it is not, which is when an argument is delimited (like optional arguments are):

\foo [abc]    % prints: (abc)
\foo[abc]     % prints: (abc)
\foo [ abc]   % prints: ( abc)
\foo[ abc]    % prints: ( abc)

\baz |abc|    % prints: (abc)
\baz|abc|     % prints: (abc)
\baz | abc|   % prints: ( abc)
\baz| abc|    % prints: ( abc)
  • Good point; see my edit to the question statement. Commented Feb 11, 2013 at 7:52
  • @LoverofStructure Despite not being what you ask for, it seems to be a consensus here that we treat even the closely-related stuff, in the sense of "wiki-like" approach ;)
    – yo'
    Commented Feb 11, 2013 at 7:59
  • I welcome your answer and I think it belongs here. (Just like other informative edits and questions, though some other SE sites have a more rigid approach towards the latter.) But it's also good that I clarified the scope of my question; it'll prevent confusion. More importantly I'd find it weird not to tell you about my edit :-) Commented Feb 11, 2013 at 8:12
  • Agreed :) .
    – yo'
    Commented Feb 11, 2013 at 9:02
  • 1
    @LoverofStructure: This is intentional. All spaces after a control sequence is gobbled; grabbing the first * is as a result of \@ifstar, leaving a final * for printing...
    – Werner
    Commented Feb 14, 2013 at 1:46

As other answers have indicated, technically the space dropping is part of the scanning for a command name, and at the primitive TeX level the * is not part of the name.

However in LaTeX syntax the star form is always considered a distinct command \section and \section* are documented as two related commands, not one command that looks ahead to see if there is a * or not.

So it is good practice to make the star form have similar behaviour to the non-star form.

In all cases in the base LaTeX format, as far as I can see, the *-command is always used with arguments (like \section*) and so any space is skipped at a different stage or occurs at places where a space character will make a space token but won't produce space in the output \\*, \ProcessOptions*.

Thus I don't think any standard LaTeX * form of a command would produce white space from a space character after the *.

  • Or \tableofcontents* in memoir.
    – egreg
    Commented Feb 11, 2013 at 17:28
  • Thanks! One thing I can't quite follow is the part of the sentence that reads "skipped at a different stage". Commented Feb 11, 2013 at 19:38
  • @egreg See my comment to the @tohecz thread. David Carlisle's point that in TeX the * is not part of the name shows in those examples. Parsing irregularities in (La)TeX are imho an area that needs improvement. (LaTeX 3?) Commented Feb 11, 2013 at 19:56
  • 3
    @LoverofStructure in \section {hello} the space is never tokenized it is lost while scanning the command name. in \section* {hello} the space is seen and tokenized but space tokens before mandatory arguments are dropped while scanning for macro arguments "a different stage" Commented Feb 11, 2013 at 20:24

Only control words eat space after them! Control words are macros begin with the escape character \ and followed by one or more letters.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .