I use LaTeX mostly for homework assignments. And I would like a faster way to type

\noindent\textbf{problem number} 

Since I do it for every problem and every part of the problem if it has multiple parts.

I was thinking something like this might work, but it isn't:


I've tried with and without the \textbf brackets.

  • Why don't you use a proper sectioning command like \paragraph or something like this? Commented Sep 23, 2016 at 21:36
  • Do you want the problem number to be automatically generated?
    – GuM
    Commented Sep 23, 2016 at 21:41

1 Answer 1


You need to use the following format:


Note that I haven't captured the argument, since \textbf will do this when used as the replacement of \HW. Of course, you can capture and pass the argument if needed via


The only different between these two definitions would be if you had category code changes within the argument.

  • You can add \noindent in the definition, if still needed.
    – Werner
    Commented Sep 23, 2016 at 21:42

You must log in to answer this question.

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