Debian Codegraph @

texmf-dist/doc/latex/easyfloats/content/s3_documentation.tex

raw
1 % !TeX root = ../easyfloats.tex
2
3 \section{Documentation}
4 \label{documentation}
5
6 This section contains the documentation on how to use this package.
7
8 \Cref{options} gives general information on options which environments and commands defined by this package may take.
9 The options themselves are explained in \cref{environments,commands} where the environments and commands defined by this package are explained.
10
11 \Cref{initialization} describes what is happening when loading this package.
12 \Cref{package-options} describes the options which can be passed to `\usepackage` when loading this package.
13
14 \Cref{help} explains a few features which may help you to get a better understanding about what is going on.
15 This might be useful if you run into unexpected errors or this package behaves different than you expected.
16
17
18 \subsection{Options}
19 \label{options}
20
21 The environments and commands defined by this package take options (implemented with the \pkg{pgfkeys} package).
22 Options are a comma separated list of `<key>`s or `<key>=<value>` pairs.
23
24 Which keys are allowed for which environment\slash command and which values are allowed for which key is specified in \cref{environments,commands} where the environments and commands are documented.
25 This section gives general information about these options.
26
27 This section does *not* apply to the package options which are explained in \cref{package-options}.
28
29
30 \subsubsection{Initial vs default values}
31 \label{initial-vs-default-values}
32
33 I am using the words *initial value* and *default value* like they are used in the \mycite{tikz}.
34
35 The *initial* value of an option is the value which is used if the key is *not* given.
36
37 The *default* value of an option is the value which is used if the key is given without a value.
38 Most keys don't have a default value, i.e.\ if you use the key you must explicitly give it a value.
39
40 \subsubsection{Options scope}
41 \label{options-scope}
42
43 Setting an option always applies until the end of the current group.
44 For the argument of an environment this is the corresponding `\end` command.
45 For the argument of the \cmd{\includegraphicobject} command this is the end of this command.
46 For the argument of \cmd{\objectset} this may be the end of the document.
47
48 If you are not familiar with the concept of groups in \TeX\ \mycite[chapter~10]{texbytopic} is one possible place to read up on it.
49
50 \subsubsection{Special characters in options}
51 \label{special-characters-in-options}
52
53 If a value contains a comma or an equals sign it must be wrapped in curly braces.
54
55 Spaces before and after a comma (separating an option) and before or after an equals sign (separating key and value) are ignored.
56 However, a space after the opening brace is *not* ignored.
57 So if you put the first key on the next line make sure to comment out the linebreak.
58 If a leading or trailing space in a value is desired wrap the value in curly braces.
59
60 `\par` (aka an empty line) is forbidden in keys but allowed in values.
61
62 \subsubsection{Key patterns}
63 \label{key-patterns}
64
65 Sometimes I am talking about entire groups of keys instead of individual keys.
66 I specify those groups with a pattern which matches the keys that I am referring to.
67 In these patterns parenthesis stand for something optional and angular brackets for wildcards.
68
69 For example the pattern `(<env>) arg(s)` matches the keys `tabular* arg` and `args` (and many more)
70 but not `env arg` because `env` is not an existing environment.
71
72 If a key has a version which ends on a `+` to append a value instead of replacing it the space in front of the `+` is optional.
73
74 \subsubsection{Key name vs key path}
75 \label{key-name-vs-key-path}
76
77 \pkg{pgfkeys} organizes all keys \textcquote[page~954]{tikz}{in a large tree that is reminiscent of the Unix file tree.}
78 The keys of this package are located in the three paths `/object`, `/subobject` and `/graphicobject`.
79
80 In error messages thrown by the \pkg{pgfkeys} package the full path of a key is shown.
81
82 When setting keys, however, you need not and should not specify the full path.
83 The commands and environments of this package set the path automatically.
84 Using full paths does not directly cause an error or a warning but trying to set options for a style or style group with \cmd{\objectset} causes undefined behavior.
85
86 Therefore, error messages thrown directly by this package omit the path and show the name of the key only.
87
88 \subsubsection{Key types}
89 \label{key-types}
90
91 In \pkg{pgfkeys} there are different types of keys.
92 Which type a key belongs to is relevant for debugging if you want to check the value of a key, see \cref{help}.
93
94 \keytypedoc{storing key}
95 Keys of this type are like a variable.
96 They store the given value.
97 This value can be showed using the `.show value` handler (see \cref{help}).
98
99 \keytypedoc{executed key}
100 Keys of this type are like a function.
101 They execute some predefined code and possibly take a value as argument.
102
103 \keytypedoc{boolean key}
104 is a special case of an executed key which sets a plain \TeX\ if command.
105 This if command and it's meaning can be showed with the `.show boolean` handler (which is *not* contained in \pkg{pgfkeys}, I have defined it in this package).
106
107 The allowed values for a key of this type are `true` and `false`.
108 The default value (i.e.\ the value which is assumed if the key is given without a value) is `true`.
109
110 \keytypedoc{forwarding key}
111 is a special case of an executed key which calls another key.
112
113 \keytypedoc{handler}
114 Keys defined in the path `/handlers`.
115 They can be applied to other keys by appending them to the path.
116 For users of this package they can be helpful for debugging.
117 For example `\objectset{env/.show value}` shows the value of the key `env`.
118
119 The \pkg{pgfkeys} package also defines handlers which expand the value.
120 I haven't come up with an example where this might be useful in the context of this package but e.g.\ `tabular arg/.expand once=\colspec,` works as expected.
121
122 \keytypedoc{unknown key handler}
123 is a special key which is called if a given key does not exist and it's name is not a handler.
124 I am using this to implement key patterns.
125 \endkeytypedoc
126
127 \subsubsection{Styles}
128 \label{styles}
129 \DescribeMeta{style}
130 \DescribeMeta{styles}
131
132 This package defines two styles, one for figures and one for tables.
133
134 You can think of these styles as an extension of the \pkg{float} package's float styles.
135
136 These styles are somewhat inspired by the \pkg{pgfkeys} styles but are different.
137 They are neither set nor applied in the same way.
138
139 A style is a list of options which is not set immediately but locally for each object belonging to that style.
140
141 The options of a style can be set by passing the name of the style as an optional argument to the \cmd{\objectset} command,
142 e.g.\ `\objectset[figure]{<options>}` or `\objectset[table]{<options>}`.
143
144 A style is applied by using the corresponding environment (e.g.\ \env{figureobject} or \env{tableobject})
145 or `\graphicobjectstyle{<style>}` for \cmd{\includegraphicobject}.
146
147 New styles can be defined with `\NewObjectStyle` as explained in \cref{new-object-styles-and-types}.
148
149 \subsubsection{Style groups}
150 \label{style-groups}
151 \DescribeMeta{group}
152
153 This package defines one group of styles called `all` which contains all defined styles.
154
155 When setting options one can use a group name instead of a style name.
156 In that case the options are set for all styles in the group.
157
158 \subsubsection{Options processing order}
159 \label{options-processing-order}
160
161 \begin{enumerate}
162 \item Options set with `\objectset{<options>}` have the lowest priority.
163 \item Options set for a specific style with `\objectset[<styles>]{<options>}` take precedence because they are set later (at the object, not the `\objectset` command).
164 \item Options passed directly to the object have the highest priority.
165 \end{enumerate}
166
167 For example:
168
169 \begin{examplecode}
170 \objectset[figure]{placement=p}
171 \objectset{placement=H}
172 \objectset[table]{placement=htbp}
173 \end{examplecode}
174
175 Given the above preamble both figure- and tableobjects are floating.
176 Tableobjects are allowed to be placed where they are specified in the source code.
177 Figureobjects are put on a separate float page.
178 The second line (which would disable floating) has no effect (unless you define a custom style) because it is overridden not only by the third but also the first line.
179
180
181 \subsection{Environments}
182 \label{environments}
183
184 This package defines the following environments.
185 Each of them takes exactly one mandatory argument,
186 options as a comma separated key=value list.
187
188 \subsubsection{`object` environment}
189 \label{object-environment}
190 \begingroup
191 \keydocpath{/object}
192 \DescribeEnv{object}
193 The `object` environment is used internally by \env{figureobject} and \env{tableobject}.
194 Don't use this directly.
195 You can define more environments like `figureobject` or `tableobject` with \cmd{\NewObjectStyle} if needed.
196
197 This environment redefines the `\caption` and `\label` commands to set the \key{caption}\slash `label` option so that you can use them as usual except you cannot create several labels.
198 If you really need several labels for the same object put the additional `\label` command(s) inside of the caption argument, there `\label` has it's original meaning.
199 The location or the order of `\caption` and `\label` inside of the object environment is not relevant.
200 Nevertheless I recommend to always put the `\label` after the `\caption` as it is usually required in order to get the references right (if you choose to use these commands instead of the options).
201 Where the caption is typeset (above or below the object) is determined by the float style.
202
203 This environment takes the following options:
204 \keydoc{type = <type>}{storing key}
205 \DescribeMeta{type}
206 The floating environment to use, e.g.\ `figure` or \env{table}.
207 \keydoc[initial value=empty]{float style = plain | plaintop | ruled | boxed | <empty>}{storing key}
208 How the object is supposed to look like,
209 most importantly whether the caption is supposed to be above or below the object.
210 See the \pkg{float} package for more information.
211
212 If the value is empty the float type is *not* restyled before the\slash each object.
213 However, this package restyles \env{table} to `plaintop` and `figure` to `plain` when it is loaded.
214 The reasoning is explained in~\autocite{texexchange_caption_position}.
215
216 \keydoc{caption = <text>}{storing key}
217 The caption to place above or below the float.
218
219 The appearance of the caption can be configured using `\captionsetup` defined by the \pkg{caption} package.
220 The \pkg{caption} package is loaded automatically by this package.
221 If you want to change the horizontal alignment of the caption take a look at the options `justification` and `singlelinecheck`.
222 \keydoc{list caption = <text>}{storing key}
223 The caption to place in the list of `<type>`s.
224 If this is not given, the value of \key{caption} is used instead.
225 \keydoc{details = <text>}{storing key}
226 This is appended to the caption which is placed above or below the object but not to the list of `<type>`s.
227 \begin{examplecodekey}
228 caption=CTAN lion drawing by Duane Bibby,
229 details=Thanks to \url{www.ctan.org}.
230 \end{examplecodekey}
231 is equivalent to
232 \begin{examplecodekey\starred}{\ExamplecodeEscapeinside $ $}
233 list caption=CTAN lion drawing by Duane Bibby,
234 caption=CTAN lion drawing by Duane Bibby.$\\$ Thanks to \url{www.ctan.org}.
235 \end{examplecodekey\starred}
236 \keydoc[initial value=a full stop followed by a space]{details sep = <text>}{storing key}
237 The separator to be placed between caption and details if details are given.
238 \keydoc{label = <label>}{storing key}
239 Defines a label to reference this object.
240 \keydoc{add label = <label>}{storing key}
241 Defines an additional label which can be used synonymously to label.
242 If this key is given several times, only the last one will have an effect.
243 \keydoc[initial value=empty]{placement = [htbp]+!? | H | I | <empty>}{storing key}
244 The optional argument passed to the floating environment.
245 Allowed values:
246 \begin{itemize}
247 \item any combination of the letters `htbp` (where no letter is occurring more than once), optionally combined with an exclamation mark.
248 This means that the object will be a floating object.
249 The order of the letters makes no difference.
250 They have the following meanings:
251 \begin{itemize}
252 \item `h`: \LaTeX\ is allowed to place the object `h`ere, where it is defined.
253 \item `t`: \LaTeX\ is allowed to place the object at the `t`op of a page.
254 \item `b`: \LaTeX\ is allowed to place the object at the `b`ottom of a page.
255 \item `p`: \LaTeX\ is allowed to place the object on a separate `p`age only for floats.
256 \item `!`: \textcquote[page~27]{latex2e}{\LaTeX\ ignores the restrictions on both the number of floats that can appear and the relative amounts of float and non-float text on the page.}
257 \end{itemize}
258 \item \valdoc{H}: \LaTeX\ places the object exactly here, no matter how unfitting that may be.
259 In contrast to a single `h` or `h!` where the object is still a floating object which may float somewhere else if it does not fit here,
260 `H` means here and nowhere else.
261 `H` is defined by the \pkg{float} package which is loaded by this package automatically.
262 \item \valdoc{I}: \LaTeX\ places the object exactly here, considering the current line width and indentation.
263 `H` uses the full `\columnwidth`, just like a real float which floats here.
264 `I` respects the indentation of an `itemize`, shrinking the max used width to `\linewidth`.
265 This is a new placement defined by this package, using the code of `H` with two small changes.
266 `I` can only be used with the environments and commands defined by this package, it cannot be passed to a normal floating environment directly.
267 \item empty: do *not* pass the optional argument.
268 In this case the placement of the float can be changed using the `\floatplacement` command of the \pkg{float} package.
269 I have defined this key instead of advertising `\floatplacement` because `\floatplacement` does not allow the value~`H`.
270 \end{itemize}
271
272 \keydoc[initial value=`\centering`]{align = <code>}{storing key}
273 \TeX\ code which is inserted at the beginning of the `<type>` environment.
274 \keydoc[initial value=empty]{exec = <code>}{storing key} /
275 \keydoc{exec += <code>}{executed key}
276 \TeX\ code which is inserted at the beginning of the `<type>` environment before align.
277 Can be used to define a command for this object, see \cref{local-definitions-in-tables}.
278 \keydoc{graphic <option> = <value>}{unknown key handler}
279 \keylinktarget{graphic width}
280 \keylinktarget{graphic keepaspectratio}
281 Is applied to \cmd{\includegraphicobject} and \cmd{\includegraphicsubobject}.
282 Is ignored for other objects.
283
284 `<option>` can be any key which is unique to one of these two commands and any key allowed by the `\includegraphics` command (see \pkg{graphicx}\slash \pkg{graphbox} package).
285 Unlike `\setkeys{Gin}{<options>}` this works with all keys (compare \pkg{graphicx} documentation~\autocite[section~4.6]{graphicx}, unfortunately it's not getting more specific than \enquote{Most of the keyval keys}).
286
287 I am checking if the key is existing immediately but I cannot check the value (only whether it is required).
288 Therefore if you pass a wrong value the error message will not appear where you set this option but at the object where it is applied.
289
290 If you set `graphic width` globally and want to override it locally you can use `graphic width=!`.
291 This is a feature of the graphicx package but it is not well documented in it's documentation~\autocite{graphicx}.
292 (Which is why I am mentioning it here.)
293 The exclamation mark is mentioned for the `\resizebox` command.
294
295 \bigpar
296
297 \keydoc[initial value=empty]{env = <env>}{storing key}
298 The name of an additional inner environment in which the body is wrapped, e.g.\ `tabular`, \env{tabularx}, `tikzpicture`.
299 If empty the body is *not* wrapped in another environment (additional to object).
300
301 Please note that using this option can lead to difficult to find errors with confusing error messages
302 if you forget that you used it or it has a different value than you think it has.
303 In this case `show env args` may help you.
304
305 Please note that due to the way how environments are implemented in \LaTeX2 (this will change in \LaTeX3~\autocite{ltx3env})
306 it is not possible to check whether a given name is an environment or a command.
307 But if you pass something that is *not* defined you will get an error.
308
309 If you have loaded the \pkg{longtable} package (either with the package option \pkgoptn{longtable} or with a `\usepackage{longtable}`)
310 you can set the value of this key to \val{longtable}.
311 In that case the necessary changes are performed
312 so that the content of this object environment is set in a \env{longtable} environment
313 and does *not* float but can span across page breaks.
314 In this case `type`, `placement` and `align` are ignored.
315
316 \keydoc{<env> arg = <value>}{unknown key handler}
317 \keylinktarget{(<env>) arg(s) (+)}
318 \keylinktarget{(<env>) arg(s)}
319 \keylinktarget{tabularx arg+}
320 \keylinktarget{tabularx arg}
321 \keylinktarget{\detokenize{tabular* arg}}
322 \keylinktarget{tabular arg}
323 \NoDescribeKey{env arg}
324 The value is wrapped in braces and passed as argument to the additional inner environment if the value of `env` is not empty and `<env>` equals the value of `env`.
325 Arguments to this environment can be given as an argument to the `*object` environment as well but this key provides the possibility to pass arguments on a global level (or to override a globally passed argument).
326 For example this can be used to give all tabularx-tables a consistent width:
327
328 \begin{examplecode}
329 % in preamble
330 \objectset[table]{tabularx arg=.8\linewidth}
331
332 % in document
333 \begin{tableobject}{caption=Test Table, label=tab1, env=tabularx}{XX}
334 ...
335 \end{tableobject}
336 \end{examplecode}
337
338 \keydoc{<env> args = <value>}{unknown key handler}
339 Same like `<env> arg` except that the value is *not* wrapped in braces.
340 This can be used to pass several arguments or an optional argument.
341 Please not that this key cannot be used to pass exactly one undelimited argument consisting of more (or less) than one token because `\pgfkeys` (which I am using internally) strips several levels of braces.
342 \keydoc{arg = <value>}{unknown key handler}
343 If `env` has a non-empty value this is an abbreviation of `<env> arg` where `<env>` is the value of `env`.
344
345 Please note that because this key depends on the value of another key the order in which these two keys are given is important.
346
347 The value of `env` is considered when this key is evaluated.
348 If you use `\objectset[<styles>]{<options>}` (with it's optional argument) the processing of the keys is delayed but it makes some basic error handling already so that the line numbers are as fitting as possible.
349 For this error handling only the options passed to this call of the command are considered.
350 (Trying to consider previously set values correctly would make things more difficult because you might be applying these options to several styles at once where one might have `env` set and another not.)
351 Therefore the following causes an error message:
352
353 \begin{examplecode}
354 \objectset[table]{env=tabularx}
355 \objectset[table]{arg=.8\linewidth}
356 \end{examplecode}
357
358 While this would not:
359
360 \begin{examplecode}
361 \objectset{env=tabularx}
362 \objectset{arg=.8\linewidth}
363 \end{examplecode}
364
365 Anyway, I recommend to always use this option directly after `env` (if you intend to use it).
366 `env` and it's `args` belong together:
367
368 \begin{examplecode}
369 \objectset{env=tabularx, arg=.8\linewidth}
370 \end{examplecode}
371
372 \keydoc{args = <value>}{unknown key handler}
373 If `env` has a non-empty value this is an abbreviation of `<env> args` where `<env>` is the value of `env`.
374 The notes on error handling of the `arg` key apply to this key as well.
375 \keydoc{(<env>) arg(s) += <value>}{unknown key handler}
376 A plus sign can be appended to the key (patterns) `<env> arg`, `<env> args`, `args` and `arg`.
377 In that case a possibly previously passed argument is not overridden but this value is appended to it.
378 For example the following pattern allows to easily switch between tabular and tabularx tables on a global level:
379
380 \begin{examplecode}
381 % in preamble
382 \objectset[table]{tabularx arg=.8\linewidth, env=tabularx}
383 \newcolumntype{Y}{>{\raggedleft\arraybackslash}X}
384
385 % in document
386 \begin{tableobject}{caption=Test Table, label=tab1, tabular arg=lr, tabularx arg+=XY}
387 ...
388 \end{tableobject}
389 \end{examplecode}
390
391 \bigpar
392
393 \keydoc{first head = <code>}{storing key}
394 Is inserted at the beginning of the object (if `env` is non-empty: inside of the inner environment and after possibly specified `(<env>) arg(s)`).
395 If this is not given, `head` is used instead.
396 \keydoc{last foot = <code>}{storing key}
397 Is inserted at the end of the object (if `env` is non-empty: inside of the inner environment).
398 If this is not given, `foot` is used instead.
399 \keydoc[initial value=empty]{head = <code>}{storing key}
400 This value is used for `first head` if `first head` is not given.
401 If `env=longtable` this is the head after a pagebreak inside of the table.
402 \keydoc[initial value=empty]{foot}{storing key}
403 This value is used for `last foot` if `last foot` is not given.
404 If `env=longtable` this is the foot before a pagebreak inside of the table.
405 \keydoc{table head = <code>}{executed key}
406 This is a convenience key which sets `first head`, `last foot`, `head` and `foot`.
407 The value is the column headers without rules\slash lines and without the trailing `\\`.
408 \keydoc[initial value=`(to be continued)`]{table break text = <text>}{executed key}
409 A text put in the `foot` by `table head`.
410 \keydoc{table head style = <code>}{executed key}
411 Defines how `table head` fills out `first head`, `last foot`, `head` and `foot`.
412
413 Initial value:
414
415 \begin{examplecode}
416 {%
417 first head =
418 \toprule
419 #1 \\
420 \midrule,
421 head =
422 #1 \\
423 \midrule,
424 foot =
425 \midrule
426 \ifx\object@tableBreakText\@empty
427 \else
428 \multicolumn{\the\LT@cols}{r@\relax}{\object@tableBreakText}%
429 \fi,
430 last foot =
431 \bottomrule,
432 }
433 \end{examplecode}
434
435 (Note the curly braces which are required because the value contains commas and equal signs, see \cref{special-characters-in-options}.
436 `\the\LT@cols` is the number of columns of the longtable and `\object@tableBreakText` is the value of `table break text`.
437 Commands containing an @ in their name are internal commands and can only be used between `\makeatletter` and `\makeatother`, see also \autocite{texexchange_make_at}.)
438
439 \bigpar
440
441 \keydoc[initial value=`false`, default value=`true`]{show env args =? true | false}{boolean key}
442 Show the code which is assembled from the `env` and `(<env>) arg(s) (+)` keys before executing it.
443 See \cref{help}.
444 Please note that arguments may be given as additional arguments and not as `(<env>) arg(s) (+)` like in `\begin{tableobject}{env=tabular}{cl}`.
445 Such arguments are *not* shown by this key.
446 This key applies to subobjects as well.
447
448 \keydoc[initial value=`true`, default value=`true`]{warn no caption =? true | false}{boolean key}
449 Give a warning if \key{caption} is *not* given.
450 \keydoc[initial value=`true`, default value=`true`]{warn no label =? true | false}{boolean key}
451 Give a warning if `label` is *not* given.
452 \keydoc[initial value=`false`, default value=`true`]{warn other env =? true | false}{boolean key}
453 Give a warning when `<env> args` is given if `env` does not have the value `<env>` and the value of `env` is not empty.
454 This applies to subobjects as well.
455
456 The \cmd{\objectset} command if used with it's optional argument does not set the options immediately but stores them in different macros for different object styles.
457 Therefore if you change this value for certain styles this change does not affect following `\objectset` commands.
458 Without the optional style argument, however, the change takes effect immediately.
459
460 In order to avoid duplicates this warning is printed only where the key is passed by the user
461 and *not* where it is applied implicitly because of a previous `\objectset[<styles>]{<options>}`.
462
463 \keydoc[initial value=`false`, default value=`true`]{contains subobjects =? true | false}{boolean key} /
464 \keydoc{sub =? true | false}{forwarding key}
465 Specifies that this object contains subobjects, see \cref{subobject-environment}.
466 Is relevant only if `env` is set.
467 The value of `env` is applied to the subobjects instead of this object.
468 This is not executed immediately but only after all options have been processed so that you do not need to pay special attention to pass `env` before `contains subobjects`.
469
470 If this is *not* given (or more precisely: if this is false)
471 and the value of `env` is *not* empty I look ahead whether the object contains a subobject.
472 If I find a subobject I pretend you had passed this option and print a warning.
473 I insist on you explicitly passing this option because the lookahead does not work in all situations.
474 It ignores space and `\par` tokens but if there is any other token before the subobject,
475 for example a `\small` to fit two tables side by side which are a little too wide
476 (which may not be the best solution but an easy quick fix)
477 or a `\typeout` for debugging,
478 the lookahead does not find the subobject (possibly) resulting in unpredictable errors.
479 For example if you set `env=tabular` it will most likely complain about an \errormessage{Illegal pream-token}
480 or about a \errormessage{Missing number, treated as zero} with `env=tabular*` because the required arguments are missing.
481 \endkeydoc
482
483
484 All `(<env>) arg(s) (+)` options apply to subobjects as well.
485
486 Additionally the following options are passed through to the corresponding options of all subobjects inside of this object, they are all \keytype[forwarding key]{forwarding keys}.
487 \newcommand{\TargetKey}[2]{/subobject/\stripsubobject #2\relax}%
488 \def\stripsubobject subobject #1\relax{\stripoptplus{#1}}%
489 See \env{subobject} environment.
490 \forwardingkeydoc{subobject linewidth = <dimen>}
491 \forwardingkeydoc{subobject sep = <code>}
492 \forwardingkeydoc{subobject hor =? <code>}
493 \forwardingkeydoc{subobject hor sep (+)= <code>}
494 \forwardingkeydoc{subobject ver =? <code>}
495 \forwardingkeydoc{subobject ver sep (+)= <code>}
496 \forwardingkeydoc{subobject exec (+)= <code>}
497 \forwardingkeydoc{subobject env = <env>}
498 \forwardingkeydoc[target=/subobject/subcaptionbox]{subcaptionbox}
499 \forwardingkeydoc[target=/subobject/subcaptionbox inner pos]{subcaptionbox inner pos = c | l | r | s | <empty>}
500 \forwardingkeydoc[target=/subobject/subpage]{subpage}
501 \forwardingkeydoc[target=/subobject/subpage outer pos]{subpage outer pos = c | t | b | T | B | auto | Auto | auto-inverted | Auto-inverted | <empty>}
502 \forwardingkeydoc[target=/subobject/subpage height]{subpage height = <dimen>}
503 \forwardingkeydoc[target=/subobject/subpage inner pos]{subpage inner pos = c | t | b | s | <empty>}
504 \forwardingkeydoc[target=/subobject/subpage align]{subpage align = <code>}
505
506 \forwardingkeydoc{subobject warn no caption =? true | false}
507 \forwardingkeydoc{subobject warn no label =? true | false}
508 \endkeydoc
509 \endgroup
510
511 You can also define your own options as shown in \cref{custom-options}.
512
513
514 \subsubsection{`figureobject` environment}
515 \label{figureobject-environment}
516 \DescribeEnv{figureobject}
517 Is used for inserting figures.
518 Takes the same options like the \env{object} environment.
519 It differs in the following initial values:
520 \begin{itemize}
521 \item `type=figure`
522 \end{itemize}
523
524 \subsubsection{`tableobject` environment}
525 \label{tableobject-environment}
526 \DescribeEnv{tableobject}
527 Is used for inserting tables.
528 Takes the same options like the \env{object} environment.
529 It differs in the following initial values:
530 \begin{itemize}
531 \item `type=table`
532 \end{itemize}
533
534
535 \subsubsection{`subobject` environment}
536 \label{subobject-environment}
537 \begingroup
538 \keydocpath{/subobject}
539 \DescribeEnv{subobject}
540 To be used inside of an `*object` environment if you want to place several images\slash tables\slash whatever together.
541 See also \cmd{\includegraphicsubobject}.
542
543 I recommend to *not* put anything between the subobjects manually so that you can control their positioning with the `hor` and `ver` options.
544 (Spaces after a subobject are ignored but empty lines are not.)
545
546 Unlike the `object` environment, `\caption` and `\label` *cannot* be used inside of the subobject environment.
547 Use the \key{caption} and `label` options instead.
548
549 There are two different backends available, both provided by the \pkg{subcaption} package.
550 See the `subcaptionbox` and `subpage` keys.
551
552 The `subobject` environment has exactly one mandatory argument, a comma separated list of the following options.
553
554
555 The following options correspond to those of an `object`.
556 See \cref{object-environment}.
557 \newcommand{\TargetKey}[2]{/object/#2}%
558 \correspondingkeydoc{label = <label>}{storing key}
559
560 \correspondingkeydoc{caption = <text>}{storing key}
561
562 \correspondingkeydoc{list caption = <text>}{storing key}
563
564 (The \pkg{subcaption} package disables subcaptions in the list of figures\slash tables\slash whatever by default.
565 To enable them use `\captionsetup[sub]{list=true}`.)
566 \correspondingkeydoc{details = <text>}{storing key}
567
568 \correspondingkeydoc{details sep = <text>}{storing key}
569
570 \correspondingkeydoc{exec = <code>}{storing key} /
571 \correspondingkeydoc{exec += <code>}{executed key}
572
573 \correspondingkeydoc{graphic <option> = <value>}{unknown key handler}
574
575 (This key is completely useless.
576 It only has a meaning in the context of \cmd{\includegraphicsubobject} but there these options can be used directly without the prefix `graphic`.
577 I am allowing it anyway in order to support the same key like in \cmd{\objectset} which is supported by \cmd{\includegraphicobject} as well.)
578 \correspondingkeydoc{env = <env>}{storing key}
579
580 (See also the `contains subobjects` option of the \env{object} environment.)
581 \correspondingkeydoc{(<env>) arg(s) (+) = <value>}{unknown key handler}
582
583 (All values passed to the corresponding keys of the \env{object} environment apply to this option, too.)
584
585 \correspondingkeydoc{warn no caption =? true | false}{boolean key}
586
587 \correspondingkeydoc{warn no label =? true | false}{boolean key}
588
589 \forwardingkeydoc[target=/object]{warn other env =? true | false}
590
591 \forwardingkeydoc[target=/object]{show env args =? true | false}
592
593 \endkeydoc
594
595 The following options are unique for the `subobject` environment:
596 \keydoc[initial value=`.5\linewidth`]{linewidth = <dimen>}{storing key}
597 The horizontal space available for the subobject.
598 The content of the subobject is centered within this width.
599 If two subobjects displayed side by side have a small width they may appear too far apart from each other with the initial value.
600 Then you can decrease this value so that they come closer together.
601 (With `subcaptionbox` this value may be empty.
602 In that case the subobject takes as much space as it needs
603 and `\linewidth` inside of the subobject is the same like in the parent object.)
604
605 If you want to place more than two subobjects side by side you must decrease this value accordingly.
606 Keep in mind that you need to consider the width of `hor sep` as well if you changed it.
607
608 Dimensions can be given relative to other dimensions or in numbers.
609 Aside from absolute units like `pt` or `cm` \TeX\ also recognizes units relative to the current font size: `em` and `ex`.
610 For more information on dimensions see \mycite[chapter~10]{texbook} or \mycite[chapter~8]{texbytopic}.
611
612 \keydoc{sep = <code>}{storing key}
613 A separator which is inserted before each subobject except for the first subobject inside of the current parent object.
614
615 \keydoc[default value=empty]{hor =? <code>}{executed key}
616 Set the value of `sep` to the value of `hor sep` so that the subobjects are placed side by side.
617 If you pass a value the value will be appended to `sep` after setting it to `hor sep`.
618
619 Please note that options are only valid until the end of a group.
620 Therefore if you use this inside of a subobject it does *not* apply for the following subobject.
621 Instead use `subobject hor` on the parent object.
622
623 \keydoc[initial value=empty]{hor sep = <code>}{storing key} /
624 \keydoc{hor sep += <code>}{executed key}
625 The separator to be used if the subobjects are suppossed to be placed side by side.
626
627 Please note that `hor` must be used *after* setting this key, otherwise this option will not take effect.
628
629 \keydoc[default value=empty]{ver =? <code>}{executed key}
630 Set the value of `sep` to the value of `ver sep` so that the subobjects are placed below each other.
631 If you pass a value the value will be appended to `sep` after setting it to `ver sep`.
632
633 Please note that options are only valid until the end of a group.
634 Therefore if you use this inside of a subobject it does *not* apply for the following subobject.
635 Instead use `subobject ver` on the parent object.
636
637 \keydoc[initial value=`\par\bigskip`]{ver sep = <code>}{storing key} /
638 \keydoc{ver sep += <code>}{executed key}
639 The separator to be used if the subobjects are suppossed to be placed below each other.
640
641 Please note that `ver` must be used *after* setting this key, otherwise this option will not take effect.
642
643 \bigpar
644
645 \keydoc{subcaptionbox}{executed key}
646 The \pkg{subcaption} package provides several possibilities to insert subobjects.
647 This option tells the subobject environment to use the `\subcaptionbox` command instead of the `subfigure` or `subtable` environment, see option `subpage`.
648 (This key does *not* take a value.)
649
650 This option allows to pass an empty value to `linewidth`.
651 It can be useful if you have subobjects with a small width
652 so that you don't need to try different `subobject linewidth`s.
653 The example in \cref{subobjects-2} could be rewritten as following:
654
655 \inputexamplecode{../test/exp-subcaptionbox}
656
657 Note that this works only if the subobject captions are very short.
658 If they are wider than the content the line breaks which looks ugly.
659
660 If you want to use this option with `env=tabular` (or similar) you must pass the column specification with the option `arg=lr` (instead of as a separate argument).
661 Otherwise you will get the error message \errormessage{Package array Error: Illegal pream-token (\BODY): `c' used.}
662
663 This option is *not* compatible with `env=tabularx` and does *not* allow verbatim content inside of the subobject.
664 You can try to work around the verbatim limitation
665 (1)~by saving the problematic content in a macro before hand using commands such as `\urldef` from the \pkg{url} package,
666 (2)~by using commands which replace tokens such as `\mintinline` from the \pkg{minted} package (does not work with catcodes which do not produce tokens -- most importantly the comment character \formatchar\%),
667 (3)~by changing the problematic catcodes before the `subobject` (but you still need \emph{some} escape, begin group and end group characters in order to start and end the subobject -- but which do not need to be the default characters \formatchar\\, \formatchar\{ and \formatchar\}),
668 (4)~by defining a macro before hand under what ever catcode regime you want, you can even append contents from yet another catcode regime using the `\gappto` command from the \pkg{etoolbox} if you want.
669 If you want to learn more about catcodes (category codes) see \mycite[chapter~7]{texbook} or \mycite[chapter~2]{texbytopic}.
670 But the easier way is probably to use `subpage` instead -- that's why it's the initial backend.
671
672 \MakeLinkTarget{}
673 \label{exp:subcaptionbox-limitations}
674 \inputexamplecode{../test/exp-subcaptionbox-defverb}
675
676 `\NewDocumentCommand` is documented in~\autocite{usrguide}.
677
678 \keydoc{subcaptionbox inner pos = c | l | r | s | <empty>}{storing key}
679 The horizontal position of the content in the box.
680 Also allowed is any justification defined with `\DeclareCaptionJustification`
681 (see the \pkg{caption} package documentation).
682 An empty value means that this optional argument is
683 *not* passed to the `\subcaptionbox` command.
684 This option has no effect if `linewidth` is empty.
685 I discourage using this option because it destroys
686 the alignment of (sub)object and (sub)caption.
687
688 \bigpar
689
690 \keydoc{subpage}{executed key}
691 This is (after `subcaptionbox`) the second and initial backend for the `subobject` environment.
692 It uses the `subfigure`\slash `subtable` environment defined by the \pkg{subcaption} package.
693 (Since version 1.5 the \pkg{subcaption} package also provides the more generic `subcaptionblock` environment but this package still uses the old `subfigure` and `subtable` environments.
694 `subfigure` and `subtable` are nowadays specialized versions of `subcaptionblock` which have no other difference than that they produce if a warning if they are used with a different main object type.)
695 (This key does *not* take a value.)
696
697 The `subfigure` and `subtable` environments are minipages and take the same arguments
698 which can be set with `linewidth`, `subpage outer pos`, `subpage height` and `subpage inner pos`.
699 Both the content and the caption go inside of the minipage.
700
701 If the subobjects are placed next to each other this option requires that either the contents or the captions of the subobjects have the same height and that `subpage outer pos` is set accordingly.
702 Otherwise the captions will not be aligned.
703
704 \keydoc[initial value=`auto`]{subpage outer pos = c | t | b | T | B | auto | Auto | auto-inverted | Auto-inverted | <empty>}{storing key}
705 The vertical position of the minipage (containing both content and caption) on the baseline.
706
707 Additionally to the values `t`, `c` and `b` supported by the minipage environment
708 the \pkg{subcaption} package v1.2 adds the allowed values `T` and `B`
709 and this key also allows the values `auto`, `Auto`, `auto-inverted`, `Auto-inverted` and empty.
710
711 While `t` and `b` align the top\slash bottom *baseline* of the content
712 `T` and `B` align the very top\slash bottom of the content.
713
714 `c` aligns the center of the content.
715
716 `auto` means `t` if the caption is displayed at the top
717 or `b` if the caption is displayed at the bottom
718 so that the captions are aligned if the \emph{captions} have the same height.
719
720 `auto-inverted` means `b` if the caption is displayed at the top
721 or `t` if the caption is displayed at the bottom
722 so that the captions are aligned if the \emph{contents} have the same height
723 (although the height of the top most row does not count in this regard so `auto-inverted` is also good for graphics with different heights).
724
725 `Auto` and `Auto-inverted` behave like their lower case versions but use `T`/`B` instead of `t`/`b`.
726
727 If content and captions have different heights `auto-inverted` gives good results for `\includegraphicsubobject`.
728 For tables `subcaptionbox` is required to align the caption (but note the limitations regarding verbatim content).
729 If `subcaptionbox` does not work for you you can try `subpage outer pos = c` or giving the shorter caption the same height with `\\~` and then using `subpage outer pos = auto`.
730
731 If a subobject has neither caption nor label `auto` may not work as expected.
732 Instead `Auto` can be used which is based on `T` and `B` instead of `t` and `b`.
733 Note that `Auto` requires version 1.2 or newer of the \pkg{subcaption} package.
734
735 Empty is equivalent to `c`.
736
737 Except for the values which are added by this package (e.g.\ `auto` and `auto-inverted`)
738 all other values are passed through to the `subfigure`/`subtable` environment which silently ignores invalid values.
739
740
741 \keydoc[initial value=empty]{subpage height = <dimen>}{storing key}
742 The height of the minipage.
743 An empty value means that this optional argument is
744 *not* passed to the `subfigure`\slash `subtable` environment.
745
746 Dimensions can be given relative to other dimensions or in numbers.
747 Aside from absolute units like `pt` or `cm` \TeX\ also recognizes units relative to the current font size: `em` and `ex`.
748 For more information on dimensions see \mycite[chapter~10]{texbook} or \mycite[chapter~8]{texbytopic}.
749
750 \keydoc[initial value=empty]{subpage inner pos = c | t | b | s | <empty>}{storing key}
751 The vertical position of the content on the minipage.
752 Empty means that this optional argument is
753 *not* passed to the `subfigure`\slash `subtable` environment.
754 This option has no effect if `subpage height` is empty.
755
756 \keydoc[initial value=`\centering`]{subpage align = <code>}{storing key}
757
758 \TeX\ code which is inserted at the beginning of the `subfigure`\slash `subtable` environment.
759 \endkeydoc
760
761 If you want to change the numbering of subobjects please refer to the \pkg{subcaption} package documentation~\autocite[section~5 \sectionname{The `\DeclareCaptionSubType` command}]{subcaption}.
762 The \pkg{subcaption} package is loaded automatically by this package.
763 \endgroup
764
765
766 \subsection{Commands}
767 \label{commands}
768
769 In this section I am describing the commands defined by this package.
770
771
772 \subsubsection{`\includegraphicobject` command}
773 \label{includegraphicobject-command}
774 \begingroup
775 \keydocpath{/graphicobject}
776 \DescribeMacro{\includegraphicobject}
777 `\includegraphicobject{<filename>}` \\
778 `\includegraphicobject[<options>]{<filename>}` \\
779 `\includegraphicobject[<style>][<options>]{<filename>}`
780
781 Is used for inserting graphics from a different file.
782 It is very similar to \pkg{graphicx}' `\includegraphics` command, except that the graphic is automatically set in a \env{figureobject} environment.
783 You can change this by setting the object style with \cmd{\graphicobjectstyle} or an additional optional argument given *before* the usual optional argument.
784 The mandatory argument is the same: The name of the graphics file to include *without* the file extension.
785 The optional argument accepts---aside from all the options defined by \pkg{graphicx}\slash \pkg{graphbox}---also all options of the \env{figureobject} environment.
786 Additionally there are the following unique options:
787 \keydoc[initial value=`true`, default value=`true`]{auto caption =? true | false}{boolean key}
788 If no \key{caption} is given the file name is used as caption.
789 All underscores in the file name are replaced by `\textunderscore`.
790 This option is intended to be used on a global level but works in the optional argument of this command as well.
791 \keydoc[initial value=`false`, default value=`true`]{auto caption strip path =? true | false}{boolean key}
792 If `auto caption` is true and the file name is used as caption
793 a possibly leading path is stripped (everything before and including the last slash in `<filename>`).
794 This is initially false because I am assuming that in most cases where the path should not be displayed `\graphicspath{{path/}}` would be used.
795 \keydoc[initial value=`true`, default value=`true`]{auto label =? true | false}{boolean key}
796 \keylinktarget{/object/graphic auto label}
797 If no `label` is given the file name is used as label.
798 This option is intended to be used on a global level but works in the optional argument of this command as well.
799 \keydoc[initial value=`false`, default value=`true`]{auto label strip path =? true | false}{boolean key}
800 If `auto label` is true and the file name is used as label
801 a possibly leading path is stripped (everything before and including the last slash in `<filename>`).
802 This is initially false because I am assuming that in most cases where the filename without path is unique `\graphicspath{{path/}}` would be used.
803 \keydoc[initial value=`<empty>`]{auto label prefix = <prefix>}{storing key}
804 \keylinktarget{/object/graphic auto label prefix}
805 If `auto label` is true and the file name is used as label
806 prepend `<prefix>` to the label.
807 \keydoc[initial value=`true`, default value=`true`]{warn env =? true | false}{boolean key}
808 Give a warning if `env` is not empty.
809 \keydoc[initial value=`true`, default value=`true`]{no env =? true | false}{boolean key}
810 Reset `env` to an empty value.
811 This happens after evaluating `warn env`.
812 \keydoc[initial value=`<empty>`]{before graphic = <code>}{storing key}
813 Arbitrary \TeX\ code to be inserted before the `\includegraphics`.
814 \keydoc[initial value=`<empty>`]{after graphic = <code>}{storing key}
815 Arbitrary \TeX\ code to be inserted after the `\includegraphics`.
816 \endkeydoc
817
818 You may not use this command inside of an `*object` environment.
819 Otherwise you will get an \errormessage{object environment may not be nested} error.
820 See also \cmd{\includegraphicsubobject}.
821 \endgroup
822
823 \subsubsection{`\includegraphicsubobject` command}
824 \label{includegraphicsubobject-command}
825 \DescribeMacro{\includegraphicsubobject}
826 `\includegraphicsubobject{<filename>}` \\
827 `\includegraphicsubobject[<options>]{<filename>}`
828
829 To be used if you want to place several graphics from different files in one object.
830
831 It takes the same options like \cmd{\includegraphicobject} except that it takes options for the \env{subobject} environment instead of options for the `object` environment.
832 Also it does *not* take the optional `<style>` argument.
833
834 You may not use this command outside of an `*object` environment.
835 Otherwise you will get a \errormessage{subobject environment may not be used outside of an object} error.
836 See also \cmd{\includegraphicobject}.
837
838
839 \subsubsection{`\splitobject` command}
840 \label{splitobject-command}
841 \DescribeMacro{\splitobject}
842 `\splitobject`
843
844 This can be used inside of an `object` environment which is too big to fit on one page.
845 It splits an object so that it can be broken across pages.
846 This command must be used directly inside of the object,
847 it cannot be used inside of subgroups/environments inside of the object.
848 It uses the `\ContinuedFloat` command defined by the \pkg{caption} package.
849 See the example in \cref{split-object-example}.
850
851 The `label` is placed on the first part of the object.
852 If you want to specify the second part of the object you can use the `\label{<second-label>}` command after `\splitobject`.
853
854
855 \subsubsection{Setting options globally}
856 \label{setting-options-globally}
857
858 \DescribeMacro{\objectset}
859 `\objectset{<options>}` \\
860 `\objectset[<styles>]{<options>}`
861
862 Sets the passed options for all following objects until the end of the current group.
863 All options of the \env{object} environment are allowed.
864
865 A comma separated list of styles or style groups can be given in an optional argument.
866 In that case the options are not set immediately but appended to the specified style(s).
867 The options are set locally for any following object of the specified style(s) in the same group.
868 Although setting the options is delayed the options are checked immediately so that error messages and warnings point to the line where the option is specified in the code, not where it is technically set.
869 (In order for that to work properly it is important that options are specified with the key name only and not with the full path, see \cref{key-name-vs-key-path}.)
870 However, the value can usually *not* be checked immediately, only whether it is required or not.
871 Therefore if you pass a wrong value the error message will not appear where you set this option but at the object where it is applied.
872 An exception is the key `env` where the value is checked immediately for plausibility whether it might be the name of an environment.
873
874 If `<styles>` is empty or an empty group the options are not applied.
875 No error or warning is printed.
876
877 There is a style group called `all` which all styles belong to.
878 `\objectset{<options>}` and `\objectset[all]{<options>}` are mostly equivalent
879 except that the former (without optional argument) is more efficient because it sets the options immediately
880 and the latter (with the optional argument given) is able to override options set for a style.
881
882
883 \DescribeMacro{\graphicobjectstyle}
884 `\graphicobjectstyle{<style>}` can be used to change the object style used by \cmd{\includegraphicobject}.
885 For example, if you have a single table in a file called \filename{catcodes.pdf} you can insert it as following.
886 Alternatively, you can use the optional `<style>` argument.
887
888 \begin{examplecode}
889 \begingroup
890 \graphicobjectstyle{table}
891 \includegraphicobject[caption=Catcodes]{catcodes}
892 \endgroup
893 \end{examplecode}
894
895
896 \DescribeMacro{\graphicspath}
897 `\graphicspath{{path/}}`: see \pkg{graphicx} package documentation~\autocite[section~4.5]{graphicx}.
898
899
900 \subsubsection{New object styles and types}
901 \label{new-object-styles-and-types}
902
903 This section explains how to define a new object `<style>` in the sense of \cref{styles}.
904 It is *not* about how to define a new `<floatstyle>` which can be used as value for the `float style` key.
905 Examples are given in \cref{new-object-style-tikzobject} and \cref{exp:new-object-type}.
906
907 \DescribeMacro{\NewObjectStyle}
908 `\NewObjectStyle{<style>}{<options>}`
909 defines a new environment called `<style>object` analogous to `figureobject` and `tableobject`.
910 `<options>` are set for the new object style as if you had used `\objectset[<style>]{<options>}`.
911 You must always specify the `type`.
912 If this package is loaded without `allowstandardfloats`
913 the float environment which is passed to `type` is redefined to issue a warning that `<style>object` should be used instead.
914 This warning should not influence the environment's usual behavior.
915 If the float environment was already passed as `type` to a previous call of `\NewObjectStyle` it is not redefined again but `<style>object` is appended to the list of replacement suggestions.
916
917 If you define a new object style you may also want to define a new float type.
918 The \pkg{float} package (which is automatically loaded by this package) defines the following command for doing so:
919
920 \DescribeMacro{\newfloat}
921 `\newfloat{<type>}{<placement>}{<ext>}[<within>]`
922 \begin{itemize}
923 \item `<type>` is the floating environment to be defined.
924 This value is also used as the float name which is displayed in front of the caption, therefore it should be capitalized.
925 Alternatively the name can be changed using `\floatname{<type>}{<name>}`.
926 \item `<placement>` is the value to be used if the `placement` key is not given (or has an empty value).
927 This is initially `tbp` for the standard float types.
928 \item `<ext>` is the extension of a file used to save the list of `<type>`s.
929 This is `lof` (list of figures) for `type=figure` and `lot` (list of tables) for `type=table`.
930 This file extension should be unique.
931 \item `<within>` is a counter whose value is prepended to the `<type>` counter. The `<type>` counter is reset every time the `<within>` counter is incremented.
932 \item Make sure an appropriate default float style is active when using `\newfloat`.
933 The default float style can be activated using `\floatstyle{<floatstyle>}`, see the \pkg{float} package documentation~\autocite{float}.
934 It should be `plain` for something like an image or `plaintop` for something like a table.
935 The reasoning is explained in~\autocite{texexchange_caption_position}.
936 Alternatively you can specify the float style using the `float style` key in the `<options>` of `\NewObjectStyle`.
937 \end{itemize}
938
939 \DescribeMacro{\crefname}
940 \DescribeMacro{\Crefname}
941 If you are using the \pkg{cleveref} package (which I recommend you do) you also need to tell it how to reference the new float type with `\crefname{<type>}{<singular>}{<plural>}`.
942 If you want an abbreviation in the middle of a sentence but the full word at the beginning of the sentence you specify the beginning of the sentence with `\Crefname` and the middle of the sentence with `\crefname`.
943
944 `\NewObjectStyle` automatically defines the corresponding environment needed for `subobject` if possible, i.e.\ if the \pkg{caption} package is new enough.
945 If the \pkg{caption} package is older than August~30, 2020 and you want to use subobjects you need to define the subtype manually by putting the following line *before* loading this package \autocite{texexchange_subtype_workaround}:
946 \begin{examplecode}
947 \AtBeginDocument{\DeclareCaptionSubType{<type>}}
948 \end{examplecode}
949
950 \DescribeMacro{\trivfloat}
951 The \pkg{trivfloat} package provides the `\trivfloat{<type>}` command which is an easier alternative to `\newfloat`.
952 If you use it you should be aware that it does not define the new float type environment immediately but at `\begin{document}`.
953 This does *not* affect `\NewObjectStyle` (you can still use it directly afterwards)
954 but it means that the float style active at `\begin{document}` is applied and not the float style active at `\trivfloat`.
955 Therefore I recommend to pass the `float style` option to `\NewObjectStyle`,
956 then it does not matter which float style was active when the float type was defined because it is restyled before each use of an object where this option applies.
957 `\trivfloat` must be used before `\AtBeginDocument{\DeclareCaptionSubType{<type>}}`.
958
959 \DescribeMacro{\DeclareFloatingEnvironment}
960 The \pkg{newfloat} package provides the `\DeclareFloatingEnvironment[<options>]{<type>}` command which is a newer alternative to `\newfloat` and `\trivfloat`.
961 With it's key=value options it is more intuitive than `\newfloat` and more flexible than `\trivfloat`.
962 Unlike `\newfloat` and `\trivfloat` it automatically capitalizes `<type>` before using it as float name.
963 It seems to ignore `\floatstyle` so you need to specify that in the options.
964 The \pkg{newfloat} package is written by the same author like the \pkg{subcaption} package so you don't need to worry about defining subtypes manually.
965
966
967 \subsubsection{New object style groups}
968 \label{new-object-style-groups}
969
970 Several object styles can be combined to a group.
971 You can set options for all styles contained in a group using `\objectset[<group>]{<options>}`.
972
973 \DescribeMacro{\NewObjectStyleGroup}
974 `\NewObjectStyleGroup{<group>}{<styles*>}`
975 defines a new style group consisting of the styles `<styles*>`.
976 `<styles*>` is a comma separated list of styles.
977 In contrast to `<styles>` it may *not* contain style groups.
978
979 \DescribeMacro{\AddObjectStyleToGroup}
980 `\AddObjectStyleToGroup{<group>}{<style>}`
981 adds an existing style to an existing group.
982
983
984 \subsubsection{Hooks}
985 \label{hooks}
986
987 This package provides several commands similar to `\AtBeginDocument`
988 which take one argument, \TeX\ code which is executed at a later point in time.
989
990
991 \DescribeMacro{\AtBeginObject}
992 `\AtBeginObject{<code>}`
993 runs `<code>` every time at the begin of an \env{object} environment
994 (including \env{figureobject}, \env{tableobject} and \cmd{\includegraphicobject}).
995 This hook is inside of the group but before any options are processed.
996
997 \DescribeMacro{\AtBeginSubobject}
998 `\AtBeginSubobject{<code>}`
999 runs `<code>` every time at the begin of a \env{subobject} environment
1000 (including \cmd{\includegraphicsubobject}).
1001 This hook is inside of the group but before any options are processed.
1002
1003 \DescribeMacro{\AtBeginGraphicObject}
1004 `\AtBeginGraphicObject{<code>}`
1005 runs `<code>` every time in \cmd{\includegraphicobject} and \cmd{\includegraphicsubobject}.
1006 This hook is after the object\slash subobject hook but before any options are processed.
1007
1008 \DescribeMacro{\AtEndObject}
1009 `\AtEndObject{<code>}`
1010 runs `<code>` every time at the end of an \env{object} environment
1011 (including \env{figureobject}, \env{tableobject} and \cmd{\includegraphicobject}).
1012 This hook is after a potential `env` has been closed but before the caption and label are processed.
1013 (Yes, caption and label are always processed in `\end` even if the caption is displayed above the float.
1014 The \pkg{float} package is responsible for putting the caption where it belongs.)
1015
1016
1017 \subsection{Initialization}
1018 \label{initialization}
1019
1020 This package uses the \pkg{float} package to restyle \env{table} to `plaintop` and `figure` to `plain`
1021 so that captions of tables appear always above the table and captions of figures always below the figure.
1022 The reasoning is explained in~\autocite{texexchange_caption_position}.
1023 If you really want to place captions differently you can do that with `\restylefloat` (see \pkg{float} package documentation~\autocite{float}) or by setting the `float style` option.
1024 However, I would advice to rethink why you would want to do that.
1025
1026 Unless this package is loaded with the \pkgoptn{allowstandardfloats} option
1027 it redefines the \env{table} and `figure` environments to issue a warning if they are used directly.
1028 This warning should not influence their usual behavior, though.
1029 Instead of \env{table}\slash `figure` you should use \env{tableobject}\slash \env{figureobject} or \cmd{\includegraphicobject},
1030 otherwise this package cannot help you.
1031
1032 Unless this package is loaded with the \pkgoptn{nographic} option
1033 it loads the \pkg{graphicx} package in order to include graphics.
1034 This also guarantees that the paper size of the generated pdf matches \LaTeX' point of view (instead of depending on the system settings).~\autocite{texexchange_papersize}
1035
1036 Unless this package is loaded with the \pkgoptn{noarray} option
1037 it loads the \pkg{array} package which defines additional column specification features like `>{<prefix>}`, `<{<suffix>}` and `!{<addcolsep>}`
1038 and the `\newcolumntype{<col>}[<args>]{<spec>}` command.
1039 It also changes the implementation of how lines (rules) are drawn
1040 but that is irrelevant if you use the recommendations given in the \pkg{booktabs} package documentation~\autocite[section~2 \sectionname{The layout of formal tables}]{booktabs}.
1041 Loading the \pkg{array} package is merely for convenience. This package does not use any of it's features.
1042
1043 Unless this package is loaded with the \pkgoptn{nobooktabs} option
1044 it loads the \pkg{booktabs} package which defines commands for formatting tables, most importantly `\toprule`, `\midrule` and `\bottomrule`.
1045 These are used by the `table head` key unless you redefine it using `table head style`.
1046
1047 Other packages loaded by this package are listed in \cref{used-packages}.
1048
1049
1050 \subsection{Package options}
1051 \label{package-options}
1052
1053 The package options are implemented using the standard \LaTeX\ package options handling functionality as described in~\autocite{clsguide}.
1054 Therefore they do *not* take any values but consist of keys only.
1055 Instead I usually provide two separate keys, one which enables an option and another which disables the option.
1056 The keys with a~\radioon\ are active by default and the keys with a~\radiooff\ are inactive by default.
1057
1058 \pkgoptndoc*{graphicx} use the \pkg{graphicx} package as backend for \cmd{\includegraphicobject}.
1059 \pkgoptndoc{graphbox} use the \pkg{graphbox} package as backend for \cmd{\includegraphicobject}.
1060 \pkgoptndoc{nographic} do not load \pkg{graphicx} or \pkg{graphbox}.
1061 If you use this option the commands \cmd{\includegraphicobject} and \cmd{\includegraphicsubobject} are not defined.
1062
1063 Warning: Without driver specific packages like \pkg{graphicx}, \pkg{geometry} or \pkg{hyperref} the paper size of the resulting pdf depends on the system settings, independent of what you set in \LaTeX. \autocite{texexchange_papersize}
1064
1065 \pkgoptndoc*{array} load the \pkg{array} package.
1066 There is no difference between using this package option or a separate `\usepackage{array}`.
1067 \pkgoptndoc{noarray} do *not* load the \pkg{array} package.
1068
1069 \pkgoptndoc*{booktabs} load the \pkg{booktabs} package.
1070 There is no difference between using this package option or a separate `\usepackage{booktabs}`.
1071 \pkgoptndoc{nobooktabs} do *not* load the \pkg{booktabs} package.
1072 Please note that the `table head` key initially relies on the booktabs package.
1073 If you want to use it with this package option you need to redefine it with `table head style`.
1074 Please read sections 1 and~2 of the \pkg{booktabs} documentation~\autocite{booktabs} before deciding against \pkg{booktabs}.
1075
1076 \pkgoptndoc{longtable} load the \pkg{longtable} package.
1077 There is no difference between using this package option or a separate `\usepackage{longtable}`.
1078 \pkgoptndoc*{nolongtable} do *not* load the \pkg{longtable} package.
1079
1080 \pkgoptndoc{allowstandardfloats} do not redefine the \env{table} and `figure` environments.
1081 Without this option they are redefined to issue a warning if they are used directly.
1082 This warning should not influence their usual behavior.
1083 Instead of \env{table}\slash `figure` you should use \env{tableobject}\slash \env{figureobject} or the command \cmd{\includegraphicobject},
1084 otherwise this package cannot help you.
1085 \endpkgoptndoc
1086
1087
1088 \subsection{Help}
1089 \label{help}
1090
1091 If you get an error message and don't understand where it comes from
1092 or the output is different from what you expected
1093 the following features may give you a better understanding of what this package is doing.
1094 These features are based on the \TeX\ primitive `\show`.
1095
1096 \DescribeMacro{\show}
1097 `\show` shows (among other information) the parameter text and the replacement text of a macro on the terminal and in the log file.
1098 If you use one of the following features you most likely want to know the replacement text which is the part between `->` and the last `.` on the line.
1099 In errorstopmode mode (i.e.\ without `--interaction=nonstopmode` which most IDEs pass by default) \TeX\ stops after `\show` and waits until you confirm that you have read the information and it may proceed by pressing enter.
1100 For more information see \mycite[section~34.1]{texbytopic}.
1101
1102 \DescribeHandler{.show value}
1103 The `.show value` handler can be used to show the value of a \keytype{storing key}
1104 (see \pkg{pgfkeys} documentation~\autocite[section~87.4.9 \sectionname{Handlers for Key Inspection}]{tikz}).
1105 For example:
1106
1107 \begin{examplecode}
1108 \includegraphicsubobject[sep/.show value]{<filename>}
1109 \end{examplecode}
1110
1111 \DescribeHandler{.show boolean}
1112 This package also defines a new handler called `.show boolean` which can be used to show the value of a \keytype{boolean key}.
1113 For example:
1114
1115 \begin{examplecode}
1116 \objectset{warn other env/.show boolean}
1117 \end{examplecode}
1118
1119 \DescribeMacro{\ShowObjectStylesInGroup}
1120 `\ShowObjectStylesInGroup{<group>}` shows all object styles which are contained in the given group.
1121 The styles are wrapped in curly braces so that I can iterate over them with the \LaTeX\ command `\@tfor`.
1122
1123 \DescribeMacro{\ShowObjectStyleOptions}
1124 `\ShowObjectStyleOptions{<style>}` shows the options set for a specific style.
1125 Please note that this does *not* show directly set options (i.e.\ options set by `\objectset` without the optional argument and options in the options argument of the object).
1126
1127 \DescribeKey{show env args}
1128 See also the `show env args` key of the \env{object} and \env{subobject} environments.