1

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}
1

The class tufte-handout provides \justify for justified text:

\documentclass[english,nohyper]{tufte-handout}
\usepackage{enumitem}
\usepackage[english]{babel}
\usepackage{blindtext}

\begin{document}

\marginpar{%
  \noindent
  \begin{minipage}{53mm}
  \vspace{7mm}
  \underline{Here is the list:}
  \vspace{0.5mm}
  \footnotesize

  \justifying
  \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}

Result

Without the `minipage` and with no extra space between entries (`itemsep=-\parsep`):

\documentclass[english,nohyper]{tufte-handout}
\usepackage{enumitem}
\usepackage[english]{babel}
\usepackage{blindtext}

\begin{document}

\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]
  % \item \blindtext[1]
  \end{enumerate}
}
\end{document}

Second question: \marginpar are like float objects for LaTeX, which cannot be broken across pages.

Resume enumeration counter

Package enumitem already provides the option resume. 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 counter enumi is stored in a global counter marginresume and prepared for the next enumeration (\stepcounter). Then the next enumeration in \marginpar uses the option start to resume the enumeration:

\documentclass[english,nohyper]{tufte-handout}
\usepackage{enumitem}
\usepackage[english]{babel}
\usepackage{blindtext}

\newcounter{marginresume}

\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}%
  \setcounter{marginresume}{\value{enumi}}%
  \stepcounter{marginresume}%
}

\pagebreak

\marginpar{%
  \noindent
  \footnotesize

  \justifying
  \begin{enumerate}[
    label=\Alph*.,
    itemsep=-\parsep,
    leftmargin=*,
    start=\value{marginresume},
  ]
  \item \blindtext[1]
  \item \blindtext[1]
  \item \blindtext[1]
  \end{enumerate}
}
\end{document}
  • Thank you! That did seem to work for the first problem! I am now working on the second issue. First, do you know of a way I can accomplish this without \marginpar? If not, I have tried to just break the enumeration into two entirely separate chunks. Then, I only put three items in a chunk, as that best fits a page. This, however, causes two problems. First, the enumeration starts all over again for the second chunk (starts at A. instead of D.). Second, with other code in my real document, the second chunk sometimes doesn't go to the second page (but goes to third page). – user84756 Jun 25 '15 at 4:06
  • @StellaJ I have moved the question to the questions and at least answered the resume problem. – Heiko Oberdiek Jun 25 '15 at 7:44
  • @StellaJ Regarding the placement of the \marginpars, it becomes very fast very complex especially, when an automatic solution is wanted. Even a rewrite of the output routine may be required. Or the margin par area is set by different means than \marginpar, as background of the page, for example. Packages like atbegshi/everyshi and position recording via package zref-savepos or TikZ might help in this task. Or a third way could offer LuaLaTeX with its programming capabilities and access to TeX structures as boxes. – Heiko Oberdiek Jun 25 '15 at 7:53
  • Thanks for the feedback! You are right, it does seem to get very complicated very fast. I did look into the TikZ etc. (tex.stackexchange.com/questions/69517/…). I am still working on this complicated solution. But I wanted to ask: Do you know of a simpler way to accomplish this (text-justified enumeration in the margin that will page break?) I am guessing there is not a more simple solution, but wanted to verify that I do not necessarily need to specifically use \marginpar. Thanks again. – user84756 Jun 25 '15 at 16:14
0

The package scrlayer-notecolumn can break "note columns" over pages:

\documentclass{scrartcl}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{scrlayer-scrpage}

\usepackage{scrlayer-notecolumn}
\usepackage[marginparwidth=5cm,textwidth=10cm,left=2cm]{geometry}
\usepackage{lipsum,enumitem,blindtext}
\DeclareRobustCommand{\mytext}{
\begin{enumerate}[label=\Alph*.,itemsep=-1ex,leftmargin=*]
\item \blindtext[1]
\item \blindtext[1]
\item \blindtext[1]
\item \blindtext[1]
\end{enumerate}}

\begin{document}
\makenote{\mytext}
\lipsum[1-5]
\end{document}

The package is quite experimental and fragile (e.g. the \makenote command doesn't like many commands in its arguments).

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.