28.03.2013 Views

Typesetting captions with the caption package - Departamento de ...

Typesetting captions with the caption package - Departamento de ...

Typesetting captions with the caption package - Departamento de ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

191 \<strong>de</strong>f\<strong>caption</strong>@tempa{#1}%<br />

192 \ifx\<strong>caption</strong>@tempa\@empty<br />

193 \PackageInfo{<strong>caption</strong>3}{Option ‘parskip’ ignored}%<br />

194 \else<br />

195 \<strong>caption</strong>@KV@parskip{#1}%<br />

196 \fi}%<br />

197 }<br />

Styles<br />

\DeclareCaptionStyle \DeclareCaptionStyle{〈name〉}[〈single-line-list-of-KV〉]{〈list-of-KV〉}<br />

198 \newcommand*\DeclareCaptionStyle[1]{%<br />

199 \@ifnextchar[{\<strong>caption</strong>@<strong>de</strong>clarestyle{#1}}{\<strong>caption</strong>@<strong>de</strong>clarestyle{#1}[]}}<br />

200 \<strong>de</strong>f\<strong>caption</strong>@<strong>de</strong>clarestyle#1[#2]#3{%<br />

201 \global\@name<strong>de</strong>f{<strong>caption</strong>@sls@#1}{#2}%<br />

202 \global\@name<strong>de</strong>f{<strong>caption</strong>@sty@#1}{#3}}<br />

203 \@onlypreamble\DeclareCaptionStyle<br />

204 \@onlypreamble\<strong>caption</strong>@<strong>de</strong>clarestyle<br />

205 \DeclareCaptionOption{style}{\<strong>caption</strong>@setstyle{#1}}<br />

\<strong>caption</strong>@setstyle \<strong>caption</strong>@setstyle{〈name〉}<br />

\<strong>caption</strong>@setstyle*{〈name〉}<br />

Selecting a <strong>caption</strong> style means saving <strong>the</strong> additional 〈single-line-list-of-KV〉 (this will be<br />

done by \<strong>caption</strong>@sls), resetting <strong>the</strong> <strong>caption</strong> options to <strong>the</strong> <strong>de</strong>fault ones (this will be<br />

done using \<strong>caption</strong>@set<strong>de</strong>fault) and executing <strong>the</strong> 〈list-of-KV〉 options (this will<br />

be done using \<strong>caption</strong>@esetup).<br />

The starred version will give no error message if <strong>the</strong> given style is not <strong>de</strong>fined.<br />

206 \newcommand\<strong>caption</strong>@setstyle{%<br />

207 \@ifstar{\<strong>caption</strong>@@setstyle\@gobble}{\<strong>caption</strong>@@setstyle\@firstofone}}<br />

208 \newcommand*\<strong>caption</strong>@@setstyle[2]{%<br />

209 \@ifun<strong>de</strong>fined{<strong>caption</strong>@sty@#2}%<br />

210 {#1{\<strong>caption</strong>@Error{Un<strong>de</strong>fined <strong>caption</strong> style ‘#2’}}}%<br />

211 {\expandafter\let\expandafter\<strong>caption</strong>@sls\csname <strong>caption</strong>@sls@#2\endcsname<br />

212 \<strong>caption</strong>@set<strong>de</strong>fault\<strong>caption</strong>@esetup{\csname <strong>caption</strong>@sty@#2\endcsname}}}<br />

\<strong>caption</strong>@set<strong>de</strong>fault This resets (nearly) all <strong>caption</strong> options to <strong>the</strong> <strong>de</strong>fault ones. Note that this does not touch<br />

<strong>the</strong> skips and <strong>the</strong> positioning!<br />

213 \newcommand\<strong>caption</strong>@set<strong>de</strong>fault{\<strong><strong>caption</strong>s</strong>etup{%<br />

214 format=<strong>de</strong>fault,labelformat=<strong>de</strong>fault,labelsep=<strong>de</strong>fault,textformat=<strong>de</strong>fault,%<br />

215 justification=<strong>de</strong>fault,font=<strong>de</strong>fault,labelfont=<strong>de</strong>fault,textfont=<strong>de</strong>fault,%<br />

216 margin=0pt,in<strong>de</strong>nt=0pt,parin<strong>de</strong>nt=0pt,hangin<strong>de</strong>nt=0pt,%<br />

217 singlelinecheck=1,strut=1}}<br />

Currently <strong>the</strong>re is only one pre-<strong>de</strong>fined style, called ‘<strong>de</strong>fault’. It’s a perfect match to <strong>the</strong><br />

behaviour of \@make<strong>caption</strong> offered by <strong>the</strong> standard LATEX document classes: If <strong>the</strong><br />

<strong>caption</strong> fits in one single line, it is typeset centered.<br />

218 \DeclareCaptionStyle{<strong>de</strong>fault}[in<strong>de</strong>nt=0pt,justification=centering]{}<br />

34

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!