📄 caption2.dtx.svn-base
字号:
\renewcommand\LT@makecaption[3]{% \LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\hsize{% \ifignoreLTcapwidth \else \setcaptionwidth\LTcapwidth \fi \captionlinewidth\hsize \realcaptionwidth\hsize \captionlabelfalse#1\captionlabeltrue \def\captionlabel{#2}% \def\captiontext{#3}% \usecaptionstyle{longtable}% \endgraf\vskip\baselineskip}% \hss}}}% \end{macrocode}% \end{macro}%% \begin{macrocode} \fi}% \end{macrocode}%% \subsubsection{Support of the \puresf{subfigure} package}%% Some of the following code will not work within \cs{if},% because of the (yet) undefined \cs{if}\textit{xxx}s. So we simply define% the critical code within the helper commands \cs{setsubcapstyle}% and \cs{caption@makesubcaption} already here.%% \begin{macro}{\setsubcapstyle}% This sets the subcaptionstyle to a appropriate value.%% If \cs{ifsubcapraggedright} is undefined (it was introduced% into v2.1 of the \textsf{subfigure} package) we define it first.% \begin{macrocode}\newcommand*\setsubcapstyle{% \@ifundefined{subcapraggedrightfalse}{% \newif\ifsubcapraggedright}{}% \ifsubcaphang \ifsubcapcenter \subcapstyle{hang+center}% \else\ifsubcapcenterlast \subcapstyle{hang+centerlast}% \else\ifsubcapraggedright \subcapstyle{hang+flushleft}% \else \subcapstyle{hang}% \fi\fi\fi \else\ifsubcapcenter \subcapstyle{center}% \else\ifsubcapcenterlast \subcapstyle{centerlast}% \else\ifsubcapraggedright \subcapstyle{flushleft}% \else \subcapstyle{normal}% \fi\fi\fi\fi}% \end{macrocode}% \end{macro}%% \begin{macro}{\caption@makesubcaption}% This will typeset the subcaption.% We just set all our \cs{caption}\textit{xxx} values to% the values of \cs{subcap}\textit{xxx} and typeset the% caption like \textsf{subfigure} within a \cs{hbox},% but with the help of \cs{usecaptionstyle}.%% But this is not as easy as it seems. We typeset the caption like this:% \begin{quote}% |\captionfont|\\% | {\capionlabelfont\captionlabel\captionlabeldelim}%|\\% |\captionlabelsep\captiontext|% \end{quote}% Within \textsf{subfigure} 2.0 the caption will be set quite similar to:% \begin{quote}% |\subcapsize|\\% | {\subcaplabelfont\captionlabel}%|\\% |\space\captiontext|% \end{quote}% But within \textsf{subfigure} 2.1 this has changed to:% \begin{quote}% |\subcapsize|\\% | {\subcaplabelfont\captionlabel}%|\\% |\hskip\subfiglabelskip|\\% | {\subcapfont\captiontext}}|% \end{quote}% So we have to be tricky here: We set \cs{captionlabelfont} to \cs{normalfont} plus% \cs{subcapsize} \& \cs{subcaplabelfont}, so the font setting in \cs{captionfont}% will not affect the caption label in subfigure captions.%% Note that \cs{hfil} has changed to \cs{hss} from subfigure 2.0 to 2.1,% so we use \cs{caption@subfig@hss} instead. (We will define this later on.)% \begin{macrocode}\newcommand\caption@makesubcaption[2]{% \renewcommand*\captionfont{\subcapsize\subcapfont}% \renewcommand*\captionlabelfont{\normalfont\subcapsize\subcaplabelfont}% \let\captionlabeldelim\subcaplabeldelim \let\captionlabelsep\subcaplabelsep \ifsubfigcapwidth\captionwidthtrue\else\captionwidthfalse\fi \setlength\captionmargin\subfigcapmargin \setlength\captionwidth\subfigcapwidth \captionindent\subcapindent \ifsubcapnooneline\onelinecaptionsfalse\else\onelinecaptionstrue\fi \hbox to\@tempdima{% \caption@subfig@hss\parbox[t]\@tempdima{% \captionlinewidth\@tempdima \realcaptionwidth\@tempdima \captionlabeltrue \def\captionlabel{#1}% \def\captiontext{\ignorespaces #2}% \usecaptionstyle\caption@substyle}% \caption@subfig@hss}}% \end{macrocode}% \end{macro}%% If the subfigure support is not needed, we throw% the helper macros in the garbage can.%% \begin{macrocode}\caption@package{subfigure}{@makesubfigurecaption}{% \let\setsubcapstyle\undefined \let\caption@makesubcaption\undefined}{% \ifx\@makesubfigurecaption\relax \PackageWarning{caption2}{% Option `subfigure' was set but there is no subfigure package loaded} \let\setsubcapstyle\undefined \let\caption@makesubcaption\undefined \else% \end{macrocode}%% Some stuff has changed from version 2.0 to 2.1 of the% \textsf{subfigure} package, so we make a branch here.% If \cs{subcapfont} is undefined we assume v2.0,% otherwise we assume v2.1 or newer.%% \begin{macrocode} \ifx\subcapfont\undefined \PackageInfo{caption2}{subfigure package v2.0 detected}% \end{macrocode}%% \begin{macro}{\subcapfont}% We define \cs{subcapfont} here so we can use it later% in common code for \textsf{subfigure} v2.0 and v2.1 (or newer).% \begin{macrocode} \let\subcapfont\@empty% \end{macrocode}% \end{macro}%% \begin{macro}{\subfigcapwidth}% \begin{macro}{\setsubcapmargin}% \begin{macro}{\setsubcapwidth}% Analogous to \cs{captionwidth}, \cs{setcaptionmargin}, and% \cs{setcaptionwidth} we define \cs{subfigcapwidth},% \cs{setsubcapmargin}, and \cs{setsubcapwidth}.%% Note: \cs{subfigcapmargin} is a command in v2.0 of \textsf{subfigure}.% So we make \cs{subfigcapwidth} a command, too.% \begin{macrocode} \newcommand*\subfigcapwidth{\z@} \newcommand*\setsubcapmargin{% \subfigcapwidthfalse \renewcommand*\subfigcapmargin} \newcommand*\setsubcapwidth{% \subfigcapwidthtrue \renewcommand*\subfigcapwidth}% \end{macrocode}% \end{macro}% \end{macro}% \end{macro}%% \begin{macro}{\subcaplabelsep}% Analogous to \cs{captionlabelsep} we define \cs{subcaplabelsep}.% \begin{macrocode} \newcommand*\subcaplabelsep{\space}% \end{macrocode}% \end{macro}%% \begin{macro}{\caption@subfig@hss}% This will be uses within the caption code itself.% \begin{macrocode} \let\caption@subfig@hss\hfil% \end{macrocode}% \end{macro}%% \begin{macrocode} \else \PackageInfo{caption2}{subfigure package v2.1 (or newer) detected}% \end{macrocode}%% \begin{macro}{\subfigcapwidth}% \begin{macro}{\setsubcapmargin}% \begin{macro}{\setsubcapwidth}% Analogous to \cs{captionwidth}, \cs{setcaptionmargin}, and% \cs{setcaptionwidth} we define \cs{subfigcapwidth},% \cs{setsubcapmargin}, and \cs{setsubcapwidth}.%% Note: \cs{subfigcapmargin} is a length in v2.1 of \textsf{subfigure}.% So we make \cs{subfigcapwidth} a length, too.% \begin{macrocode} \newdimen\subfigcapwidth \newcommand*\setsubcapmargin{% \subfigcapwidthfalse \setlength\subfigcapmargin} \newcommand*\setsubcapwidth{% \subfigcapwidthtrue \setlength\subfigcapwidth}% \end{macrocode}% \end{macro}% \end{macro}% \end{macro}%% \begin{macro}{\subcaplabelsep}% Analogous to \cs{captionlabelsep} we define \cs{subcaplabelsep}.% \begin{macrocode} \newcommand*\subcaplabelsep{\hskip\subfiglabelskip}% \end{macrocode}% \end{macro}%% \begin{macro}{\caption@subfig@hss}% This will be uses within the caption code itself.% \begin{macrocode} \let\caption@subfig@hss\hss% \end{macrocode}%% \end{macro}% \begin{macrocode} \fi% \end{macrocode}%% Here starts the common code for \textsf{subfigure} v2.0 and v2.1.%% \begin{macro}{\ifsubfigcapwidth}% \begin{macro}{\subcapindent}% \begin{macro}{\subcaplabeldelim}% Analogous to \cs{ifcaptionwidth}, \cs{captionindent} \& \cs{captionlabeldelim}% we define \cs{ifsubfigcapwidth}, \cs{subcapindent} \& \cs{subcaplabeldelim}% \begin{macrocode} \newif\ifsubfigcapwidth \newdimen\subcapindent \newcommand*\subcaplabeldelim{}% \end{macrocode}% \end{macro}% \end{macro}% \end{macro}%% \begin{macro}{\subcapstyle}% Analogous to \cs{captionstyle} we define \cs{subcapstyle}% and set it (via \cs{setsubcapstyle}) to a appropriate value.% \begin{macrocode} \newcommand*\subcapstyle[1]{% \expandafter\ifx\csname caption@@#1\endcsname\relax \PackageError{caption2}{Undefined caption style `#1'}{\caption@eh}% \else \def\caption@substyle{#1}% \fi} \setsubcapstyle% \end{macrocode}% \end{macro}%% \begin{macro}{\@thesubfigure}% \begin{macro}{\@thesubtable}% The \textsf{subfigure} package makes use of \cs{subcaplabelfont} and% \cs{subfiglabelskip} within its \cs{@thesub}\textit{xxx} macros.% This is totally in contrast to the way the \textsf{caption2} package% handle these settings. So we redefine the \cs{@thesub}\textit{xxx}% to be just the plain label and nothing else.%% \begin{macrocode} \renewcommand*\@thesubfigure{\thesubfigure} \renewcommand*\@thesubtable{\thesubtable}% \end{macrocode}% \end{macro}% \end{macro}%% \begin{macro}{\@makesubfigurecaption}% \begin{macro}{\@makesubtablecaption}% Now we are ready to redefine \cs{@makesubfigurecaption}.% \begin{macrocode} \let\@makesubfigurecaption\caption@makesubcaption \let\@makesubtablecaption\caption@makesubcaption% \end{macrocode}% \end{macro}% \end{macro}%% \begin{macrocode} \fi}% \end{macrocode}%% That's all folks!%% \begin{macrocode}\let\caption@package\undefined% \end{macrocode}%% \iffalse%</package>% \fi%% \begin{thebibliography}{9}% \bibitem{float}% Anselm Lingnau:% \textsl{An Improved Environment for Floats},% 2001/11/08% \bibitem{longtable}% David Carlisle:% \textsl{The longtable package},% 2000/10/22% \bibitem{rotating}% Sebastian Rahtz and Leonor Barroca:% \textsl{A style option for rotated objects in \LaTeX},% 1997/09/26% \bibitem{subfigure}% Steven Douglas Cochran:% \textsl{The subfigure package},% 2002/02/14% \bibitem{A-W:GMS94}% Michel Goossens, Frank Mittelbach and Alexander Samarin:% \newblock \textsl{The {\LaTeX} Companion},% \newblock Addison-Wesley, Reading, Massachusetts, 1994.% \bibitem{Anne}% Anne Br\"uggemann-Klein:% \textsl{Einf\"uhrung in die Dokumentverarbeitung},% B.G. Teubner, Stuttgart, 1989% \bibitem{Kopka-E}% Helmut Kopka:% \textsl{\LaTeX -- Erweiterungsm\"oglichkeiten},% 3. \"uberarbeitete Auf\/lage, Addison-Wesley, Bonn, 1991% \end{thebibliography}%% \Finale%\endinput
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -