0

I am trying to style the enumerate environment from the enumitem package... I want basically that the enumeration is not too to the left, for example I don't want something like this:

enter image description here

I would like to be able also to increase the size of the items (the font size) and maybe insert a line break after Exercise 1.

Is that possible to do? Or are there any other easy alternatives?

Thanks for any help :)

  • It is possible, but isn't it semantically better to use a theorem-like structure? – Bernard May 19 '15 at 23:13
  • @Bernard Actually, it's not the theorem, it's an exercise where I mention the Taylor series... I just wanted a easy way to have an enumeration with words and that I can style, so that I do not have to always write by my own \section*{...}, etc, with an enumeration or something simliar... – nbro May 19 '15 at 23:43
  • If you declare something like \newtheorem{Ex}{Exercise}you don't have to make the enumeration by yourself… – Bernard May 20 '15 at 0:03
1

Here are two possibilities with enumitem: I define two enumerate-like lists, exerciceseand `otherexs$, with different formattings. For the environment with a linebreak after the label, you can have some control on the vertical spacing between the label and the item, patching the \item command:

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{xcolor}
\setlength{\parindent}{0cm}
\usepackage{etoolbox}
\usepackage[shortlabels]{enumitem}
\newlist{exercises}{enumerate}{1}
\setlist[exercises]{label =Exercise \arabic*, wide = 0pt, labelwidth = \linewidth, format = \apptocmd{\item}{\leavevmode\vskip\dimexpr-\baselineskip \relax}{}{}\bfseries}
\newlist{otherexs}{enumerate}{1}
\setlist[otherexs]{label =Exercise \arabic*. , wide = 0pt, font =\color{red}\Large\scshape}
\usepackage{etoolbox}
\AtBeginEnvironment{exercises}{\apptocmd{\item}{\leavevmode\vskip\dimexpr-\baselineskip \relax}{}{}} \usepackage{lipsum}

\begin{document}

\lipsum[2]
\begin{exercises}
\item Prove Fermat’s small theorem.
\item Prove Fermat’s last theorem.
\end{exercises}

\begin{otherexs}
  \item Prove Fermat’s small theorem.
  \item Prove Fermat’s last theorem.
\end{otherexs}
\end{document} 

enter image description here

  • Is there a way to increase the font size? – nbro May 20 '15 at 2:54
  • If you mean increasing the label font size, yes. See my updated answer. – Bernard May 20 '15 at 8:54

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.