\begin{preview}...\end{preview}
preview
environment causes its contents to
be set as a single preview image. Insertions like figures and
footnotes (except those
included in minipages) will typically lead to error messages or
be lost. In case the preview
package has not been activated, the
contents of this environment will be typeset normally.
\begin{nopreview}...\end{nopreview}
nopreview
environment will cause its
contents not to undergo any special treatment by the preview
package. When preview
is active, the contents will be discarded
like all main text that does not trigger the preview
hooks. When
preview
is not active, the contents will be typeset just like the
main text.
Note that both of these environments typeset things as usual when
preview is not active. If you need something typeset conditionally,
use the \ifPreview
conditional for it.
\PreviewMacro
\includegraphics
(actually, this is what is done by the
graphics
option to preview
) produce a preview image, you put a
declaration like
\PreviewMacro[*[[!]{\includegraphics}
or, more readable,
\PreviewMacro[{*[][]{}}]{\includegraphics}
into your preamble. The optional argument to \PreviewMacro
specifies the arguments \includegraphics
accepts, since this is
necessary information for properly ending the preview box. Note that
if you are using the more readable form, you have to enclose the
argument in a [{
and }]
pair. The inner braces are necessary to
stop any included []
pairs from prematurely ending the optional
argument, and to make a single {}
denoting an optional argument not
get stripped away by TeX's argument parsing.
The letters simply mean
*
*
modifier, as in
\includegraphics*
.
[
[]
!
{}
?
delimiter{true case}{false case}
@
{literal sequence}
There is a second optional argument in brackets that can be used to
declare any default action to be taken instead. This is mostly for
the sake of macros that influence numbering: you would want to keep
their effects in that respect. The default action should use #1
for referring to the original (not the patched) command with the
parsed options appended. Not specifying a second optional argument
here is equivalent to specifying [#1]
.
\PreviewMacro*
\PreviewMacro*
simply throws the macro and
all of its arguments declared in the manner above away. This is
mostly useful for having things like \footnote
not do their
magic on their arguments. More often than not, you don't want to
declare any arguments to scan to \PreviewMacro*
since you would
want the remaining arguments to be treated as usual text and typeset in
that manner instead of being thrown away. An exception might be,
say, sort keys for \cite
.
A second optional argument in brackets can be used to declare any
default action to be taken instead. This is for the sake of macros
that influence numbering: you would want to keep their effects in
that respect. The default action might use #1
for referring to the
original (not the patched) command with the parsed options appended.
Not specifying a second optional argument here is equivalent to
specifying []
since the command usually gets thrown away.
As an example for using this argument, you might want to specify
\PreviewMacro*\footnote[{[]}][#1{}]
This will replace a footnote by an empty footnote, but taking any
optional parameter into account, since an optional paramter changes
the numbering scheme. That way the real argument for the footnote
remains for processing by preview-latex (the actual definition is
more complicated in order not to change the numbering in case of
optional arguments being present).
\PreviewEnvironment
\PreviewEnvironment
works just as
\PreviewMacro
does, only for environments.
\PreviewEnvironment*
\PreviewEnvironment*
as compared to \PreviewMacro*
.
\PreviewSnarfEnvironment
\PreviewOpen
\PreviewClose
\begin
and \end
of an environment. It
is essential for the operation of \PreviewOpen
that the macro
treated with it will open an additional group even when the preview
falls inside of another preview or inside of a nopreview
environment. Similarly, the macro treated with PreviewClose
will close an environment even when inactive.
\ifPreview
preview
is active, you can use the conditional \ifPreview
together with
\else
and \fi
.