I am trying to define a new environment for photographic plates in a tufte-book.cls book. The environment should:
- Work just as the existing figure / table environments do for non-starred uses, and
- Place the caption inside the main body region, below the graphic, for starred (full width) uses.
Each page will have a single image. Portrait images are dealt with by the non-starred environment. Landscape images are dealt with by the starred.
I have (1) working by defining a 'plate' environment with its own counter etc. following Caption placement for new float in tufte-book class. See the MWE below. However, I am stuck on (2).
change caption in tufte class full-page figure comes close – but you lose the short caption / list of figures / hyperef functionality. I think I need to redefine the \@caption command for starred use – following something like How do I change the label separator for marginfigure in Tufte Book/Handout? or How can I have figure labels without captions in tufte-book?
One messy solution could be to use \newgeometry{} on each page a plate* appears and define the marginpar to equal (or almost equal) the page width.
This is needed for landscape floats (starred) with long captions as they disappear off the bottom of the page in the standard tufte-book implementation. This is not a problem with non-starred use as you have the marginpar to use. :
My MWE is:
\documentclass[a4paper,justified,twoside,openright]{tufte-book}
\geometry{landscape,top=1in,bottom=0.75in,textheight=7in,textwidth=6in,marginparsep=0.5in,marginparwidth=3in}
\usepackage{tikz}
%% Plate environment %%%%%%%%%%%%%%% from https://tex.stackexchange.com/questions/113631/caption-placement-for-new-float-in-tufte-book-class
\newcounter{plate}
\newcommand\platename{Plate}
\newcommand\listplatename{List of Plates}
\makeatletter
\newcommand\listofplates{%
\ifthenelse{\equal{\@tufte@class}{book}}%
{\chapter*{\listplatename}}%
{\section*{\listplatename}}%
% \begin{fullwidth}%
\@starttoc{lop}%
% \end{fullwidth}%
}
\renewcommand\theplate
% {\ifnum \c@chapter>\z@ \thechapter.\fi \@arabic\c@plate}
{\@arabic\c@plate} % alter numbering to be continuous
\def\fps@plate{tbp}
\def\ftype@plate{1}
\def\ext@plate{lop}
\def\fnum@plate{\platename\nobreakspace\theplate}
\newenvironment{plate}[1][htbp]
{\begin{@tufte@float}[#1]{plate}{}}
{\end{@tufte@float}}
\newenvironment{plate*}[1][htbp]%
{\begin{@tufte@float}[#1]{plate}{star}}
{\end{@tufte@float}}
\newcommand{\@tufte@lop@line}[2]{%
% #1 is the figure/table number and its caption text
% #2 is the page number on which the figure/table appears
\leftskip 0.0em
\rightskip 0em
\parfillskip 0em plus 1fil
\parindent 0.0em
\@afterindenttrue
\interlinepenalty\@M
\leavevmode
\@tempdima 2.0em
\advance\leftskip\@tempdima
\null\nobreak\hskip -\leftskip
{#1}\nobreak\qquad\nobreak#2%
\par%
}
\let\l@plate\l@figure
\makeatother
%% End plate environment %%%%%%%%%%%
\begin{document}
\listofplates
\chapter{Plate Environment}
\begin{plate}
\tikz{\path[draw=red,fill=blue] (0,0) rectangle (\textwidth-1cm,\textheight-1cm);}
\caption{Non-starred}
\label{plate:1}
\end{plate}
\begin{plate}
\tikz{\path[draw=red,fill=blue] (0,0) rectangle (\textwidth-1cm,\textheight-1cm);}
\caption[Non-starred - long caption.]{Non-starred - long caption. Lorem ipsum, lorem ipsum,Lorem ipsum, lorem ipsum,Lorem ipsum. Lorem ipsum, lorem ipsum,Lorem ipsum, lorem ipsum,Lorem ipsum. Lorem ipsum, lorem ipsum,Lorem ipsum, lorem ipsum,Lorem ipsum. Lorem ipsum, lorem ipsum,Lorem ipsum, lorem ipsum,Lorem ipsum. Lorem ipsum, lorem ipsum,Lorem ipsum, lorem ipsum,Lorem ipsum.}
\label{plate:2}
\end{plate}
\begin{plate*}
\tikz{\path[draw=red,fill=blue] (0,0) rectangle (\textwidth-1cm,\textheight-1cm);}
\caption{Starred}
\label{plate:3}
\end{plate*}
\begin{plate*}
\tikz{\path[draw=red,fill=blue] (0,0) rectangle (\textwidth-1cm,\textheight-1cm);}
\caption[Starred - long caption.]{Starred - long caption. Lorem ipsum, lorem ipsum,Lorem ipsum, lorem ipsum,Lorem ipsum. Lorem ipsum, lorem ipsum,Lorem ipsum, lorem ipsum,Lorem ipsum. Lorem ipsum, lorem ipsum,Lorem ipsum, lorem ipsum,Lorem ipsum. Lorem ipsum, lorem ipsum,Lorem ipsum, lorem ipsum,Lorem ipsum. Lorem ipsum, lorem ipsum,Lorem ipsum, lorem ipsum,Lorem ipsum.}
\label{plate:4}
\end{plate*}
\end{document}
Best Answer
Here's an approach I've used to get something working. Not the neatest...
I copied the @tufte@float environment definition and the \@tufte@float@fullwidth command definition into my preamble, renaming them as @TC@float and \@TC@float@fullwidth, respectively.
I altered my plate* environment definition to use @TC@float instead of the standard tufte-class figure* environment.
This allows me to alter the width of the caption text box (altering the line \begin{minipage}[\floatalignment]{2\marginparwidth}\hbox{} makes it twice the normal width) and the location by forcing \@TC@float@fullwidth to only use the option I want (commenting out the unwanted options, effectively).
As my \textwidth = 2\marginparwidth, and an option in \@TC@float@fullwidth allows the position to be bottom left, I can have a long caption appear below my figure and in the same space as the body text would normally fill.
MWE: