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

  • 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 6:06
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

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}
  • 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 7:52
  • 1
    @Panha, enumitem is very flexible package, so this can be adjusted. See upgrade of my answer. – Zarko Feb 25 '16 at 8:13

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.