The package is included with the customary
\usepackage[options]{preview}
You should usually load this package as the last one, since it redefines several things that other packages may also provide.
The following options are available:
active
preview
package will be inactive and the document
will be typeset as if the preview
package were not loaded,
except that all declarations and environments defined by the
package are still legal but have no effect. This allows defining
previewing characteristics in your document, and only activating
them by calling LaTeX as
latex '\PassOptionsToPackage{active}{preview} \input{filename}'
noconfig
preview
package gets activated. prdefault.cfg is
supposed to contain definitions that can cater for otherwise bad
results, for example, if a certain document class would otherwise
lead to trouble. It also can be used to override any settings
made in this package, since it is loaded at the very end of it.
In addition, there may be configuration files specific for certain
preview
options like auctex
which have more immediate needs.
The noconfig
option suppresses loading of those option files,
too.
psfixbb
psfixbb
will include /dev/null as a graphic file in the ultimate upper
left and lower right corner of the previewed box. This will make
Dvips generate an appropriate bounding box.
dvips
pdftex
tightpage
option.
displaymath
floats
\PreviewSnarfEnvironment
command on the floats you want to
have previewed.
textmath
\(
, \)
and $
and the math
environment (apparently some people use
that). Only occurences of these text math delimiters in later
loaded packages and in the main document will thus be affected.
graphics
\includegraphics
commands
to a preview.
sections
delayed
preview
package makes until \
begin{document}
. The purpose
of this is to cater for documents which should be subjected to the
preview
package without having been prepared for it. You can
process such documents with
latex '\RequirePackage[active,delayed,options]{preview} \input{filename}'
This relaxes the requirement to be loading the preview
package
as last package.
auctex
You should not specify this option manually, since it will only be
needed by automated runs that want to parse the pseudo error
messages. Those runs will then use \PassOptionsToPackage
in
order to effect the desired behaviour. In addition,
prauctex.cfg will get loaded unless inhibited by the noconfig
option. This caters for the most frequently encountered
problematic commands.
showlabels
showkeys
package, and there is also the
less encompassing showlabels
package. Unfortunately, since
those go to some pain not to change the page layout and spacing,
they also don't change preview
's idea of the TeX dimensions of
the involved boxes. So if you are using preview
for determing
bounding boxes, those packages are mostly useless. The option
showlabels
offers a substitute for them.
tightpage
preview
as graphic images for some other application. One
possibility is to generate a flurry of EPS files with
dvips -E -i -Pwww -o outputfile.000 inputfile
However, in case those are to be processed further into graphic image files by GhostScript, this process is inefficient since all of those files need to be processed one by one. In addition, it is necessary to extract the bounding box comments from the EPS files and convert them into page dimension parameters for GhostScript in order to avoid full-page graphics. This is not even possible if you wanted to use GhostScript in a single run for generating the files from a single PostScript file, since Dvips will in that case leave no bounding box information anywhere.
The solution is to use the tightpage
option. That way a single
command line like
gs -sDEVICE=png16m -dTextAlphaBits=4 -r300 -dGraphicsAlphaBits=4 -dSAFER -q -dNOPAUSE -sOutputFile=outputfile%d.png inputfile.ps
will be able to produce tight graphics from a single PostScript
file generated with Dvips without use of the options
-E -i
, in a single run.
The tightpage
option actually also works when using the pdftex
option and generating PDF files with PDFTeX. The resulting PDF
file has separate page dimensions for every page and can directly
be converted with one run of GhostScript into image files.
If neither dvips
or pdftex
have been specified, the
corresponding option will get autodetected and invoked.
If you need this in a batch environment where you don't want to
use preview
's automatic extraction facilities, no problem: just
don't use any of the extraction options, and wrap everything to be
previewed into preview
environments. This is how LyX does its
math previews.
If the pages under the tightpage
option are just too tight, you
can adjust by setting the length \PreviewBorder
to a different
value by using \setlength
. The default value is
0.50001bp, which is half of a usual PostScript point, rounded
up. If you go below this value, the resulting page size may drop
below 1bp
, and GhostScript does not seem to like that. If you
need finer control, you can adjust the bounding box dimensions
individually by changing the macro \PreviewBbAdjust
with the
help of \renewcommand
. Its default value is
\newcommand \PreviewBbAdjust {-\PreviewBorder -\PreviewBorder \PreviewBorder \PreviewBorder}
This adjusts the left, lower, right and upper borders by the given
amount. The macro must contain 4 TeX dimensions after another,
and you may not omit the units if you specify them explicitly
instead of by register. PostScript points have the unit bp
.
lyx
counters
{}
braces, followed by a space. The last such pair is
followed by a colon (:
) if it is at the start of the preview
snippet, and by a period (.) if it is at the end. The order of
different diagnostics like this being issued depends on the order
of the specification of the options when calling the package.
Systems like preview-latex use this for keeping counters accurate
when single previews are regenerated.
footnotes
The following options are just for debugging purposes of the package and similar to the corresponding TeX commands they allude to:
tracingall
\errorstopmode
, nor will it change the
setting of \tracingonline
.
showbox
\showboxbreadth
and
\showboxdepth
to their maximum values at the end of loading this
package, but you may reset them if you don't like that.