I am working to modify this Latex template from stackexchange to use for my homework. Namely, the template currently splits the title of a subsection from its numbering, like so:

enter image description here

And, as mentioned in the image, I would like it to act more like:

Part (a) I would prefer this formatting

The only file that seems to be involved in setting up the section headers is bachw.cls. Which defines them in this way:

% Set up counters for problems and subsections



\newcommand*{\problem}[1]{\stepcounter{ProblemNum} %
  \anyproblem{Problem \theProblemNum. \; #1}}
\newcommand*{\subproblem}{\stepcounter{SubProblemNum} %
  \soln{Part (\theSubProblemNum)}}

The code I used to generate the image above was:


\problem{This is in-line and good}
\subproblem{I would like this to be in line with the `Part (a)'}


I've tried modifying the \subproblem and \problem lines in bachw.cls a little, taking out the '[1]' or adding it, taking out the %s and seeing what that changes but I am very out of my element. Where can I tell \subproblem to hold the linebreak?

Thank you very much!

  • Welcome to TeX SX! You can try to use the titlesec package, and redefine \subsubsection as having the runin style.
    – Bernard
    Sep 10, 2021 at 13:46
  • OTOH, if you don't need a table of contents or headings, you could just use enumerate. Sep 10, 2021 at 13:50
  • Thanks @Bernard! I have added titlesec to the list of required packages but I am not sure what you mean by redefine \subsubsection has having the runin style. I tried adding [runin] to the end of \newcommand*{\subproblem}{\stepcounter{SubProblemNum} % \soln{Part (\theSubProblemNum)}} but that causes problems during compilation and I've tried adding it to \newcommand*{\soln}[1]{\subsubsection*{#1}[runin]} and \newcommand*{\soln}[1]{\subsubsection*{#1}}[runin] but no luck. Sep 10, 2021 at 14:40
  • You have to use the advanced interface: \titleformat{\subsubsection}[runin]{…} and enter formatting the parameters of your document class (font size, font shape, font weight, spacing between label and title, &c.)
    – Bernard
    Sep 10, 2021 at 14:57
  • You will probably want to consult the documentation for titlesec at ctan.org/pkg/titlesec?lang=en
    – Teepeemm
    Sep 10, 2021 at 15:28

1 Answer 1


Thanks to @Bernard and @Teepeemm for the help. I have solved it by adding:

% Title Modifications

To line 35 of bachw.cls.

You must log in to answer this question.

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