Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm using the tufte-latex layout, and running into problems with the double-sided mode. I found a proposed bug-fix here and applied it to the most recent version of tufte-latex available on github

% Define Tuftian float styles (with the caption in the margin)
% original \floatc@tufteplain command
%    \newcommand{\floatc@tufteplain}[2]{%
%      \begin{lrbox}{\@tufte@caption@box}%
%        \begin{minipage}[\floatalignment]{\marginparwidth}\hbox{}%
%          \@tufte@caption@font{\@fs@cfont #1:} #2\par%
%        \end{minipage}%
%      \end{lrbox}%
%      \smash{\hspace{\@tufte@caption@fill}\usebox{\@tufte@caption@box}}%
%    }

    % bugfix? - http://code.google.com/p/tufte-latex/issues/detail?id=50
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \newcommand{\floatc@tufteplain}[2]{%
      \begin{lrbox}{\@tufte@caption@box}%
        \begin{minipage}[\floatalignment]{\marginparwidth}\hbox{}%
          \@tufte@caption@font{\@fs@cfont #1:} #2\par%
        \end{minipage}%
      \end{lrbox}%
       \@tufte@checkoddpage%
    \ifthenelse{\boolean{@tufte@odd@page}}%
      {\gsetboolean{@tufte@float@recto}{true}\@tufte@float@debug{Detected page: [recto/odd]}}%
      {\gsetboolean{@tufte@float@recto}{false}\@tufte@float@debug{Detected page: [verso/even]}}%
  \ifthenelse{\NOT\boolean{@tufte@symmetric}\OR\boolean{@tufte@float@recto}}{%
    % asymmetric or page is odd, so caption is on the right
   \smash{\hspace{\@tufte@caption@fill}\usebox{\@tufte@caption@box}}%
    \@tufte@float@debug{Caption position: [right]}%
  }{% symmetric pages and page is even, so caption is on the left
\smash{\hspace{-\@tufte@overhang}\usebox{\@tufte@caption@box}}%
    \@tufte@float@debug{Caption position: [left]}%
  }%
    }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    \newcommand{\fs@tufteplain}{%
      \def\@fs@cfont{\@tufte@caption@font}%
      \let\@fs@capt\floatc@tufteplain%
      \def\@fs@pre{}%
      \def\@fs@post{}%
      \def\@fs@mid{}%
      \let\@fs@iftopcapt\iftrue%
    }
    \let\fs@tufteplaintop=\fs@tufteplain
    \let\floatc@tufteplaintop=\floatc@tufteplain
    \newcommand\floatc@tufteruled[2]{%
      {\@fs@cfont #1} #2\par%
    }
    \newcommand\fs@tufteruled{%
      \def\@fs@cfont{\@tufte@caption@font}%
      \let\@fs@capt\floatc@tufteplain%
      \def\@fs@pre{\hrule height.8pt depth0pt width\textwidth \kern2pt}%
      \def\@fs@post{\kern2pt\hrule width\textwidth\relax}%
      \def\@fs@mid{}%
      \let\@fs@iftopcapt\iftrue%
    }
    \newcommand\fs@tufteboxed{%
      \def\@fs@cfont{}%
      \let\@fs@capt\floatc@tufteplain%
      \def\@fs@pre{%
        \setbox\@currbox\vbox{\hbadness10000
        \moveleft3.4pt\vbox{\advance\hsize by6.8pt
          \hrule \hbox to\hsize{\vrule\kern3pt
            \vbox{\kern3pt\box\@currbox\kern3pt}\kern3pt\vrule}\hrule}}
      }%
      \def\@fs@mid{\kern2pt}%
      \def\@fs@post{}%
      \let\@fs@iftopcapt\iftrue%
    }
  }{%
    % Nothing to do
  }
}

I commented out what I thought was the relevant section, and pasted in the code that I found. However, I'm not sure if I have commented out all of the relevant parts as my problem still exists. For example, here you can see the caption on the wrong side of the margin:

enter image description here

I've noticed that the problem only occurs with tables or figures that are positioned at the top of the page. Captions elsewhere in the page are fine. I have also found that running \clearpage does result in the offending caption and figure or table to move to the correct side of the page, but this is not my preferred way of solving the problem for something book length!

share|improve this question

1 Answer 1

up vote 3 down vote accepted

You might try the \forceversofloat macro inside your figure environment. It will bypass Tufte-LaTeX's autodetection and force the caption to appear to the left of the figure. There's also a \forcerectofloat macro that does the opposite. More information about the use of these macros may be found on pages 25–26 of the Tufte-LaTeX sample book.

share|improve this answer
    
Thanks @godbyk - I missed that advice in the sample book. It's unfortunate that it won't do it automatically but it's very useful to know how to fix it and a lot better than \clearpage. –  celenius Dec 9 '11 at 20:55
1  
@celenius: Normally it does do it automatically. However, at the top of the page it can sometimes get confused due to LaTeX's asynchronous page-breaking. When the figure was created, it was on the previous page. LaTeX then decided at the last minute to move it to the next page (after the figure had been typeset). Oftentimes, rerunning latex, pdflatex, or xelatex, will correct this but not always. As a last resort, using \forceversofloat and \forcerectofloat will tell Tufte-LaTeX to assume the figure is on the left- or right-hand page, respectively. –  godbyk Dec 10 '11 at 2:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.