• No results found

The capt-of package Robin Fairbairns

N/A
N/A
Protected

Academic year: 2021

Share "The capt-of package Robin Fairbairns"

Copied!
2
0
0

Bezig met laden.... (Bekijk nu de volledige tekst)

Hele tekst

(1)

The capt-of package

Robin Fairbairns

January 22, 2010

1

Why this package?

LATEX provides a command (\caption) for adding a caption to a float environment

(that is to say, a figure or a table, “out of the box”).

The command is a good one, and many users want to use it. Often, they end up using a float environment, in a case where it’s not strictly necessary, and get entangled in the positioning problems that floats pose for the innocent user. Using this package, the user can have standard-looking captions without the need of a float environment.

This package defines an alternative command, \captionof, which sets things up so that \caption will work outside of a float.

The float package provides an alternative to \captionof, in the float [H] option (“place the environment here without doing any of this floating stuff”). So why use capt-of? — its great advantage is simplicity; you load it, and it defines one macro, while float defines lots and lots. (Of course, if you need others of float’s capabilities, capt-of loses its advantage...).

2

The potential problem

\captionof defines a caption in text; it also steps the figure (or table or what-ever) counter. The float environments do the same.

Now, consider the sequence: <earlier text> \begin{figure} <figure stuff> \caption{...} \end{figure} ... <intervening text> ...

<inline figure stuff> ∗Email: rf10@cam.ac.uk

(2)

\captionof{figure}{...}

and suppose the figure environment doesn’t fit anywhere between where it’s specified and the inline figure (so that it will float to somewhere later).

We will then see a document with hearlier text i

. . .

hintervening text i . . .

hinline figure stuff i Figure hn+1 i: . . . . . .

hyet more text i . . .

hfigure stuff i Figure hni: . . .

That is, the figure numbers have got out of order, because the floating figure was specified before the inline figure.

LATEX won’t do this when everything is specified as a float: it keeps floats of

the same type in order (which is why floats stack up if a single one won’t fit). The moral of that little tale is to say: don’t use \captionof and floats of the same type in the same document. (Or be extra-specially careful about what’s happening if you must.)

3

The code (such as it is)

\captionof Usage: \captionof{htypei}[hmovei]{hcaptioni}

type is ‘figure’ or ‘table’ (or some type you’ve defined with the float package) move is the optional moving argument of \caption (the thing that goes to the

list of tables/figures) caption is the text of the caption

It’s probably best to use \captionof within an enclosing group (e.g., \begin{hcenter i} figure \captionof{figure}{hblah blahi} \end{hcenter i})

1\newcommand\captionof[1]{\def\@captype{#1}\caption}

2\endinput

3h/packagei

Referenties

GERELATEERDE DOCUMENTEN

However, remember that texsurgery is a python project whose main focus is on evaluating code inside a jupyter kernel, and this is only achieved by installing the python package

The package xskak has two internal commands which are used to set up the start moves of games and to retrieve the stored move data, and \chessboard has two keys that set move data

For example, the code point U+006E (the Latin lowercase ”n”) followed by U+0303 (the combining tilde) is defined by Unicode to be canonically equivalent to the single code point

The default values for the items in the \paperref environment are the following command punctation begin commands end commands.. \by ,

The EASYBMAT package is a macro package for supporting block matri- ces having equal column widths or equal rows heights or both, and support- ing various kinds of rules (lines)

The package EASYEQN introduces some equation environments that sim- plify the typesetting of equations.. It uses a syntax similar to the array envi- ronment to define the

The EASYMAT package is a macro package for supporting block matrices having equal column widths or equal rows heights or both, and supporting various kinds of rules (lines) between

The EASYTABLE package is a macro package for writing tables, with equal column widths or equal rows heights or both, with various kinds of rules (lines) between rows and columns..