I'm wanting to place images with captions in my margins. I've been doing this using the caption package and the captionof command, as in the following:
\documentclass{article}
\usepackage{caption}
% if we want to remove the caption package:
\providecommand{\captionsetup}[1]{}
\providecommand{\captionof}[2]{\caption{#2}}
\begin{document}
% orphans
\captionof{figure}{An orphan captionof is ok}
\captionsetup{type=figure}
\caption{An orphan figure: Error: outside of float}
% marginpars
\marginpar{
\captionof{figure}{marginpar with captionof: Error: figure isn't allowed in note}
}
\marginpar{
\captionsetup{type=figure}
\caption{marginpar with caption: Error: outside of float}
}
% parbox
\parbox{\textwidth}{
\captionof{figure}{parbox with captionof is ok}
}
\parbox{\textwidth}{
\captionsetup{type=figure}
\caption{parbox with caption: Error: outside of float}
}
% figure
\begin{figure}[t]
\caption{figure with caption ok}
\end{figure}
\end{document}
Unfortunately, this approach is not translating over to LaTeXML correctly. Each of the uses of caption outside of the float is accompanied by an error (three "unexpected captions" and one "malformed ltx:figure". If I remove the caption package (and ignore the commands it defines), then LaTeX also complains about these four, saying "caption outside float" (and the other two that needed the package as well, of course).
It seems that we try to make this approach possible. In caption.sty.ltxml, the captionof macro has the comment:
# This is a horrible thing that fakes a caption anywhere.
# It isn't necessarily IN a figure or any float, so we'll wrap it in an otherwise empty one!
This seems to work out ok in two of the cases (the orphan and the parbox), but not in the marginpar. And captionsetup doesn't seem to work in any of the three cases. Is there a way I can get captions in my margins?
I'm wanting to place images with captions in my margins. I've been doing this using the caption package and the captionof command, as in the following:
Unfortunately, this approach is not translating over to LaTeXML correctly. Each of the uses of caption outside of the float is accompanied by an error (three "unexpected captions" and one "malformed ltx:figure". If I remove the caption package (and ignore the commands it defines), then LaTeX also complains about these four, saying "caption outside float" (and the other two that needed the package as well, of course).
It seems that we try to make this approach possible. In caption.sty.ltxml, the captionof macro has the comment:
This seems to work out ok in two of the cases (the orphan and the parbox), but not in the marginpar. And captionsetup doesn't seem to work in any of the three cases. Is there a way I can get captions in my margins?