4

I am handing in an assignment that is structured by exercises, rather than sections. I have already written my responses using the \section{} command and would now like to structure the final output by exercises rather than sections. Concretely, I want the number to appear to the right of each exercise: Exercise 4 instead of 4 Section title.

I have been able to find information on how to do this for chapters and many other document parts here on SE, but strangely not for sections.

Here's an MWE:

\documentclass{article}
\begin{document}

\section{Exercise} % First exercise

\section{Exercise} % Second exercise

\section{Exercise} % Third exercise

\end{document}

Produces this:

MWE

Now all I really need to do is reverse the order from # Section title to Section title # because my section title is exercise. Also, ideally, the section numbering would be in roman numerals, while subsections remain as originally formatted.

  • This depends heavily on the underlying document class (and some packages)... Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user31729 May 15 '15 at 10:02
  • I think, you should exsheets etc. which are defined for such applications – user31729 May 15 '15 at 10:12
4

With article class as you specified in the MWE, one can employ titlesec.

\documentclass{article}
\renewcommand{\thesection}{\Roman{section}}
\usepackage{titlesec}
\titleformat{\section}
{\normalfont\Large\bfseries}{Exercise~\thesection}{1em}{}

\begin{document}

\section{Exercise} % First exercise

\section{Exercise} % Second exercise

\section{Exercise} % Third exercise

\end{document}

enter image description here

  • Works also for scrartcl. :) – Keba Jun 25 '15 at 14:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.