caption.dtx.svn-base
来自「moses开源的机器翻译系统」· SVN-BASE 代码 · 共 1,916 行 · 第 1/5 页
SVN-BASE
1,916 行
%% All caption styles are based on the default set of options. (See \Section% {style}{Styles} for a complete list.) So you only need% to specify options which are different to them.% % If you specify \meta{additional options} they get used in addition when% the caption fits into a single line and this check was not disabled with% the option |singlelinecheck=off|.% % Again a very easy example taken from |caption.sty|:% \begin{quote}% |\DeclareCaptionStyle{default}[justification=centering]{}|% \end{quote}% % \iffalse% --------------------------------------------------------------------------- %% \fi% % \subsection{Examples}% % If you would like to have a colon \emph{and} a line break as caption% separator you could define it this way:% \begin{quote}% |\DeclareCaptionLabelSeparator{period-newline}{. \\}|% \end{quote}% Selecting this separator with |\captionsetup{labelsep=period-newline}| you% get captions like this:% \begin{Example}% \captionsetup{labelsep=period-newline,labelfont=bf,margin=10pt}% \captionsetup{aboveskip=0pt,type=figure}% \caption[]{\figuretext}% \end{Example}% % For short captions---which fit into one single line---this separator% may not be satisfying, even when the automatically centering process% is switched off (with |singlelinecheck=off|):% \begin{Example}% \captionsetup{labelsep=period-newline,labelfont=bf,margin=10pt,singlelinecheck=0}% \captionsetup{aboveskip=0pt,type=figure}% \caption[]{A figure.}% \end{Example}% % An own caption style which selects another caption separator automatically% puts this right:% \begin{quote}% |\DeclareCaptionStyle{period-newline}%|\\% | [labelsep=period]{labelsep=period-newline}|% \end{quote}% \begin{Example}% \captionsetup{style=period-newline,labelfont=bf,margin=10pt}% \captionsetup{aboveskip=0pt,type=figure}% \ContinuedFloat% \caption[]{A figure.}% \end{Example}% If you would like to keep the centering of these captions an appropriate% definition is% \begin{quote}% |\DeclareCaptionStyle{period-newline}%|\\% | [labelsep=period,justification=centering]%|\\% | {labelsep=period-newline}|% \end{quote}% Using this definition short captions look like% \begin{Example}% \captionsetup{style=period-newline2,labelfont=bf,margin=10pt}% \captionsetup{aboveskip=0pt,type=figure}% \ContinuedFloat% \caption[]{A figure.}% \end{Example}% while long ones still have a line break after the caption label.% % Slightly changed, you also get centered captions if they are longer than one line:% \begin{quote}% |\DeclareCaptionStyle{period-newline}%|\\% | [labelsep=period]%|\\% | {labelsep=period-newline,justification=centering}|% \end{quote}% \begin{Example}% \captionsetup{style=period-newline3,labelfont=bf,margin=10pt}% \captionsetup{aboveskip=0pt,type=figure}% \caption[]{\figuretext}% \end{Example}%% \bigskip\pagebreak[3]% Another example: You want captions to look like this:% \begin{Example}% \captionsetup{format=reverse,labelformat=fullparens,labelsep=fill,font=small,labelfont=it}% \captionsetup{aboveskip=0pt}% \captionof{figure}[]{\figuretext}% \end{Example}% \pagebreak[2]% You could do it this way:% \nopagebreak[3]% {\leftmargini=10pt% \begin{quote}% |\DeclareCaptionFormat{reverse}{#3#2#1}|\\% |\DeclareCaptionLabelFormat{fullparens}{(\bothIfFirst{#1}{ }#2)}|\\% |\DeclareCaptionLabelSeparator{fill}{\hfill}|\\% |\captionsetup{format=reverse,labelformat=fullparens,|\\% | labelsep=fill,font=small,labelfont=it}|% \end{quote}}%% \bigskip\pagebreak[3]% Another example: The caption text should go into the left margin; a possible% solution would be:% {\leftmargini=10pt% \begin{quote}% |\DeclareCaptionFormat{llap}{\llap{#1#2}#3\par}|\\% |\captionsetup{format=llap,labelsep=quad,singlelinecheck=no}|% \end{quote}}% As a result you would get captions like this:% \begin{Example}% \captionsetup{format=llap,singlelinecheck=no,labelsep=quad}% \captionsetup{aboveskip=0pt}% \captionof{figure}[]{\figuretext}% \end{Example}% % \iffalse% --------------------------------------------------------------------------- %% \fi% % \pagebreak[3]% \section{Using non-standard document classes}% % \NEWdescription{v3.0d}% The \thispackage\ package was developed using the standard document classes% |article|, |report| and |book|.% % If you would like to use the \thispackage\ package with the% \KOMAScript\ classes or with the \package{memoir} class, you have to take% into consideration that all the possibilities for customization of the% captions the \KOMAScript\ classes or \package{memoir} class have% to offer will get lost. (And they have a lot of possibilites to offer!)% So class options like |tablecaptionabove| and commands like |\captionabove|,% |\captionbelow|, |\captionformat|, |\figureformat|, |\tableformat|,% |\setcapindent|, |\setcaphanging|, |\captionstyle| etc.\ will not work% anymore. So make a wise decision!% % Using the \thispackage\ package together with document classes not mentioned% so far is not recommended at the moment -- unwanted layout changes,% side effects or failures could occur. (But future versions of the% \thispackage\ package will contain adaptations for more document classes!% % \iffalse% --------------------------------------------------------------------------- %% \fi% % \section{Using other packages}% \label{packages}% % The \thispackage\ package contains special adaptations to other packages who% handle with captions, too, so the captions always should look like you% have specified them to look like.%% These are the packages the \thispackage\ package is adapted to:% % \begin{tabular}{ll}% |float| & Gives you the possibility to define new floating environments\\% |hypcap| & Adjusting \package{hyperref} anchors of captions\\% |listings| & Typesets source code listings\\% |longtable| & Typesets tables spanned over multiple pages\\% |rotating| & Supports rotated figures and tables\\% |sidecap| & Offers captions \emph{beside} figures or tables\\% |supertabular| & Typesets tables spanned over multiple pages\\% \end{tabular}% % \NEWfeature{v3.0b}% If you use one of the above packages together with the {\thispackage} package% you get the additional possibility to set up captions with% \begin{quote}|\captionsetup|\oarg{environment}\marg{options}\quad.\end{quote}% These options will apply for captions inside these environments automatically.% For example% \begin{quote}|\captionsetup[lstlisting]{labelfont=bf}|\end{quote}% forces captions inside the |lstlisting| environment to have bold labels.% (Please note that this do not work with the |sideways| environments offered by% the \package{rotating} package.)% % If a certain support is not desired you can switch it off using the% \thispackage\ package option% \begin{quote}% |\usepackage[|\ldots|,|\meta{package}|=no]{caption}|\quad.% \end{quote}% For example specifying the option |float=no| means you don't like the% \thispackage\ package to support the \package{float} package.% (Note: You can specify these options only within the |\usepackage| command,% especially \emph{not} at a later time with |\captionsetup|.)% % For further information about the supported packages please take a look% at the documentation belonging to it or buy yourself% The \LaTeX\ Companion\cite{companion}.% % \iffalse% --------------------------------------------------------------------------- %% \fi% % \subsection{The \package{float} package}% \label{float}% % A very useful feature is provided by the \package{float} package\cite{float}:% It offers the float placement specifier |H| which is much more restrictive% than the specifier |h| offered by \LaTeX. While the latter one is only a% recommendation to \LaTeX\ to set the float ``here'', the |H| forces the% float to appear exactly at the spot where it occurs in your input file% and nowhere else.%% Furthermore it offers different styles for floating environments, these% styles are |plain|, |plaintop|, |ruled|, and |boxed|.% You can link one of these styles to either new floating environments or% to one of the existing environments |figure| and |table|.% % If you are using the \thispackage\ package together with the \package{float}% package this caption style called |ruled| gets defined automatically:% \begin{quote}% |\DeclareCaptionStyle{ruled}{labelfont=bf,labelsep=space}|% \end{quote}% This style represents the caption layout in |ruled| styled floats.% For you as an end user this means that captions within |ruled| floats will% always look like this, nevertheless what generic caption options do you% specify:% % \ifx\floatstyle\undefined% % \begin{Example}% \hrule height.8pt depth0pt \kern2pt% \vbox{\strut{\bfseries Program 7.1}% The first program. This hasn't got anything to do with the package% but is included as an example. Note the \texttt{ruled} float style.}% \kern2pt\hrule\kern2pt% \begin{verbatim}% #include <stdio.h>% % int main(int argc, char **argv)% {% for (int i = 0; i < argc; ++i)% printf("argv[%d] = %s\n", i, argv[i]);% return 0;% }% \end{verbatim}% \kern2pt\hrule\relax% \end{Example}% % \else% % \floatstyle{ruled}% \newfloat{Program}{tbp}{lop}[section]% \floatname{Program}{Program}% % \begin{Program}[H]% \begin{verbatim}% #include <stdio.h>% % int main(int argc, char **argv)% {% for (int i = 0; i < argc; ++i)% printf("argv[%d] = %s\n", i, argv[i]);% return 0;% }% \end{verbatim}% \caption{The first program. This hasn't got anything to do with the package% but is included as an example. Note the \texttt{ruled} float style.}% \end{Program}% % \fi% % If you want a different layout for |ruled| captions you have to define% your own one using the command% \begin{quote}% |\DeclareCaptionStyle{ruled}|\marg{options}\quad.% \end{quote}% % This mechanism also works with all other float styles. If you want a special% caption layout for |plain| or |boxed| floats for example you can simply define% a suitable caption style with the same name as the float style.% % \textbf{Note:} For successful cooperation you need the float package% version 1.3 or newer.%% \iffalse% --------------------------------------------------------------------------- %% \fi% % \subsection{The \package{listings} package}% \label{listings}% % \NEWdescription{v3.0b}% The \package{listings} package\cite{listings} is a source code printer for \LaTeX.% You can typeset stand alone files as well as listings with an environment% similar to \texttt{verbatim} as well as you can print code snippets using% a command similar to |\verb|.% Many parameters control the output and if your preferred programming% language isn't already supported, you can make your own definition.%% \textbf{Note:} For successful cooperation you need the listings package% version 1.2 or higher. You'll get an error message when using an% older version!%% \iffalse% --------------------------------------------------------------------------- %% \fi% % \subsection{The \package{longtable} package}% \label{longtable}% % The \package{longtable} package\cite{longtable} offers the environment% |longtable| which behaves similar to the |tabular| environment, but% the table itself can span multiple pages.%% \textbf{Note:} For successful cooperation you need the longtable package% version 3.15 or newer.% % \iffalse% --------------------------------------------------------------------------- %% \fi% % \subsection{The \package{rotating} package}% \label{rotating}% % The \package{rotating} package\cite{rotating} offers the floating% environments \texttt{sideways\-figure} and \texttt{sideways\-table}% which are just like normal figures and tables but rotated by 90 degree.% Furthermore they always use a full page on their own.% % \iffalse% --------------------------------------------------------------------------- %% \fi% % \subsection{The \package{sidecap} package}% \label{sidecap}% % \NEWdescription{v3.0b}% The \package{sidecap} package\cite{sidecap} offers the floating% environments |SCfigure| and |SCtable| which are like normal figures% and tables but the caption will be put \emph{beside} the contents.% % The \package{sidecap} package offers it's own options for justification.% If set, they will override the one specified with the caption option% |justification=| for captions beside their contents.%% \DescribeMacro{listof=}% Using the \package{sidecap} package you will probably notice that% suppressing the entry in the list of figures or tables with% |\caption[]{|\ldots|}| won't work inside these environments.% This is caused by the implementation design of the \package{sidecap}% package, but you can use |\captionsetup{listof=false}| inside the% figure or table as an alternative here.% % \ifx\SCfigure\undefined% % \begin{Example}% \newsavebox\scbox% \begin{lrbox}{\scbox}% \setlength{\unitlength}{.75cm}% \setlength{\fboxsep}{0pt}% \fbox{\begin{picture}(4,4)% \put(1,3){\circle{1}}% \put(3,3){\circle{1}}% \put(2,2){\circle{1}}% \put(1,1){\circle{1}}% \put(3,1){\circle{1}}% \end{picture}}% \end{lrbox}% \newlength\scboxwidth% \setlength\scboxwidth{\wd\scbox}% \makebox[\linewidth][c]{% \parbox[b]{\scboxwidth}{\unhbox\scbox}% \hspace\marginparsep% \parbox[b]{1.5\scboxwidth}{% \captionsetup{justification=RaggedRight,labelfont=bf}% \captionof{figure}[]{A small example with the caption beside the figure.}% }% }% \end{Example}% % \else% % \captionsetup{labelfont=bf}% \begin{SCfigure}[1.5][!ht]% \setlength{\unitlength}{.75cm}% \setlength{\fboxsep}{0pt}% \fbox{\begin{picture}(4,4)% \put(1,3){\circle{1}}% \put(3,3){\circle{1}}% \put(2,2){\circle{1}}% \put(1,1){\circle{1}}% \put(3,1){\circle{1}}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?