caption.dtx.svn-base

来自「moses开源的机器翻译系统」· SVN-BASE 代码 · 共 1,916 行 · 第 1/5 页

SVN-BASE
1,916
字号
% \begin{Example}%   \begin{minipage}[c]{.5\linewidth}% \iffalse%     \captionsetup{aboveskip=0pt}%% \fi%     \captionof{table}{A table}%     \centering\begin{tabular}{ll}%       A & B \\%       C & D \\%     \end{tabular}%   \end{minipage}%   \begin{minipage}[c]{.5\linewidth}%     \centering\begin{tabular}{ll}%       A & B \\%       C & D \\%     \end{tabular}%     \captionof{table}{A table}%   \end{minipage}% \end{Example}% % But you can fix this by using the option |position=|: It specifies how the% spacing above and below the caption will be used:% \begin{quote}%   |position=top|\quad(or |position=above|)% \end{quote}% tells the \thispackage\ package to use the spacing useful for caption% \emph{above} the figure or table and% \begin{quote}%   |position=bottom|\quad(or |position=below|)% \end{quote}% tells the \thispackage\ package to use the spacing useful for captions% \emph{below} the figure or table. (The last one is the default setting% except for |longtable|s.)% % So adding an extra |\captionsetup{position=top}| to the left example% table gives you proper spacing around both captions:% \begin{Example}%   \begin{minipage}[c]{.5\linewidth}%     \captionsetup{position=top}%     \captionof{table}{A table}%     \centering\begin{tabular}{ll}%       A & B \\%       C & D \\%     \end{tabular}%   \end{minipage}%   \begin{minipage}[c]{.5\linewidth}%     \centering\begin{tabular}{ll}%       A & B \\%       C & D \\%     \end{tabular}%     \captionof{table}{A table}%   \end{minipage}% \end{Example}%% (Technically speaking |\abovecaptionskip| and |\belowcaptionskip| will% be swapped if you specify the option |position=top|, so in both cases% |\abovecaptionskip| will be used between the caption and the figure or% table itself.)% % \DescribeMacro{tableposition=}% This option is especially useful when used together with the optional% argument of the |\captionsetup| command.% \See{\Section{misc}{Useful stuff} for details}\par% E.g.,% \begin{quote}%   |\captionsetup[table]{position=top}|% \end{quote}% causes all captions within tables to be treated as captions \emph{above}% the table (regarding spacing around it).% \NEWfeature{v3.0a}% Because this is a very common setting the \thispackage\ package offers% an abbreviating option for the use with |\usepackage|:% \begin{quote}%   |\usepackage[|\ldots|,tableposition=top]{caption}|% \end{quote}% is equivalent to% \begin{quote}%   |\usepackage[|\ldots|]{caption}|\\%   |\captionsetup[table]{position=top}|% \end{quote}%% \iffalse% --------------------------------------------------------------------------- %% \fi% % \pagebreak[3]% \section{Useful stuff}% \label{misc}% % \DescribeMacro{\caption}% The command% \nopagebreak[3]% \begin{quote}%   |\caption|\oarg{lst\_entry}\marg{heading}% \end{quote}% \nopagebreak[3]% typesets the caption inside a floating environment like |figure| or |table|.% Well, you already know this, but what is new is the fact then when you leave% the argument \meta{lst\_entry} empty, no entry in the list of figures or% tables will be made; e.g.,% \begin{quote}%   |\caption[]{A figure without entry in the list of figures.}|% \end{quote}% % \DescribeMacro{\caption*}% The \package{longtable} package defines the command |\caption*| which% typesets the caption without label and without entry in the list of tables.% An example:% \begin{quote}%   |\begin{longtable}{cc}|\\%   |  \caption*{A table}\\|\\%   |  A & B \\|\\%   |  C & D \\|\\%   |\end{longtable}|% \end{quote}% looks like% \begin{longtable}{cc}%   \caption*{A table}\\%   A & B \\%   C & D \\% \end{longtable}% % This package does it, too, so you can use this command now within every% floating environment like |figure| or |table|, like here:% \begin{quote}%   |\begin{table}|\\%   |  \caption*{A table}|\\%   |  \begin{tabular}{cc}|\\%   |    A & B \\|\\%   |    C & D \\|\\%   |  \end{tabular}|\\%   |\end{table}|% \end{quote}% % \DescribeMacro{\captionof}% \DescribeMacro{\captionof*}% Sometimes you want to typeset a caption \emph{outside} a floating environment,% putting a figure within a |minipage| for instance. For this purpose the% \thispackage\ package offers the command% \begin{quote}%   |\captionof|\marg{float type}\oarg{lst\_entry}\marg{heading}\quad.% \end{quote}% Note that the first argument, the \meta{float type}, is mandatory here, because% the |\captionof| command needs to know which name to put into the caption label% (e.g. ``Figure'' or ``Table'') and in which list to put the contents entry.% An example:% \begin{quote}%   |\captionof{figure}{A figure}|\\%   |\captionof{table}{A table}|% \end{quote}% typesets captions like this:% \begin{Example}%   \captionof{figure}{A figure}%   \captionsetup{belowskip=\abovecaptionskip}%   \captionof{table}{A table}% \end{Example}% % The star variant |\captionof*| has the same behaviour as the |\caption*| command:% it typesets the caption without label and without entry to the list of figures% or tables.%% Please use both |\captionof| and |\captionof*| only \emph{inside} environments% (like |minipage| or |\parbox|), otherwise a page break can appear between content% and caption. Furthermore some strange effects could occur (e.g., wrong spacing% around captions).% % \DescribeMacro{\ContinuedFloat}% Sometimes you want to split figures or tables without giving them% their own reference number. This is what the command% \begin{quote}%   |\ContinuedFloat|% \end{quote}% is for; it should be used as first command inside the floating environment.% It prevents the increment of the relevant counter so a figure or table% with a |\ContinuedFloat| in it gets the same reference number as the figure% or table before.% % An example:% \begin{quote}%   |\begin{table}|\\%   |\caption{A table}|\\%   \ldots\\%   |\end{table}|\\%   \ldots\\%   |\begin{table}\ContinuedFloat|\\%   |\caption{A table (cont.)}|\\%   \ldots\\%   |\end{table}|% \end{quote}% gives the following result:% \begin{Example}%   \makeatletter\def\@captype{table}\makeatother%   \caption[]{A table}%   \centerline{\ldots}%   \ContinuedFloat%   \captionsetup{aboveskip=0pt}%   \caption[]{A table (cont.)}% \end{Example}% % \DescribeMacro{\captionsetup}% We already know the |\captionsetup| command (see \Section{usage}% {Using the package}), but this time we get enlighten about% the optional argument \meta{float type}.% % Remember, the syntax of this command is% \begin{quote}%   |\captionsetup|\oarg{float type}\marg{options}\quad.% \end{quote}% % If a \meta{float type} gets specified, all the \meta{options} don't% change anything at this time. Instead they only get marked for a later use,% when a caption inside of a floating environment of the particular type% \meta{float type} gets typeset.% For example% \begin{quote}%   |\captionsetup[figure]|\marg{options}% \end{quote}% forces captions within a |figure| environment to use the given \meta{options}.%% Here comes an example to illustrate this:% \begin{quote}%   |\captionsetup{font=small}|\\%   |\captionsetup[figure]{labelfont=bf}|% \end{quote}% gives captions like this:% \begin{Example}%   \captionsetup{font=small}%   \captionsetup[figure]{labelfont=bf}%   \captionof{figure}[]{A figure}%   \captionsetup{belowskip=\abovecaptionskip}%   \captionof{table}[]{A table}% \end{Example}% % As you see the command |\captionsetup[figure]{labelfont=bf}| only changed% the font of the figure caption labels, not touching all other ones.% % \DescribeMacro{\clearcaptionsetup}% If you want to get rid of these parameters marked for an automatic use within% a particular environment you can use the command% \begin{quote}%   |\clearcaptionsetup|\marg{Typ}\quad.% \end{quote}%% For example |\clearcaptionsetup{figure}| would clear the extra handling in the% example above:% \begin{Example}%   \captionsetup{font=small}%   \captionof{figure}[]{A figure}%   \captionsetup{belowskip=\abovecaptionskip}%   \captionof{table}[]{A table}% \end{Example}% % As \meta{float type} you can usually give one of these only two:% |figure| and |table|.% But as we will see later that some \LaTeX\ packages exist (like the% \package{float}, \package{longtable}, and \package{sidecap} package% for example) who can define additional floating enviroments and these two% commands can also be used with them.% % \iffalse% --------------------------------------------------------------------------- %% \fi% % \pagebreak[3]% \section{Do it yourself!}% \label{declare}% % A family of commands is provided to allow users to define their own formats.% This enables information on separators, justification, fonts, and styles to% be associated with a name and kept in one place% (these commands need to appear in the document preamble,% this is the part between |\documentclass| and |\begin{document}|).% % \pagebreak[2]% \DescribeMacro{\DeclareCaptionFormat}% You can define your own caption formats using the command% \begin{quote}%   |\DeclareCaptionFormat|\marg{name}\marg{code using \#1, \#2 and \#3}\quad.% \end{quote}% At usage the system replaces \#1 with the caption label, \#2 with the% separator and \#3 with the text. So the standard format |plain| is defined% inside |caption.sty| as% \begin{quote}%   |\DeclareCaptionFormat{plain}{#1#2#3\par}|% \end{quote}% % \DescribeMacro{\DeclareCaptionLabelFormat}% Likewise you can define your own caption label formats:% \begin{quote}%   |\DeclareCaptionLabelFormat|\marg{name}\marg{code using \#1 and \#2}% \end{quote}% At usage \#1 gets replaced with the name (e.g. ``figure'') and \#2% gets replaced with the reference number (e.g. ``12'').% % \DescribeMacro{\bothIfFirst}% \DescribeMacro{\bothIfSecond}% When you define your own caption label formats and use the \package{subfig}% package\cite{subfig}, too, you must take care of empty caption label names.% For this purpose the commands% \begin{quote}%   |\bothIfFirst|\marg{first arg}\marg{second arg}\quad and\\%   |\bothIfSecond|\marg{first arg}\marg{second arg}% \end{quote}% are offered. |\bothIfFirst| tests if the first argument exists (means: is% not empty), |\bothIfSecond| tests if the second argument exists. If it is% so both arguments get typeset, otherwise none of them.% % For example the standard label format |simple| isn't defined as% \begin{quote}%   |\DeclareCaptionLabelFormat{simple}{#1 #2}|\quad,% \end{quote}% because this could cause an extra space if \#1 is empty. Instead |simple|% is defined as% \begin{quote}%   |\DeclareCaptionLabelFormat{simple}{\bothIfFirst{#1}{ }#2}|\quad,% \end{quote}% causing the space to appear only if the label name is present.% % \pagebreak[3]% \DescribeMacro{\DeclareCaptionLabelSeparator}% You can define your own caption label separators with% \nopagebreak[3]% \begin{quote}%   |\DeclareCaptionLabelSeparator|\marg{name}\marg{code}\quad.% \end{quote}% \nopagebreak[3]% Again an easy example taken from |caption.sty| itself:% \nopagebreak[3]% \begin{quote}%   |\DeclareCaptionLabelSeparator{colon}{: }|% \end{quote}% \pagebreak[3]% % \DescribeMacro{\DeclareCaptionJustification}% You can define your own caption justifications with% \begin{quote}%   |\DeclareCaptionJustification|\marg{name}\marg{code}\quad.% \end{quote}% The \meta{code} simply gets typeset just before the caption.% E.g.~using the justification |raggedright|, which is defined as% \begin{quote}%   |\DeclareCaptionJustification{raggedright}{\raggedright}|\quad,% \end{quote}% yields captions with all lines moved to the left margin.% % \DescribeMacro{\DeclareCaptionFont}% You can define your own caption fonts with% \begin{quote}%   |\DeclareCaptionFont|\marg{name}\marg{code}\quad.% \end{quote}% For example this package defines the options |small| and |bf| as% \begin{quote}%   |\DeclareCaptionFont{small}{\small}|\quad and\\%   |\DeclareCaptionFont{bf}{\bfseries}|\quad.% \end{quote}% The line spacing could be customized using the \package{setspace} package,% for example:\NEWdescription{v3.0h}% regeln:% \begin{quote}%   |\usepackage{setspace}|\\%   |\DeclareCaptionFont{singlespacing}{\singlespacing}|\\%   |\DeclareCaptionFont{onehalfspacing}{\onehalfspacing}|\\%   |\DeclareCaptionFont{doublespacing}{\doublespacing}|\\%   |\captionsetup{font={onehalfspacing,small},labelfont=bf}|% \end{quote}% \example{font={onehalfspacing,small},labelfont=bf,singlelinecheck=off}\figuretext% An example which brings color into life:% \begin{quote}%   |\usepackage{color}|\\%   |\DeclareCaptionFont{red}{\color{red}}|\\%   |\DeclareCaptionFont{green}{\color{green}}|\\%   |\DeclareCaptionFont{blue}{\color{blue}}|\\%   |\captionsetup{labelfont=blue,textfont=green}|% \end{quote}% \example{labelfont=blue,textfont=green,singlelinecheck=off}\figuretext% % \DescribeMacro{\DeclareCaptionStyle}% The best one comes at last: You can define your own caption styles with% \begin{quote}%   |\DeclareCaptionStyle|\marg{name}\oarg{additional options}\marg{options}% \end{quote}% Remember, caption styles are just a collection of suitable options, saved% under a given name. You can wake up these options at any time with the% option |style=|\meta{style name}.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?