3

As seen below, I am trying to create a simple boxed enumerate list with the items in the margin.

enter image description here

I have two problems with the code below

  • Main problem: the enumerate list is slightly off-center, is there some simple fix for this?

  • Minor problem: Can I use the \item[123] without having to use \fbox every time?

.

\documentclass{article}

\usepackage{enumitem}
\usepackage{lipsum}

    \newlist{problem}{enumerate}{1}
    \setlist[problem, 1]{
      leftmargin=*,
      labelindent=-\labelwidth,
      label=\protect\fbox{\arabic*},
      resume=problem%
    }

\begin{document}

\section{Lorem}

\lipsum[75]

\begin{problem}
    \item \lipsum[66]
\end{problem}

\begin{problem}
    \item[\fbox{123}] \lipsum[5]
\end{problem}

\lipsum[66]

\end{document}
4

Use leftmargin=0pt. The showframe is for checking of alignment only.

\documentclass{article}

\usepackage[showframe]{geometry}
\usepackage{enumitem}
\usepackage{lipsum}

\newlist{problem}{enumerate}{1}
\setlist[problem, 1]{
  leftmargin=0pt,
  label={\fbox{{\arabic*}}},
  labelindent=-\labelwidth,
  resume=problem%
}

\begin{document}

\section{Lorem}

\lipsum[75]

\begin{problem}
    \item \lipsum[66]
\end{problem}

\begin{problem}[start=123]
\item \lipsum[5]
\end{problem}


\lipsum[66]

\end{document}

enter image description here

| improve this answer | |

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.