tl;dr: Like footnotes, but on the side (easy part). These notes must be on the same page as their reference points, so the "main text" needs to break whenever the notes break.

I'm trying to produce something like this:

sample scan

I've been using memoir. Here's an idea I had. My understanding is that \footnote creates a float that tries to place itself at the bottom of the nearest page. Would it be possible to place the "footnote anchor" elsewhere? For example, with some interesting page geometry, something like this:

handwritten idea

The difficult part is in the question title: ensuring that page breaks respect the column-column alignment.

Here is a MWE.


% geometry stuff here

Blind Text

Lorem ipsum dolor sit amet. \columnnote{This is the first ``footnote.''}

The quick brown fox jumped over the lazy dog. \columnnote{This is the second ``footnote.''}
  • Possible relevant: tex.stackexchange.com/q/69517/34721 – Simon Kuang Aug 4 '15 at 21:04
  • 1
    I'm also thinking about paracol, but that still leaves the page breaks to be dealt with. – Simon Kuang Aug 4 '15 at 21:59
  • BTW, do you want these numbers to reset every page? – John Kormylo Aug 5 '15 at 17:38
  • @JohnKormylo, no. They are reset by chapter. – Simon Kuang Aug 5 '15 at 17:56
  • 2
    Your handwriting is worthy of a font! Not because it is perfect, but because it is distinctive. – Steven B. Segletes Aug 7 '15 at 13:34

This will write notes from top to bottom using the entire right column. Page breaking is done using the aux file and \everypar.

Needless to say, this approach will conflict with any package which uses \everypar (within the paracol environment).


\newcommand{\darkmark}[1]% #1 = text to write white on black background

% global registers

\newcounter{abortparagraph}% incremet for every aborted paragraph
\globalcounter{columnnote}% synchronized across columns
\newlength{\columnheight}% space used for column notes
\newlength{\columnroom}% available space for column notes
\newif\ifparagraphaborted% ignore extra everypar after abort
\newcommand{\leftcolumnpage}{}% reserve global names
\newcommand{\rightcolumnpage}{}% for page synchronization

% move current paragraph to next page

\newcommand{\newabortparagraph}[1]% #1 = \theparagraph, #2 = \thepage
 \global\expandafter\def\csname abortparagraph\arabic{abortparagraph}\endcsname{#1}}

\newcommand{\abortparagraph}% \everypar
{\ifparagraphaborted% ignore extra everypar after abort
  \bgroup% in case \tempa and \tempb previously used
    {\edef\tempa{\csname abortparagraph\arabic{abortparagraph}\endcsname}%
     \ifx\tempa\tempb% compare strings

% synchronize pages

\newcommand{\columnnotepage}[2]% #1 = label, #2 = \thepage
{\global\expandafter\def\csname columnnotepage#1\endcsname{#2}}

% redefine paracol environment start



% write notes in right column

\newcommand{\columnnote}[1]% #1 = text for second column
   {\def\leftcolumnpage{\csname columnnotepage\thechapter.\thecolumnnote\endcsname}}%
 \ifnum\rightcolumnpage<\leftcolumnpage\relax% synchronize pages
     \loop\ifnum\c@page<\leftcolumnpage \strut\newpage\repeat
 \bgroup% compute size of note
   \setbox0=\hbox{\begin{minipage}{\dimexpr \columnwidth-\bibindent}#1\end{minipage}}%
   \global\advance\columnheight by \dimexpr \baselineskip + \ht0 + \dp0\relax
 \ifdim\columnheight>\columnroom\relax% time to break page
   \immediate\write\@auxout{\string\newabortparagraph {\theparagraph}}%
   \bgroup% re-compute size of note
     \setbox0=\hbox{\begin{minipage}{\dimexpr \columnwidth-\bibindent}#1\end{minipage}}%
     \global\columnheight=\dimexpr \baselineskip + \ht0 + \dp0\relax
   \immediate\write\@auxout{\string\columnnotepage {\thechapter.\thecolumnnote}{\thepage}}%
   \begin{minipage}{\dimexpr \columnwidth-\bibindent}%
 \global\advance\columnheight by \marginparpush%

\setcounter{abortparagraph}{1}% reuse counter after aux file read
Blind text.

Lorem ipsum dolor sit amet. \columnnote{This is the first ``footnote.''}

The quick brown fox jumped over the lazy dog. \columnnote{This is the second ``footnote.''}

Too big for the page.  \columnnote{\rule{1pt}{.9\textheight}}

Next paragraph.

test page 1

It should be noted that \switchcolumn doesn't synchronize the pages either. That had to be done separately. Note that \thepage is not reliable when paragraphs are split over two pages, so are saved to the aux file instead. Also, one must be careful to NOT synchronize the aborted paragraphs as they NEED to fail the test every time.

| improve this answer | |
  • I already have the number layout done with TikZ. The real hard part is still the vertical alignment, since marginpar is a long way off from the intended alignment. MWE coming. – Simon Kuang Aug 5 '15 at 15:52
  • Have you looked at the sidenote package, together with marginfix ? Appart from the shape of numbers (which you can probably redefine), I think it looks like what you are searching for. – mvienney Aug 5 '15 at 16:45
  • @mvienney memoir's sidebar looks hopeful. – Simon Kuang Aug 5 '15 at 18:24
  • By the way, OP stands for Original Post, I think. – Simon Kuang Aug 5 '15 at 20:39
  • 1
    I just replaced the entire answer, so old comments are now out of context. – John Kormylo Aug 5 '15 at 22:31

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.