1

I have a newcommand defining a special paragraph (it's for a cheatsheet document):

\newcommand{\command}[2]{#1~\dotfill{}~#2\\}

I'm using it in the document in the following way:

\command{A}{Desc A}
\command{B}{Desc B}
\command{C}{Desc C}

Other section of my doc.

This code generates me a warning on line with \command{C}:

Underfull \hbox (badness 10000) in paragraph at lines <n>--<m>

I understand it's because this line is followed by a blank line.

So one solution I found to avoid this warning is to change my definition to:

\newcommand{\command}[2]{#1~\dotfill{}~#2}

(without the new line). And use it the following way:

\command{A}{Desc A}\\
\command{B}{Desc B}\\
\command{C}{Desc C}

Other section of my doc.

But I find it's not super clean, is it a way to do it automatically?

In fact, I want \command to act like a paragraph.

fievel
  • 111
  • 1
    If you want it to act like a paragraph, finish the definition of \command with \par instead of \. That is a better way for many reasons, one of which is the behavior you cite. – Steven B. Segletes May 30 '17 at 10:31
  • A common mistake for new users is to micromanage LaTeX with the wanton use of \. Outside of tabular and aligning applications, \ should be used sparingly if at all. Generally, there is a proper LaTeX way to do what one is trying to otherwise accomplish with a \. So, anytime you get the urge to insert a \, ask yourself, what am I really trying to accomplish at this location in the document? And look for a better way. – Steven B. Segletes May 30 '17 at 10:39

0 Answers0