I'm trying a lot of subfloat-like packages with tufte-latex and all of them seem to interact badly with tufte-latex in the matter of labels, refs and captions. To captions I could find solutions thanks to you guys, but refs are still elusive.
Originally no numbering was appearing in the figures, but now the numbers appear but can't be referenced by the labels.
The following minimal examples show what's wrong. Both results in undefined references for the tufte-handout
class and work perfectly with article
.
\documentclass{tufte-handout}
\usepackage[demo]{graphicx}
\usepackage[caption=false]{subfig}
\begin{document}
\begin{figure}
\centering
\subfloat[Subfigure 1] % caption for subfigure 1
{
\label{fig:sub1}
\includegraphics[scale=0.5]{subfig1.eps}
}
\subfloat[Subfigure 2] % caption for subfigure 2
{
\label{fig:sub2}
\includegraphics[scale=0.5]{subfig2.eps}
}
\caption{Results for subfigure}
\label{fig:results}
\end{figure}
In the text, you can refer to subfigures of figure \ref{fig:results} as \ref{fig:sub1}, \ref{fig:sub2}, \subref{fig:sub1}, \subref{fig:sub2}.
\end{document}
This one also works ok with captions but mess up references (gives undefined references with tufte-handout, but works ok with article).
\documentclass{tufte-handout}
\usepackage{caption}
\usepackage{subcaption}
\usepackage[demo]{graphicx}
\captionsetup{compatibility=false}
\begin{document}
\begin{figure}
\centering
\begin{subfigure}[b]{0.5\textwidth}
\includegraphics{subfig1.eps}
\caption{Subfigure 1}
\label{fig:sub1}
\end{subfigure}
~
\begin{subfigure}[b]{0.5\textwidth}
\includegraphics{subfig2.eps}
\caption{Subfigure 2}
\label{fig:sub2}
\end{subfigure}
\caption{Results for subfigure}
\label{fig:results}
\end{figure}
In the text, you can refer to subfigures of figure \ref{fig:results} as \ref{fig:sub1}, \ref{fig:sub2}, \subref{fig:sub1}, \subref{fig:sub2}.
\end{document}
Are there any other subfloat packages that would work with tufte-latex? Or maybe a way to make the above packages work.
tufte-common.def
suggests it is compatible with thesubfigure
package. However, thesubfigure
package is often considered to be obsolete. I believe a feature request to thetufte-latex
developers (=> compatibility with thesubcaption
package) seems reasonable...tufte
andcaption
would IMHO be a much better idea because AFAIK in the current situation neither the maintainer oftufte
nor me (the maintainer ofcaption
) is able to build a proper solution without relying on internals of the other class/package which could (of course) change in future versions...