[Tex/LaTex] putting \textbf{} inside \newcommand


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.

Best Answer

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.

Related Question