# \noindent doesn't work in macro with parameter

Consider the following MWE.

\documentclass{minimal}

\usepackage{lipsum}

\newcommand*{\mynoindent}{\noindent}
\newcommand*{\yournoindent}[1]{\noindent}

\begin{document}

\noindent
\lipsum[1]

\mynoindent
\lipsum[1]

\yournoindent{stuff}
\lipsum[1]

\end{document}


This outputs the following. Here are close-ups of the relevant indentations (the first two are identical, and so I only show one of those).

If you look closely, you can see that the second is indented every so slightly. How can I go about fixing this?

(Of course, in this example, I don't actually use the parameter, but for what I want to do, I need to be able to send a parameter to a command that ends in a \noindent.)

• you should almost never use \noindent in the definition of a top level latex command anyway (it is only used in one place in the latex format, in \@hangfrom which isn't really a latex command, just a remnant of plain tex. – David Carlisle Jul 11 '16 at 9:09
• @DavidCarlisle You mean like how you should almost never use \def in a top-level LaTeX command? In this case, there is the LaTeX \newcommand. What is the LaTeX version of \noindent? – Jonathan Gleason Jul 11 '16 at 13:54
• @DavidCarlisle What is the 'correct' way to go about doing this then? The effect I am going for in practice is not unlike the effect with \section. More specifically, I have a command \Step that takes a single argument and outputs "Step <counter>: <argument>". It then ends the paragraph, and finally ends with a \noindent (and now \noindent\ignorespaces) (it also of course increases the counter). – Jonathan Gleason Jul 11 '16 at 14:04
• I'd probably define it using \@startsection (basically a copy of say subsubsection from article.cls but with modified formatting of the argument and number) – David Carlisle Jul 11 '16 at 14:15

\newcommand*{\yournoindent}[1]{\noindent\ignorespaces}

which should gobble (or ignore) the space following \yournoindent{<stuff>}.
• \newcommand\abc}{} is there an extra brace there? – A Feldman Jul 11 '16 at 9:45