8

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.

2
  • 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
    Commented May 15, 2015 at 10:02
  • I think, you should exsheets etc. which are defined for such applications
    – user31729
    Commented May 15, 2015 at 10:12

1 Answer 1

10

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

2
  • Works also for scrartcl. :)
    – Keba
    Commented Jun 25, 2015 at 14:08
  • I want to have my sections with "exercise", but how do I avoid getting "Exercise" when making a section which is not supposed to have it?
    – Vara V
    Commented Nov 9, 2020 at 11:31

You must log in to answer this question.

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