5

I thank so much if anybody makes a enumerate list like this:

Problem 1. Text text text text .................... text text text text text text text text text text text text text text text text.

Problem 2. Text text text text .................... text text text text text text text text texttext text text text text text text .

Problem 3.

a) Text text text text .................... text text text text text text text text text text text text text text text text.

b) Text text text text .................... text text text text text text text text texttext text text text text text text .

Here are the codes:

\documentclass[12pt,a4paper]{article}
\usepackage{blindtext}
\begin{document}
\noindent I want to make a enumerate list like this:\\
\textbf{Problem 1.} \blindtext. \\
\textbf{Problem 2.}  \blindtext. \\
\textbf{Problem 3.} \\
a) \blindtext.\\
b) \blindtext.\\
\end{document}
3
  • 1
    See the enumitem package and its wide option
    – daleif
    May 21, 2016 at 13:43
  • To Daleif: I don't understand because I didn't see examples in that package document.
    – Exdata
    May 21, 2016 at 14:31
  • Please do not edit your question to include an answer. If you want to answer your own question, you may. This only makes sense if your answer is different from those already provided by others, of course.
    – cfr
    May 22, 2016 at 3:17

2 Answers 2

5

Here is a way with enumitem: I define a \problems (level 1+2) list environment and a questions environment, which is to be used semantically as problems, level 2(but technically, nothing prevents you to use it at the first level). Similarly, I defined two clones of \item, \pb and \qu.

\documentclass[12pt, a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}

\usepackage[showframe]{geometry}
\usepackage{blindtext}

\usepackage{enumitem}
\newlist{problems}{enumerate}{2}
\setlist[problems, 1]{label=Problem~\arabic*. , font=\bfseries,  wide=0pt}%
\setlist[problems, 2]{label=\emph{alph*}),  wide=0pt, before=\leavevmode, topsep=0pt}%
\newenvironment{questions}{\problems}{\endproblems}
\let\pb\item
\let\qu\item

\begin{document}

Text text text text text text text text text text text text text text text text text text text text text text text text text text text text.
\begin{problems}
  \pb \blindtext
  \pb \blindtext
  \item
  \begin{questions}
    \qu \blindtext
    \qu \blindtext
  \end{questions}
\end{problems}

\end{document}

enter image description here

2
  • Nice :) does cross referencing work out of the box?
    – cmhughes
    May 21, 2016 at 15:26
  • It seems it works fine for the first level only. I'll try to see what happens for ‘questions’.
    – Bernard
    May 21, 2016 at 15:43
3

As mentioned before, you can use the enumitem package.

Using the enumitem package, you may specify options to the \begin{enumerate} macro. In the newer versions, you may specify a wide option. In the old versions you must specify multiple options to reduce the margins. You may specify the label using the label option. The following is an example based on your question:

\documentclass[12pt,a4paper]{article}
\usepackage{blindtext}
\usepackage{enumitem}    
\begin{document}    

\begin{enumerate}[
    label={\bf Problem \arabic*.}
    align=left, leftmargin=0pt, 
          labelindent=0pt,listparindent=0pt, labelwidth=8em, itemindent=!]

    \item \blindtext. 
    \item \blindtext. 

\end{enumerate}

\end{document}

The third item in your question may introduce other two problems: (1) How to create an empy item and (2) how to introduce an inner list without additional space.

Fisrt, if you need an item with a blank line, trying to include only \\ will result an error. According to LaTeX, there is no line to end. You can use ~\\ to include a blank space and then a new line.

Second, when you introduce an inner list, LaTeX may introduce additional space between the items. You can use \vspace{} with a negative value to reduce the space. \vspace{-\topsep} reduces the space by the length of the top separation. \vspace{-2\topsep} reduces the double.

\documentclass[12pt,a4paper]{article}
\usepackage{blindtext}
\usepackage{enumitem}

\begin{document}

\noindent I want to make a enumerate list like this:\\

\begin{enumerate}[
    label={\bf Problem \arabic*.},
    align=left, leftmargin=0pt, labelindent=0pt,listparindent=0pt, labelwidth=6em, itemindent=!]

    \item \blindtext 
    \item \blindtext 

    % a blank item
    \item ~\\

    % an inner list        
    \vspace{-2\topsep}
    \begin{enumerate}[
        label=\alph*),
        align=left, leftmargin=0pt, labelindent=0pt,listparindent=0pt, labelwidth=0pt, itemindent=!]

        \item \blindtext
        \item \blindtext            
    \end{enumerate}

\end{enumerate}    
\end{document}
6
  • Manually specifying the problem number should probably be avoided :)
    – cmhughes
    May 21, 2016 at 16:13
  • @cmhughes Yes. You are right. I did the change in the answer to configure the label.
    – Jaime
    May 21, 2016 at 17:03
  • @Jaime. Thank you. But how about "Problem 3." ? After this label name, there is a blank until line ends. At the beginning of the next line I need a level 2 as shown in my text.
    – Exdata
    May 21, 2016 at 23:23
  • @Exdata, I included an additional example for the "Problem 3".
    – Jaime
    May 22, 2016 at 1:05
  • @Jaime Thank you very much for your help. Your answer is good. Can you tell me how you resolve this problem ? Examine this enumerate package ? For me this documentation is hard to understand.
    – Exdata
    May 22, 2016 at 3:10

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.