Last active
January 7, 2019 21:47
-
-
Save i3v/19f6f249e07a71135c487f71054865f8 to your computer and use it in GitHub Desktop.
subcaptionphantom side_by_side comparison (for rev3) https://tex.stackexchange.com/a/468902/143086
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% =============== defining the \subcaptionphantom =================================== | |
\makeatletter | |
% \begin{macro}{\subcaptionphantom} | |
% \cs{subcaptionphantom}\oarg{list-entry}\marg{caption} is a hidden | |
% non-printed subcaption. Designed for the case if "(a)", "(b)" are | |
% already embedded in the figure itself. | |
% Roughtly equivalent to \cs{phantomsubcaption} from the \Lpack{subcaption} package. | |
% | |
% \begin{macrocode} | |
\newcommand{\subcaptionphantom}{% | |
\bgroup | |
\let\label=\memsub@label | |
\ifdonemaincaption\else | |
\advance\csname c@\@captype\endcsname\@ne | |
\fi | |
\refstepcounter{sub\@captype}\@contkeep | |
\@ifnextchar [% | |
{\@memsubcapphantom{sub\@captype}}% | |
{\@memsubcapphantom{sub\@captype}[\@empty]}} | |
% \end{macrocode} | |
% \end{macro} | |
% \begin{macro}{\@memsubcapphantom} | |
% Quick-and-dirty analog of \Lpack{memoir} \cs{memsubcap}, adapted | |
% for use in \cs{subcaptionphantom}. | |
% \begin{macrocode} | |
\long\def\@memsubcapphantom#1[#2]#3{% | |
\@tempdima=\hsize | |
\vskip\subfloatcapskip | |
\ifx \@empty #2 | |
\@memsubcaptionphantom{#1}{#3}{#3}% | |
\else | |
\@memsubcaptionphantom{#1}{#2}{#3}% | |
\fi | |
\vskip\subfloatcapskip | |
\egroup} | |
% \end{macrocode} | |
% \end{macro} | |
% | |
% | |
% \begin{macro}{\@memsubcaptionphantom} | |
% Quick-and-dirty analog of \Lpack{memoir} \cs{memsubcaption}, adapted | |
% for use in \cs{memsubcapphantom}. | |
% \begin{macrocode} | |
\newcommand{\@memsubcaptionphantom}[3]{% | |
\ifx \relax#2\relax \else | |
\bgroup | |
\let\label\@gobble | |
\let\protect\string | |
\def\@memsubcaplabel{\@nameuse{@@the#1}}% | |
\xdef\@memsubfigcaptionlist{% | |
\@memsubfigcaptionlist,% | |
{\protect\numberline{\@memsubcaplabel}\noexpand{\ignorespaces #2}}}% | |
\egroup | |
\fi | |
\@makesubfloatcaptionphantom{\@nameuse{@the#1}}{#3}% | |
} | |
% \end{macrocode} | |
% \end{macro} | |
% \begin{macro}{\@makesubfloatcaptionphantom} | |
% Quick-and-dirty analog of \Lpack{memoir} \cs{makesubfloatcaption}, adapted | |
% for use in \cs{memsubcaptionphantom}. | |
% \begin{macrocode} | |
\newcommand{\@makesubfloatcaptionphantom}[2]{% | |
\setbox\@tempboxa\hbox{% | |
\@subcapsize | |
{\phantom{\@subcaplabelfont#1}}{\ignorespaces #2}\unskip}% | |
\@tempdimb=-\subfloatcapmargin | |
\multiply\@tempdimb\tw@ | |
\advance\@tempdimb\@tempdima | |
\hb@xt@\@tempdima{% | |
\hss | |
\ifdim \wd\@tempboxa >\@tempdimb | |
\phantom{\memsubfig@caption{#1}}{#2}% | |
\else | |
\if@shortsubcap | |
\phantom{\memsubfig@caption{#1}}{#2}% | |
\else | |
\box\@tempboxa | |
\fi | |
\fi | |
\hss}} | |
% \end{macrocode} | |
% \end{macro} | |
\makeatother | |
% =================================================================================== |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment