support zero-length normsubpaths
[PyX/mjg.git] / manual / document.tex
blob150cd64d1ebe846910f917e97a5d0c7f72cf3c9b
1 \section{Module \module{document}}
2 \label{document}
4 \sectionauthor{J\"org Lehmann}{joergl@users.sourceforge.net}
6 \declaremodule{}{document}
10 The document module contains two classes: \class{document} and
11 \class{page}. A \class{document} consists of one or several
12 \class{page}s.
15 \subsection{Class \class{page}}
17 A \class{page} is a thin wrapper around a \class{canvas}, which
18 defines some additional properties of the page.
20 \begin{classdesc}{page}{canvas, pagename=None,
21 paperformat=paperformat.A4, rotated=0, centered=1, fittosize=0,
22 margin=1 * unit.t_cm, bboxenlarge=1 * unit.t_pt, bbox=None}
23 Construct a new \class{page} from the given \class{canvas} instance.
24 A string \var{pagename} and the \var{paperformat} can be
25 defined. See below, for a list of known paper formats.
26 If \var{rotated} is set, the output is rotated by 90 degrees on the
27 page. If \var{centered} is set, the output is centered on the given
28 paperformat. If \var{fittosize} is set, the output is scaled to fill
29 the full page except for a given \var{margin}.
30 Normally, the bounding box of the canvas is calculated automatically
31 from the bounding box of its elements. Alternatively, you may
32 specify the \var{bbox} manually. In any case, the bounding box is
33 enlarged on all sides by \var{bboxenlarge}.
34 \end{classdesc}
36 \subsection{Class \class{document}}
38 \begin{classdesc}{document}{pages=[]}
39 Construct a \class{document} consisting of a given list of \var{pages}.
40 \end{classdesc}
42 A \class{document} can be written to a file using one of the following methods:
44 \begin{methoddesc}{writeEPSfile}{file, *args, **kwargs}
45 Write a single page \class{document} to an EPS file, passing
46 \var{args} and \var{kwargs} to the \class{epswriter} instance
47 created for writing.
48 \end{methoddesc}
50 \begin{methoddesc}{writePSfile}{file, *args, **kwargs}
51 Write \class{document} to a PS file, passing \var{args} and
52 \var{kwargs} to the \class{pswriter} instance created for writing.
53 \end{methoddesc}
55 \begin{methoddesc}{writePDFfile}{file, *args, **kwargs}
56 Write \class{document} to a PDF file, passing \var{args} and
57 \var{kwargs} to the \class{pdfwriter} instance created for writing.
58 \end{methoddesc}
60 \begin{methoddesc}{writetofile}{filename, *args, **kwargs}
61 Determine the file type (EPS, PS, or PDF) from the file extension
62 of \var{filename} and call the corresponding write method with
63 the given arguments \var{arg} and \var{kwargs}.
64 \end{methoddesc}
66 \subsection{Class \class{paperformat}}
68 \begin{classdesc}{paperformat}{width, height, name=None}
69 Define a \class{paperformat} with the given \var{width} and
70 \var{height} and the optional \var{name}.
71 \end{classdesc}
73 Predefined paperformats are listed in the following table
74 \medskip
75 \begin{center}
76 \begin{tabular}{l|l|l|l}
77 instance & name & width & height \\
78 \hline
79 \constant{document.paperformat.A0} & A0 & \unit[840]{mm} &
80 \unit[1188]{mm}\\
81 \constant{document.paperformat.A0b} & &\unit[910]{mm} &
82 \unit[1370]{mm}\\
83 \constant{document.paperformat.A1} & A1& \unit[594]{mm} &
84 \unit[840]{mm}\\
85 \constant{document.paperformat.A2} & A2& \unit[420]{mm} &
86 \unit[594]{mm}\\
87 \constant{document.paperformat.A3} & A3 & \unit[297]{mm} & \unit[420]{mm}\\
88 \constant{document.paperformat.A4} & A4& \unit[210]{mm} & \unit[297]{mm}\\
89 \constant{document.paperformat.Letter} & Letter & \unit[8.5]{inch} &
90 \unit[11]{inch}\\
91 \constant{document.paperformat.Legal} & Legal & \unit[8.5]{inch} & \unit[14]{inch}
92 \end{tabular}
93 \end{center}
94 \medskip
98 %%% Local Variables:
99 %%% mode: latex
100 %%% TeX-master: "manual.tex"
101 %%% End: