?? latex.pm
字號:
Default values can be supplied by using these names as keys to a hashof arguments when using the C<new()> constructor.=over 4=item B<AddPreamble>Logical to control whether a C<latex> preamble is to be written.If true, a valid C<latex> preamble is written before the pod data is written.This is similar to: \documentclass{article} \usepackage[T1]{fontenc} \usepackage{textcomp} \begin{document}but will be more complicated if table of contents and indexing are required.Can be used to set or retrieve the current value. $add = $parser->AddPreamble(); $parser->AddPreamble(1);If used in conjunction with C<AddPostamble> a full latex document willbe written that could be immediately processed by C<latex>.For some pod escapes it may be necessary to include the amsmathpackage. This is not yet added to the preamble automatically.=cutsub AddPreamble { my $self = shift; if (@_) { $self->{AddPreamble} = shift; } return $self->{AddPreamble};}=item B<AddPostamble>Logical to control whether a standard C<latex> ending is written to the outputfile after the document has been processed.In its simplest form this is simply: \end{document}but can be more complicated if a index is required.Can be used to set or retrieve the current value. $add = $parser->AddPostamble(); $parser->AddPostamble(1);If used in conjunction with C<AddPreaamble> a full latex document willbe written that could be immediately processed by C<latex>.=cutsub AddPostamble { my $self = shift; if (@_) { $self->{AddPostamble} = shift; } return $self->{AddPostamble};}=item B<Head1Level>The C<latex> sectioning level that should be used to correspond toa pod C<=head1> directive. This can be used, for example, to turna C<=head1> into a C<latex> C<subsection>. This should hold a numbercorresponding to the required position in an array containing thefollowing elements: [0] chapter [1] section [2] subsection [3] subsubsection [4] paragraph [5] subparagraphCan be used to set or retrieve the current value: $parser->Head1Level(2); $sect = $parser->Head1Level;Setting this number too high can result in sections that may not be reproduciblein the expected way. For example, setting this to 4 would imply that C<=head3>do not have a corresponding C<latex> section (C<=head1> would correspond toa C<paragraph>).A check is made to ensure that the supplied value is an integer in therange 0 to 5.Default is for a value of 1 (i.e. a C<section>).=cutsub Head1Level { my $self = shift; if (@_) { my $arg = shift; if ($arg =~ /^\d$/ && $arg <= $#LatexSections) { $self->{Head1Level} = $arg; } else { carp "Head1Level supplied ($arg) must be integer in range 0 to ".$#LatexSections . "- Ignoring\n"; } } return $self->{Head1Level};}=item B<Label>This is the label that is prefixed to all C<latex> label and indexentries to make them unique. In general, pods have similarly titledsections (NAME, DESCRIPTION etc) and a C<latex> label will be multiplydefined if more than one pod document is to be included in a singleC<latex> file. To overcome this, this label is prefixed to a labelwhenever a label is required (joined with an underscore) or to anindex entry (joined by an exclamation mark which is the normal indexseparator). For example, C<\label{text}> becomes C<\label{Label_text}>.Can be used to set or retrieve the current value: $label = $parser->Label; $parser->Label($label);This label is only used if C<UniqueLabels> is true.Its value is set automatically from the C<NAME> fieldif C<ReplaceNAMEwithSection> is true. If this is not the caseit must be set manually before starting the parse.Default value is C<undef>.=cutsub Label { my $self = shift; if (@_) { $self->{Label} = shift; } return $self->{Label};}=item B<LevelNoNum>Control the point at which C<latex> section numbering is turned off.For example, this can be used to make sure that C<latex> sectionsare numbered but subsections are not.Can be used to set or retrieve the current value: $lev = $parser->LevelNoNum; $parser->LevelNoNum(2);The argument must be an integer between 0 and 5 and is the same as thenumber described in C<Head1Level> method description. The number hasnothing to do with the pod heading number, only the C<latex> sectioning.Default is 2. (i.e. C<latex> subsections are written as C<subsection*>but sections are numbered).=cutsub LevelNoNum { my $self = shift; if (@_) { $self->{LevelNoNum} = shift; } return $self->{LevelNoNum};}=item B<MakeIndex>Controls whether C<latex> commands for creating an index are to be insertedinto the preamble and postamble $makeindex = $parser->MakeIndex; $parser->MakeIndex(0);Irrelevant if both C<AddPreamble> and C<AddPostamble> are false (or equivalently,C<UserPreamble> and C<UserPostamble> are set).Default is for an index to be created.=cutsub MakeIndex { my $self = shift; if (@_) { $self->{MakeIndex} = shift; } return $self->{MakeIndex};}=item B<ReplaceNAMEwithSection>This controls whether the C<NAME> section in the pod is to be translatedliterally or converted to a slightly modified output where the sectionname is the pod name rather than "NAME".If true, the pod segment =head1 NAME pod::name - purpose =head1 SYNOPSISis converted to the C<latex> \section{pod::name\label{pod_name}\index{pod::name}} Purpose \subsection*{SYNOPSIS\label{pod_name_SYNOPSIS}% \index{pod::name!SYNOPSIS}}(dependent on the value of C<Head1Level> and C<LevelNoNum>). Note thatsubsequent C<head1> directives translate to subsections rather thansections and that the labels and index now include the pod name (dependenton the value of C<UniqueLabels>).The C<Label> is set from the pod name regardless of any current valueof C<Label>. $mod = $parser->ReplaceNAMEwithSection; $parser->ReplaceNAMEwithSection(0);Default is to translate the pod literally.=cutsub ReplaceNAMEwithSection { my $self = shift; if (@_) { $self->{ReplaceNAMEwithSection} = shift; } return $self->{ReplaceNAMEwithSection};}=item B<StartWithNewPage>If true, each pod translation will begin with a C<latex>C<\clearpage>. $parser->StartWithNewPage(1); $newpage = $parser->StartWithNewPage;Default is false.=cutsub StartWithNewPage { my $self = shift; if (@_) { $self->{StartWithNewPage} = shift; } return $self->{StartWithNewPage};}=item B<TableOfContents>If true, a table of contents will be created.Irrelevant if C<AddPreamble> is false or C<UserPreamble>is set. $toc = $parser->TableOfContents; $parser->TableOfContents(1);Default is false.=cutsub TableOfContents { my $self = shift; if (@_) { $self->{TableOfContents} = shift; } return $self->{TableOfContents};}=item B<UniqueLabels>If true, the translator will attempt to make sure thateach C<latex> label or index entry will be uniquely identifiedby prefixing the contents of C<Label>. This allowsmultiple documents to be combined without clashing common labels such as C<DESCRIPTION> and C<SYNOPSIS> $parser->UniqueLabels(1); $unq = $parser->UniqueLabels;Default is true.=cutsub UniqueLabels { my $self = shift; if (@_) { $self->{UniqueLabels} = shift; } return $self->{UniqueLabels};}=item B<UserPreamble>User supplied C<latex> preamble. Added before the pod translationdata. If set, the contents will be prepended to the output file before the translated data regardless of the value of C<AddPreamble>.C<MakeIndex> and C<TableOfContents> will also be ignored.=cutsub UserPreamble { my $self = shift; if (@_) { $self->{UserPreamble} = shift; } return $self->{UserPreamble};}=item B<UserPostamble>User supplied C<latex> postamble. Added after the pod translationdata. If set, the contents will be prepended to the output file after the translated data regardless of the value of C<AddPostamble>.C<MakeIndex> will also be ignored.=cutsub UserPostamble { my $self = shift; if (@_) { $self->{UserPostamble} = shift; } return $self->{UserPostamble};}=begin __PRIVATE__=item B<Lists>Contains details of the currently active lists. The array contains C<Pod::List> objects. A new C<Pod::List>object is created each time a list is encountered and it ispushed onto this stack. When the list context ends, it is popped from the stack. The array will be empty if nolists are active.Returns array of list information in list contextReturns array ref in scalar context=cutsub lists { my $self = shift; return @{ $self->{_Lists} } if wantarray(); return $self->{_Lists};}=end __PRIVATE__=back=begin __PRIVATE__=head2 Subclassed methodsThe following methods override methods provided in the C<Pod::Select>base class. See C<Pod::Parser> and C<Pod::Select> for more informationon what these methods require.=over 4=cut######### END ACCESSORS #################### Opening pod=item B<begin_pod>Writes the C<latex> preamble if requested. Only writes somethingif AddPreamble is true. Writes a standard header unless a UserPreambleis defined.=cutsub begin_pod { my $self = shift; # Get the pod identification # This should really come from the '=head1 NAME' paragraph my $infile = $self->input_file; my $class = ref($self); my $date = gmtime(time); # Comment message to say where this came from my $comment = << "__TEX_COMMENT__";%% Latex generated from POD in document $infile%% Using the perl module $class%% Converted on $date__TEX_COMMENT__ # Write the preamble # If the caller has supplied one then we just use that my $preamble = ''; if ($self->AddPreamble) { if (defined $self->UserPreamble) { $preamble = $self->UserPreamble; # Add the description of where this came from $preamble .= "\n$comment\n%% Preamble supplied by user.\n\n"; } else { # Write our own preamble # Code to initialise index making # Use an array so that we can prepend comment if required my @makeidx = ( '\usepackage{makeidx}', '\makeindex', ); unless ($self->MakeIndex) { foreach (@makeidx) { $_ = '%% ' . $_; } } my $makeindex = join("\n",@makeidx) . "\n"; # Table of contents my $tableofcontents = '\tableofcontents'; $tableofcontents = '%% ' . $tableofcontents unless $self->TableOfContents; # Roll our own $preamble = << "__TEX_HEADER__";\\documentclass{article}\\usepackage[T1]{fontenc}\\usepackage{textcomp}$comment$makeindex\\begin{document}$tableofcontents__TEX_HEADER__ } } # Write the header (blank if none) $self->_output($preamble);
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -