3

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:

\newcommand{\HW{}}{\noindent\textbf{}}

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

2
  • 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

2

You need to use the following format:

\newcommand{\HW}{\textbf}

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

\newcommand{\HW}[1]{\textbf{#1}}

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

1
  • 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 .