1Pod::LaTeX(3) User Contributed Perl Documentation Pod::LaTeX(3)
2
3
4
6 Pod::LaTeX - Convert Pod data to formatted Latex
7
9 use Pod::LaTeX;
10 my $parser = Pod::LaTeX->new ( );
11
12 $parser->parse_from_filehandle;
13
14 $parser->parse_from_file ('file.pod', 'file.tex');
15
17 "Pod::LaTeX" is a module to convert documentation in the Pod format
18 into Latex. The pod2latex command uses this module for translation.
19
20 "Pod::LaTeX" is a derived class from Pod::Select.
21
23 The following methods are provided in this module. Methods inherited
24 from "Pod::Select" are not described in the public interface.
25
26 Data Accessors
27 The following methods are provided for accessing instance data. These
28 methods should be used for accessing configuration parameters rather
29 than assuming the object is a hash.
30
31 Default values can be supplied by using these names as keys to a hash
32 of arguments when using the "new()" constructor.
33
34 AddPreamble
35 Logical to control whether a "latex" preamble is to be written. If
36 true, a valid "latex" preamble is written before the pod data is
37 written. This is similar to:
38
39 \documentclass{article}
40 \usepackage[T1]{fontenc}
41 \usepackage{textcomp}
42 \begin{document}
43
44 but will be more complicated if table of contents and indexing are
45 required. Can be used to set or retrieve the current value.
46
47 $add = $parser->AddPreamble();
48 $parser->AddPreamble(1);
49
50 If used in conjunction with "AddPostamble" a full latex document
51 will be written that could be immediately processed by "latex".
52
53 For some pod escapes it may be necessary to include the amsmath
54 package. This is not yet added to the preamble automatically.
55
56 AddPostamble
57 Logical to control whether a standard "latex" ending is written to
58 the output file after the document has been processed. In its
59 simplest form this is simply:
60
61 \end{document}
62
63 but can be more complicated if a index is required. Can be used to
64 set or retrieve the current value.
65
66 $add = $parser->AddPostamble();
67 $parser->AddPostamble(1);
68
69 If used in conjunction with "AddPreaamble" a full latex document
70 will be written that could be immediately processed by "latex".
71
72 Head1Level
73 The "latex" sectioning level that should be used to correspond to a
74 pod "=head1" directive. This can be used, for example, to turn a
75 "=head1" into a "latex" "subsection". This should hold a number
76 corresponding to the required position in an array containing the
77 following elements:
78
79 [0] chapter
80 [1] section
81 [2] subsection
82 [3] subsubsection
83 [4] paragraph
84 [5] subparagraph
85
86 Can be used to set or retrieve the current value:
87
88 $parser->Head1Level(2);
89 $sect = $parser->Head1Level;
90
91 Setting this number too high can result in sections that may not be
92 reproducible in the expected way. For example, setting this to 4
93 would imply that "=head3" do not have a corresponding "latex"
94 section ("=head1" would correspond to a "paragraph").
95
96 A check is made to ensure that the supplied value is an integer in
97 the range 0 to 5.
98
99 Default is for a value of 1 (i.e. a "section").
100
101 Label
102 This is the label that is prefixed to all "latex" label and index
103 entries to make them unique. In general, pods have similarly titled
104 sections (NAME, DESCRIPTION etc) and a "latex" label will be
105 multiply defined if more than one pod document is to be included in
106 a single "latex" file. To overcome this, this label is prefixed to
107 a label whenever a label is required (joined with an underscore) or
108 to an index entry (joined by an exclamation mark which is the
109 normal index separator). For example, "\label{text}" becomes
110 "\label{Label_text}".
111
112 Can be used to set or retrieve the current value:
113
114 $label = $parser->Label;
115 $parser->Label($label);
116
117 This label is only used if "UniqueLabels" is true. Its value is
118 set automatically from the "NAME" field if "ReplaceNAMEwithSection"
119 is true. If this is not the case it must be set manually before
120 starting the parse.
121
122 Default value is "undef".
123
124 LevelNoNum
125 Control the point at which "latex" section numbering is turned off.
126 For example, this can be used to make sure that "latex" sections
127 are numbered but subsections are not.
128
129 Can be used to set or retrieve the current value:
130
131 $lev = $parser->LevelNoNum;
132 $parser->LevelNoNum(2);
133
134 The argument must be an integer between 0 and 5 and is the same as
135 the number described in "Head1Level" method description. The number
136 has nothing to do with the pod heading number, only the "latex"
137 sectioning.
138
139 Default is 2. (i.e. "latex" subsections are written as
140 "subsection*" but sections are numbered).
141
142 MakeIndex
143 Controls whether "latex" commands for creating an index are to be
144 inserted into the preamble and postamble
145
146 $makeindex = $parser->MakeIndex;
147 $parser->MakeIndex(0);
148
149 Irrelevant if both "AddPreamble" and "AddPostamble" are false (or
150 equivalently, "UserPreamble" and "UserPostamble" are set).
151
152 Default is for an index to be created.
153
154 ReplaceNAMEwithSection
155 This controls whether the "NAME" section in the pod is to be
156 translated literally or converted to a slightly modified output
157 where the section name is the pod name rather than "NAME".
158
159 If true, the pod segment
160
161 =head1 NAME
162
163 pod::name - purpose
164
165 =head1 SYNOPSIS
166
167 is converted to the "latex"
168
169 \section{pod::name\label{pod_name}\index{pod::name}}
170
171 Purpose
172
173 \subsection*{SYNOPSIS\label{pod_name_SYNOPSIS}%
174 \index{pod::name!SYNOPSIS}}
175
176 (dependent on the value of "Head1Level" and "LevelNoNum"). Note
177 that subsequent "head1" directives translate to subsections rather
178 than sections and that the labels and index now include the pod
179 name (dependent on the value of "UniqueLabels").
180
181 The "Label" is set from the pod name regardless of any current
182 value of "Label".
183
184 $mod = $parser->ReplaceNAMEwithSection;
185 $parser->ReplaceNAMEwithSection(0);
186
187 Default is to translate the pod literally.
188
189 StartWithNewPage
190 If true, each pod translation will begin with a "latex"
191 "\clearpage".
192
193 $parser->StartWithNewPage(1);
194 $newpage = $parser->StartWithNewPage;
195
196 Default is false.
197
198 TableOfContents
199 If true, a table of contents will be created. Irrelevant if
200 "AddPreamble" is false or "UserPreamble" is set.
201
202 $toc = $parser->TableOfContents;
203 $parser->TableOfContents(1);
204
205 Default is false.
206
207 UniqueLabels
208 If true, the translator will attempt to make sure that each "latex"
209 label or index entry will be uniquely identified by prefixing the
210 contents of "Label". This allows multiple documents to be combined
211 without clashing common labels such as "DESCRIPTION" and "SYNOPSIS"
212
213 $parser->UniqueLabels(1);
214 $unq = $parser->UniqueLabels;
215
216 Default is true.
217
218 UserPreamble
219 User supplied "latex" preamble. Added before the pod translation
220 data.
221
222 If set, the contents will be prepended to the output file before
223 the translated data regardless of the value of "AddPreamble".
224 "MakeIndex" and "TableOfContents" will also be ignored.
225
226 UserPostamble
227 User supplied "latex" postamble. Added after the pod translation
228 data.
229
230 If set, the contents will be prepended to the output file after the
231 translated data regardless of the value of "AddPostamble".
232 "MakeIndex" will also be ignored.
233
235 Compatible with "latex2e" only. Can not be used with "latex" v2.09 or
236 earlier.
237
238 A subclass of "Pod::Select" so that specific pod sections can be
239 converted to "latex" by using the "select" method.
240
241 Some HTML escapes are missing and many have not been tested.
242
244 Pod::Parser, Pod::Select, pod2latex, Pod::Simple.
245
247 Tim Jenness <tjenness@cpan.org>
248
249 Bug fixes and improvements have been received from: Simon Cozens
250 <simon@cozens.net>, Mark A. Hershberger <mah@everybody.org>, Marcel
251 Grunauer <marcel@codewerk.com>, Hugh S Myers <hsmyers@sdragons.com>,
252 Peter J Acklam <jacklam@math.uio.no>, Sudhi Herle <sudhi@herle.net>,
253 Ariel Scolnicov <ariels@compugen.co.il>, Adriano Rodrigues Ferreira
254 <ferreira@triang.com.br>, R. de Vries <r.de.vries@dutchspace.nl> and
255 Dave Mitchell <davem@iabyn.com>.
256
258 Copyright (C) 2011 Tim Jenness. Copyright (C) 2000-2004 Tim Jenness.
259 All Rights Reserved.
260
261 This program is free software; you can redistribute it and/or modify it
262 under the same terms as Perl itself.
263
264
265
266perl v5.32.0 2020-07-28 Pod::LaTeX(3)