I am including an enumeration in the margin. I am able to get this to work, but noticed two problems. First, I am trying to justify the text. Currently, it is justified on the left, but not on the right. Second, I would like the margin enumeration to page-break at the appropriate location. Is it possible to accomplish this?
Below is my MWE (Notice that there should be a page break so that is spans 2 – and not 1 – pages. And notice that the right side of the text is not aligned):
\documentclass[12pt,english,nohyper]{tufte-handout}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{hyperref}
\usepackage{graphicx}
\usepackage[space]{grffile}
\usepackage{geometry}
\usepackage{pgffor}
\usepackage{caption}
\usepackage{calc}
\usepackage{enumitem}
\usepackage[english]{babel}
\usepackage{blindtext}
\makeatletter
\makeatother
\begin{document}
\SweaveOpts{concordance=TRUE}
\marginpar{
\noindent
\begin{minipage}{53mm}
\vspace{7mm}
\underline{Here is the list:}
\vspace{0.5mm}
\footnotesize
\begin{enumerate}[label=\Alph*.,itemsep=-1ex,leftmargin=*]
\item \blindtext[1]
\item \blindtext[1]
\item \blindtext[1]
\item \blindtext[1]
\end{enumerate}
\end{minipage}
}
\end{document}
I wanted to reiterate that I want to keep the left-alignment as it is currently. (The enumerations A. B. C. D. are all a bit further left than the rest of the text, which is neatly aligned). Thank you for any advice.
UPDATE: Heiko Oberdiek helped me with the justification. Thank you, it did work. Below is my updated code. However, there are now two small problems. First, the second set of enumerations begins all over again with A. (instead of D.) Is there a way to set it to a certain starting letter, beside A.? Second, although this MWE works, in that the second set of three enumerations occurs on the second page (immediately after the first set of three enumerations on the first page) due to the \pagebreak
, this does not happen in my real code (that has lots of information and plots in the non-margin area.) In my real document, the second set of enumerations sometimes occurs on the third page. Is there a way to force this second set of enumerations to occur on the second page?
Also, I am creating a software in which the information in the non-margin area will depend on something a user inputs, and so I cannot simply move the second enumeration around until it occurs on the second page for one case. Because it may not be so for another case. That is why I want to somehow force it to occur on the second page.
Thank you!
My updated code:
\documentclass[english,nohyper]{tufte-handout}
\usepackage{enumitem}
\usepackage[english]{babel}
\usepackage{blindtext}
\begin{document}
\SweaveOpts{concordance=TRUE}
\marginpar{%
\noindent
\vspace{7mm}
\underline{Here is the list:}
\vspace{0.5mm}
\footnotesize
\justifying
\begin{enumerate}[label=\Alph*.,itemsep=-\parsep,leftmargin=*]
\item \blindtext[1]
\item \blindtext[1]
\item \blindtext[1]
\end{enumerate}
}
\pagebreak
\marginpar{%
\noindent
\footnotesize
\justifying
\begin{enumerate}[label=\Alph*.,itemsep=-\parsep,leftmargin=*]
\item \blindtext[1]
\item \blindtext[1]
\item \blindtext[1]
\end{enumerate}
}
\end{document}
Best Answer
The class
tufte-handout
provides\justify
for justified text:Second question:
\marginpar
are like float objects for LaTeX, which cannot be broken across pages.Resume enumeration counter
Package
enumitem
already provides the optionresume
. However, the settings are stored locally and lost after\marginpar
. Thus the next example makes a small detour. After the end of the first enumeration, the current value of the top level enumeration counterenumi
is stored in a global countermarginresume
and prepared for the next enumeration (\stepcounter
). Then the next enumeration in\marginpar
uses the optionstart
to resume the enumeration: