# Vertical spacing between sidenotes (and, between sidenotes and captions) in tufte-book

Within from LyX, using various sidenotes in a tufte-latex-book environment, along with float figures, results sometimes in an overlapping of sidenotes and caption(s).

For example, two sidenotes followed by a figure caption (may) look like in the following screenshot:

As requested in the comments, a minimal working example:

My guess is that this issue is rather generic and not LyX-specific. How can one adjust the vertical spacing between sidenotes, as well as between sidenotes and figure captions?

% Preview source code

%% LyX 2.0.3 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\RequirePackage{fix-cm}
\documentclass[11pt,twoside,english,nohyper,notitlepage]{tufte-book}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\setlength{\parskip}{\bigskipamount}
\setlength{\parindent}{0pt}
\usepackage{color}
\usepackage{babel}
\usepackage{fixltx2e}
\usepackage{graphicx}
\usepackage{setspace}
\onehalfspacing
\usepackage[unicode=true,
bookmarks=true,bookmarksnumbered=true,bookmarksopen=false,
breaklinks=false,pdfborder={0 0 0},backref=false,colorlinks=true]
{hyperref}
\hypersetup{
pdfauthor={Nikos Alexandris}}

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.

\title{Some title}
\author{by Nikos Alexandris}
\pdfpageheight\paperheight
\pdfpagewidth\paperwidth

%% A simple dot to overcome graphicx limitations
\newcommand{\lyxdot}{.}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
% inline item enumeration
\usepackage{paralist}

\makeatother

\begin{document}
\maketitle

\subsection{Trim fringes\label{sub:Trim fringes}, in case they exist}

The Level 1 product generation system (LPGS\sidenote{Differences between the two main Landsat production systems are summarised
in USGS' webpage about \href{http://landsat.usgs.gov/products_IP_LPGSvsNLAPS.php}{LPGS and NLAPS Processing Systems Comparison}}) does not trim band offsets (fringes)\sidenote{Source: \href{http://landsathandbook.gsfc.nasa.gov/pdfs/Landsat7_Handbook.pdf}{Landsat 7 Science Data Users Handbook})}\sidenote{Detailed information upon this can be researched at \href{http://landsat.usgs.gov/tools_project_documents.php}{Landsat Missions, Project Documentation}}
\begin{figure}
\includegraphics[width=1\columnwidth,height=8cm,keepaspectratio]{/geo/grassdb/exported/arcfuel/LT51840322011266MOR00_B7_no_Nulls\lyxdot png}

\caption{Fringes are visible in the borders of an Landsat acquisition due to }
\end{figure}

\end{document}


This results in a very similar overlapping effect, as the screenshot given above which was taken after compiling a large document.

Update (13. 01. 2013)

For completeness, exporting the LyX file as LaTeX (pdflatex) and compiling it -- without any modifications -- from within Kile, results, again, in the same overlapping effect.

%% LyX 2.0.3 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\RequirePackage{fix-cm}
\documentclass[11pt,twoside,english,nohyper,notitlepage]{tufte-book}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\setlength{\parskip}{\bigskipamount}
\setlength{\parindent}{0pt}
\usepackage{color}
\usepackage{babel}
\usepackage{fixltx2e}
\usepackage{graphicx}
\usepackage{setspace}
\onehalfspacing
\usepackage[unicode=true,
bookmarks=true,bookmarksnumbered=true,bookmarksopen=false,
breaklinks=false,pdfborder={0 0 0},backref=false,colorlinks=true]
{hyperref}
\hypersetup{
pdfauthor={Nikos Alexandris}}

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.

\title{Some title}
\author{by Nikos Alexandris}
\pdfpageheight\paperheight
\pdfpagewidth\paperwidth

%% A simple dot to overcome graphicx limitations
\newcommand{\lyxdot}{.}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
% inline item enumeration
\usepackage{paralist}

% The default minimum amount of space between \marginnotes is 10 pt.
\setlength\marginparpush{20pt}

\makeatother

\begin{document}
\maketitle

\subsection{Trim fringes\label{sub:Trim fringes}, in case they exist}

The Level 1 product generation system (LPGS\sidenote{Differences between the two main Landsat production systems are summarised
in USGS' webpage about \href{http://landsat.usgs.gov/products_IP_LPGSvsNLAPS.php}{LPGS and NLAPS Processing Systems Comparison}}) does not trim band offsets (fringes)\sidenote{Source: \href{http://landsathandbook.gsfc.nasa.gov/pdfs/Landsat7_Handbook.pdf}{Landsat 7 Science Data Users Handbook})}\sidenote{Detailed information upon this can be researched at \href{http://landsat.usgs.gov/tools_project_documents.php}{Landsat Missions, Project Documentation}}

\begin{figure}
\includegraphics[width=1\columnwidth,height=8cm,keepaspectratio]{/geo/grassdb/exported/arcfuel/LT51840322011266MOR00_B7_no_Nulls\lyxdot png}

\caption{Fringes are visible in the borders of an Landsat acquisition due to }
\end{figure}

\end{document}

-
Please provide a minimum working example. – Marc van Dongen Jan 4 '13 at 0:19
@MarcvanDongen Hope the added (preview)code fits. Thank you. – Nikos Alexandris Jan 5 '13 at 1:31
I don't have access to the graphic file that's includes with the \includegraphics command so I can't compile this. The \RequirePackage command before the \documentclass command is unusual. It may be OK but it seems odd to me because, for example, I cannot see how the \RequirePackage command can be aware of the main document class, which it would need if options had to be passed on to the main document class. Are you sure this is the right place for the \RequirePackage command? – Marc van Dongen Jan 5 '13 at 1:43
@MarcvanDongen a) I think adding any picture will have the same effect, b) The commands you mention is LyX' internal work, not mine. I'll try to check this on pure LaTeX, not very soon though. – Nikos Alexandris Jan 5 '13 at 1:45

## 1 Answer

I'm not sure if LyX exposes them, but the Tufte-LaTeX document classes provide a few options for adjusting the positions of captions and margin notes.

## Adjusting margin notes and sidenotes positions

First, if you want to adjust the minimum distance between all margin notes (and not just one or two), then you can set the \marginparpush length:

% The default minimum amount of space between \marginnotes is 10 pt.
\setlength\marginparpush{10pt}


Next, you can adjust the position of \marginnotes and \sidenotes using an optional parameter. To adjust the position of a \marginnote or \sidenote, use the following syntax:

\marginnote[<offset>]{Margin note text}
\sidenote[][<offset>]{Sidenote text}


where a positive <offset> length moves the note down and a negative length moves the note down. Some examples of valid lengths are:

1.0in    2.54cm    254mm    6\baselineskip


You can view more information about the \marginnote and \sidenote commands on pages 21–22 of the Tufte-LaTeX documentation (PDF).

## Adjusting caption positions

Captions can be positioned vertically in one of a four positions: either above or below the figure or top- or bottom-aligned with the figure.

The vertical alignment of the caption can be affected in two ways: (1) using the \setfloatalignment macro or (2) using the optional offset argument.

Unless the figure position specifier is only [b], the Tufte-LaTeX document classes assume the figure will be positioned at the top of the page, in the middle of the page, or on its own page. The caption will be top-aligned with text-width figures and placed below full-width figure*s.

If the figure position specifier is [b], then the caption will be bottom-aligned with text-width figures and placed above full-width figure*s.

You can change this position of the caption using the \setfloatalignment macro. Using \setfloatalignment{b} will bottom-align the caption and \setfloatalignment{t} will top-align the caption. This is convenient for moving a caption that would otherwise interfere with a sidenote or margin note and still keeps the caption neatly aligned with the top or bottom edge of the figure.

Another option for moving the caption is to use the optional offset argument similar to that of the \sidenote and \marginnote macros:

\caption[][<offset>]{Caption text}


The syntax of the \caption command (and a few examples) is provided on pp. 23–24 of the manual, and more information about the \setfloatalignment macro is available on pp. 25–26 of the manual.

-
\marginparpush indeed does something. Yet, it doesn't do away with the overlapping effect, i.e. the sidenotes gain more breathing room, however, the figure caption is still in the middle! I'll check the rest of your (very) clean and detailed answer as soon as possible. – Nikos Alexandris Jan 5 '13 at 1:47
@NikosAlexandris: You're correct in that \marginparpush won't help you much in this particular situation. I included it for completeness. Your best option is to either move the caption or offset the sidenote. (Alternatively, you could move the entire figure.) – godbyk Jan 5 '13 at 5:22
I guess using a specific offset for either the \caption or the \sidenote is a solution -- for example, in this specific example demonstrated in the Question above, and using the exported .tex file from within Kile, a caption offset of 1.3in fixes the problem. Wonder how one could pass this offset to LyX while using its native caption/sidenote environments... ? – Nikos Alexandris Jan 13 '13 at 15:33
I haven't used LyX in eons, but I seem to recall it had a way of entering TeX code directly (called “evil red text” or somesuch). Using that feature you could just type \sidenote[5\baselineskip]{This sidenote has been moved down five lines.}. LyX may not render it as nicely as it otherwise would, but you wouldn't have to switch to Kile or another editor. – godbyk Jan 13 '13 at 19:27
Yes, it is like that and I am aware/using it. I just want to avoid, unless it is unavoidable, using ERTs. – Nikos Alexandris Jan 13 '13 at 20:29