5

I want to write a book of close to 300 mathematics exercises. I want to list them in numerical order (and put solutions at the end part of the book).

I think I am gonna use enuitem, however,in normal enuitem, the margin of H of How is equal to that of H of Hi. How can I make the margin of the H of How equal to that of the box of number 1?

enter image description here

Panha
  • 587
  • Please clarify the likely structure of the material that is to be enumerated. E.g., is there always a header line (e.g., "Hi there!") followed by a paragraph break and material that shouldn't be indented? Or does the material consist of a single paragraph that shouldn't be left-indented after the first line (or maybe the first two lines). And, does the remaining, non-indented material of each "item" always consist of a single paragraph, or could it consist of two or more paragraphs? – Mico Feb 25 '16 at 06:06

2 Answers2

7

Try

\documentclass{article}
\usepackage{enumitem}

\begin{document}
\begin{enumerate}[label*=\protect\fbox{\arabic{enumi}}]
\item   How are you?
\item   Thank you! I'm fine.
\end{enumerate}
\end{document}

enter image description here

Addendum: According to your comment, see if this is what you looking for:

enter image description here

\documentclass{article}
\usepackage{enumitem}
\usepackage{lipsum}

\begin{document}
\begin{enumerate}[leftmargin=0pt,
                  labelindent=1.5em,
                  label*=\protect\fbox{\arabic{enumi}},labelwidth=*]
    \item   \lipsum[2]

    \lipsum[2]
\end{enumerate}
\end{document}
Peter Grill
  • 223,288
Zarko
  • 296,517
  • Thanks. But One more thing is I want to make a new line margin equal to the box. I have tried your example but the new line is at the H of How as normal Enuitem. – Panha Feb 25 '16 at 07:52
  • 1
    @Panha, enumitem is very flexible package, so this can be adjusted. See upgrade of my answer. – Zarko Feb 25 '16 at 08:13
1

Another solution :

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[frenchb]{babel}
\usepackage{enumitem}
\usepackage{xcolor}

\newcommand\twodigits[1]{%
  \ifnum#1<10 0\number#1 \else #1\fi
}

\begin{document}

\begin{enumerate}[label=\fcolorbox{black}{black!15}{\scriptsize H-\protect\twodigits{\arabic*} :}, leftmargin=1.5cm,itemsep=1pt,labelsep=1cm]
  \item Coucou\\
    test
\item Coucou\\
  \hspace*{-1cm}test1
\item Coucou
\item Coucou
\item Coucou
\item Coucou
\item Coucou
\item Coucou
\item Coucou
\item Coucou
\item Coucou
\item Coucou
\end{enumerate}
\end{document}

enter image description here

flav
  • 4,714