| 1 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | =encoding utf8 | ||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | Quiq::LaTeX::Document - Erzeuge LaTeX Dokument | ||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | =head1 BASE CLASS | ||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | L<Quiq::Hash> | ||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | Der Code | ||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | use Quiq::LaTeX::Document; | ||||||||||||||||||||||||||||||||||||||||||
| 18 | use Quiq::LaTeX::Code; | ||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | my $l = Quiq::LaTeX::Code->new; | ||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | my $doc = Quiq::LaTeX::Document->new( | ||||||||||||||||||||||||||||||||||||||||||
| 23 | body => 'Hallo Welt', | ||||||||||||||||||||||||||||||||||||||||||
| 24 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | my $code = $doc->latex($l); | ||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | produziert | ||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | \documentclass[ngerman,a4paper]{scrartcl} | ||||||||||||||||||||||||||||||||||||||||||
| 31 | \usepackage[T1]{fontenc} | ||||||||||||||||||||||||||||||||||||||||||
| 32 | \usepackage{lmodern} | ||||||||||||||||||||||||||||||||||||||||||
| 33 | \usepackage[utf8]{inputenc} | ||||||||||||||||||||||||||||||||||||||||||
| 34 | \usepackage{babel} | ||||||||||||||||||||||||||||||||||||||||||
| 35 | \usepackage{geometry} | ||||||||||||||||||||||||||||||||||||||||||
| 36 | \usepackage{microtype} | ||||||||||||||||||||||||||||||||||||||||||
| 37 | \geometry{height=22.5cm,bottom=3.8cm} | ||||||||||||||||||||||||||||||||||||||||||
| 38 | \setlength{\parindent}{0em} | ||||||||||||||||||||||||||||||||||||||||||
| 39 | \setlength{\parskip}{0.5ex} | ||||||||||||||||||||||||||||||||||||||||||
| 40 | \begin{document} | ||||||||||||||||||||||||||||||||||||||||||
| 41 | Hallo Welt! | ||||||||||||||||||||||||||||||||||||||||||
| 42 | \end{document} | ||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||
| 44 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||
| 46 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||
| 48 | package Quiq::LaTeX::Document; | ||||||||||||||||||||||||||||||||||||||||||
| 49 | 1 | ▶ | use base qw/Quiq::Hash/; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||
| 51 | 1 | ▶ | use v5.10; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 52 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 53 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | 1 | our $VERSION = '1.240'; | |||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | 1 | ▶ | use Quiq::Reference; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 58 | 1 | ▶ | use Quiq::Unindent; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 59 | 1 | ▶ | use POSIX (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||
| 61 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||
| 65 | =head2 Konstruktor | ||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||
| 67 | =head3 new() - Instantiiere LaTeX Dokument-Objekt | ||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||
| 69 | =head4 Synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | $doc = $class->new(@keyVal); | ||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | =head4 Arguments | ||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||
| 77 | =item author => $str | ||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||
| 79 | Der Autor des Dokuments. Wenn gesetzt, wird eine Titelseite bzw. | ||||||||||||||||||||||||||||||||||||||||||
| 80 | ein Titelabschnitt erzeugt. | ||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | =item body => $str | \@arr (Default: '') | ||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||
| 84 | Der Rumpf des Dokuments. | ||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | =item compactCode => $bool (Default: 1) | ||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | Erzeuge den LaTeX Code ohne zusätzliche Leerzeilen und Kommentare. | ||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||
| 90 | =item date => $str | ||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||
| 92 | Das Datum des Dokuments. Wenn gesetzt, wird eine Titelseite bzw. | ||||||||||||||||||||||||||||||||||||||||||
| 93 | ein Titelabschnitt erzeugt. Formatelemente von strftime werden | ||||||||||||||||||||||||||||||||||||||||||
| 94 | expandiert. Spezielle Werte: | ||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||
| 96 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||
| 98 | =item today | ||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||
| 100 | Wird ersetzt zu C<\today>. | ||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||
| 102 | =item now | ||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||
| 104 | Wird expandiert zu C<YYYY-MM-DD HH:MI:SS>. | ||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||
| 106 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||
| 108 | =item documentClass => $documentClass (Default: 'scrartcl') | ||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||
| 110 | Die Dokumentklasse. | ||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||
| 112 | =item encoding => $encoding (Default: 'utf8') | ||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||
| 114 | Das Input-Encoding. | ||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||
| 116 | =item fontEncoding => $font (Default: 'T1') | ||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||
| 118 | Das Font-Encoding. | ||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||
| 120 | =item fontSize => $fontSize (Default: undef) | ||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||
| 122 | Die Größe des Hauptfont. Mogliche Werte für die Standard LaTeX | ||||||||||||||||||||||||||||||||||||||||||
| 123 | Dokumentklassen article etc.: '10pt', '11pt', '12pt'. Die | ||||||||||||||||||||||||||||||||||||||||||
| 124 | KOMA-Script Klassen 'scrartcl' etc. erlauben weitere Fontgrößen. | ||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||
| 126 | =item geometry => $str (Default: 'height=22.5cm,bottom=3.8cm' bei a4paper) | ||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||
| 128 | Gegenüber der Grundeinstellung abweichende Seitenmaße. | ||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||
| 130 | =item language => $language (Default: 'ngerman') | ||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||
| 132 | Die Sprache, in der das Dokument verfasst ist. | ||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||
| 134 | =item options => $str | \@arr | ||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||
| 136 | Dukument-Optionen. | ||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||
| 138 | =item packages => \@arr (Default: []) | ||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||
| 140 | Liste der Packages, die zusätzlich geladen werden sollen. | ||||||||||||||||||||||||||||||||||||||||||
| 141 | Die Elemente sind Schlüssel/Wert-Paare der Art: | ||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||
| 143 | $package => \@options | ||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||
| 145 | =item paperSize => $paperSize (Default: 'a4paper') | ||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||
| 147 | Die Größe des Papiers, die die das Dokument gesetzt wird. | ||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||
| 149 | =item parIndent => $length (Default: undef) | ||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||
| 151 | Tiefe der Absatzeinrückung. | ||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||
| 153 | =item parSkip => $length (Default: undef) | ||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||
| 155 | Vertikaler Abstand zwischen Absätzen. | ||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||
| 157 | =item preamble => $str | \@arr (Default: '') | ||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||
| 159 | Dokumentvorspann mit Definitionen. | ||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||
| 161 | =item preComment => $str | ||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||
| 163 | Kommentar am Dokumentanfang. Wir mit einer Leerzeile vom folgenden | ||||||||||||||||||||||||||||||||||||||||||
| 164 | Code abgesetzt. | ||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||
| 166 | =item secNumDepth => $n | ||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||
| 168 | Tiefe, bis zu der Abschnitte numeriert werden. Default seitens | ||||||||||||||||||||||||||||||||||||||||||
| 169 | LaTeX: 3. -2 schaltet die Numerierung ab. | ||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||
| 171 | =item title => $str | ||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||
| 173 | Der Titel des Dokuments. Wenn gesetzt, wird eine Titelseite bzw. | ||||||||||||||||||||||||||||||||||||||||||
| 174 | ein Titelabschnitt erzeugt. | ||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||
| 176 | =item titlePageStyle => $pageStyle | ||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||
| 178 | Seitenstil der ersten Seite. Mögliche Werte: 'empty' (Kopf- | ||||||||||||||||||||||||||||||||||||||||||
| 179 | und Fußzeile leer), 'plain' (nur Fuß mit Seitennummer), 'headings' | ||||||||||||||||||||||||||||||||||||||||||
| 180 | (Kopf mit Abschnittstiteln, Fuß mit Seitennummer). | ||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||
| 182 | =item tocDepth => $n | ||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||
| 184 | Tiefe, bis zu der Abschnitte in das Inhaltsverzeichnis aufgenommen | ||||||||||||||||||||||||||||||||||||||||||
| 185 | werden. Default seitens LaTeX: 3. | ||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||
| 187 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||
| 189 | =head4 Returns | ||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||
| 191 | Dokument-Objekt | ||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||
| 193 | =head4 Description | ||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||
| 195 | Instantiiere ein LaTeX Dokument-Objekt und liefere eine Referenz | ||||||||||||||||||||||||||||||||||||||||||
| 196 | auf dieses Objekt zurück. | ||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||
| 198 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||
| 200 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||
| 202 | 2 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 203 | 2 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 204 | # @_: @keyval | ||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||
| 206 | 2 | my $self = $class->SUPER::new( | |||||||||||||||||||||||||||||||||||||||||
| 207 | author => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 208 | body => '', # kann Skalar oder Array-Referenz sein | ||||||||||||||||||||||||||||||||||||||||||
| 209 | compactCode => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 210 | date => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 211 | documentClass => 'scrartcl', | ||||||||||||||||||||||||||||||||||||||||||
| 212 | encoding => 'utf8', | ||||||||||||||||||||||||||||||||||||||||||
| 213 | fontEncoding => 'T1', | ||||||||||||||||||||||||||||||||||||||||||
| 214 | fontSize => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 215 | geometry => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 216 | language => 'ngerman', | ||||||||||||||||||||||||||||||||||||||||||
| 217 | options => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 218 | packages => [], | ||||||||||||||||||||||||||||||||||||||||||
| 219 | titlePageStyle => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 220 | paperSize => 'a4paper', | ||||||||||||||||||||||||||||||||||||||||||
| 221 | parIndent => '0em', | ||||||||||||||||||||||||||||||||||||||||||
| 222 | parSkip => '0.5ex', | ||||||||||||||||||||||||||||||||||||||||||
| 223 | preamble => '', # kann Skalar oder Array-Referenz sein | ||||||||||||||||||||||||||||||||||||||||||
| 224 | preComment => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 225 | secNumDepth => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 226 | title => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 227 | tocDepth => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 228 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 229 | 2 | $self->set(@_); | |||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||
| 231 | 2 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||
| 234 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||
| 236 | =head2 Objektmethoden | ||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||
| 238 | =head3 latex() - Generiere LaTeX-Code | ||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||
| 240 | =head4 Synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||
| 242 | $code = $doc->latex($l); | ||||||||||||||||||||||||||||||||||||||||||
| 243 | $code = $class->latex($l,@keyVal); | ||||||||||||||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||||||||||||
| 245 | =head4 Description | ||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||
| 247 | Generiere den LaTeX-Code des Objekts und liefere diesen | ||||||||||||||||||||||||||||||||||||||||||
| 248 | zurück. Als Klassenmethode gerufen, wird das Objekt intern erzeugt | ||||||||||||||||||||||||||||||||||||||||||
| 249 | und mit den Attributen @keyVal instantiiert. | ||||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||
| 251 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||
| 253 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||
| 255 | 2 | ▶ | sub latex { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
latex: called CC=36 SCAR=54.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 256 | 2 | my $this = shift; | |||||||||||||||||||||||||||||||||||||||||
| 257 | 2 | my $l = shift; | |||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||
| 259 | 2 | ▶ | my $self = ref $this? $this: $this->new(@_); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||
| 261 | 2 | my ($author,$body,$compactCode,$date,$documentClass,$encoding, | |||||||||||||||||||||||||||||||||||||||||
| 262 | $fontEncoding,$fontSize,$geometry,$language,$options,$packageA, | ||||||||||||||||||||||||||||||||||||||||||
| 263 | $titlePageStyle,$paperSize,$parIndent,$parSkip,$preamble,$preComment, | ||||||||||||||||||||||||||||||||||||||||||
| 264 | $secNumDepth,$title,$tocDepth) = $self->get(qw/author body | ||||||||||||||||||||||||||||||||||||||||||
| 265 | compactCode date documentClass encoding fontEncoding fontSize | ||||||||||||||||||||||||||||||||||||||||||
| 266 | geometry language options packages titlePageStyle paperSize parIndent | ||||||||||||||||||||||||||||||||||||||||||
| 267 | parSkip preamble preComment secNumDepth title tocDepth/); | ||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||
| 269 | 2 | ▶ | my @pnl = $compactCode? (): (-pnl=>1); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||
| 271 | 2 | my $code; | |||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||
| 273 | # Anfangskommentar | ||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||
| 275 | 2 | ▶ | if ($preComment) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | $code .= $l->comment($preComment,-nl=>2); | |||||||||||||||||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||
| 279 | # \documentclass | ||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||
| 281 | 2 | my @opt; | |||||||||||||||||||||||||||||||||||||||||
| 282 | 2 | ▶ | if ($language) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 283 | 2 | push @opt,$language; | |||||||||||||||||||||||||||||||||||||||||
| 284 | } | ||||||||||||||||||||||||||||||||||||||||||
| 285 | 2 | ▶ | if ($paperSize) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 286 | 2 | push @opt,$paperSize; | |||||||||||||||||||||||||||||||||||||||||
| 287 | } | ||||||||||||||||||||||||||||||||||||||||||
| 288 | 2 | ▶ | if ($fontSize) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | push @opt,$fontSize; | |||||||||||||||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||||||||||||||||
| 291 | 2 | ▶ | if ($options) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | ▶ | if (Quiq::Reference->isArrayRef($options)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | push @opt,@$options; | |||||||||||||||||||||||||||||||||||||||||
| 294 | } | ||||||||||||||||||||||||||||||||||||||||||
| 295 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | push @opt,split /,/,$options; | |||||||||||||||||||||||||||||||||||||||||
| 297 | } | ||||||||||||||||||||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||||||||||||||||||
| 299 | 2 | $code .= $l->macro('\documentclass', | |||||||||||||||||||||||||||||||||||||||||
| 300 | -o => \@opt, | ||||||||||||||||||||||||||||||||||||||||||
| 301 | -p => $documentClass, | ||||||||||||||||||||||||||||||||||||||||||
| 302 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||
| 304 | # Packages | ||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||
| 306 | # Font encoding | ||||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||
| 308 | 2 | ▶ | if ($fontEncoding) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 309 | 2 | $code .= $l->c('\usepackage[%s]{fontenc}',$fontEncoding,@pnl); | |||||||||||||||||||||||||||||||||||||||||
| 310 | 2 | $code .= $l->c('\usepackage{lmodern}',@pnl); | |||||||||||||||||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||
| 313 | # Input encoding | ||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||
| 315 | 2 | ▶ | if ($encoding) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 316 | 2 | $code .= $l->c('\usepackage[%s]{inputenc}',$encoding,@pnl); | |||||||||||||||||||||||||||||||||||||||||
| 317 | } | ||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||
| 319 | # Dokumentsprache | ||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||
| 321 | 2 | ▶ | if ($language) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 322 | 2 | $code .= $l->c('\usepackage{babel}',@pnl); | |||||||||||||||||||||||||||||||||||||||||
| 323 | } | ||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||
| 325 | # Papiergröße | ||||||||||||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||||||||||||
| 327 | 2 | ▶ | if ($paperSize || $geometry) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$paperSize or $geometry
MC/DC0%0/2
$paperSize or $geometry
$paperSize
$geometry
Truth table33%1/3
A or B
A= $paperSizeB= $geometry
| |||||||||||||||||||||||||||||||||||||||||||
| 328 | 2 | $code .= $l->c('\usepackage{geometry}',@pnl); | |||||||||||||||||||||||||||||||||||||||||
| 329 | } | ||||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||
| 331 | # Mikro-Typografie (autom. Korrektur von Leerraum am Rand) | ||||||||||||||||||||||||||||||||||||||||||
| 332 | 2 | $code .= $l->c('\usepackage{microtype}',@pnl); | |||||||||||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||||||||||||
| 334 | # Pakete | ||||||||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||||||||
| 336 | 2 | ▶ | for (my $i = 0; $i < @$packageA; $i += 2) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 337 | 0 | my $name = $packageA->[$i]; | |||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | my $opts = $packageA->[$i+1]; | |||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||
| 340 | 0 | ▶ | if (!ref $opts) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | ▶ | if (!$opts) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 342 | # false -> Package übergehen | ||||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 344 | } | ||||||||||||||||||||||||||||||||||||||||||
| 345 | # Keine Optionen | ||||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | $opts = undef; | |||||||||||||||||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | $code .= $l->macro('\usepackage', | |||||||||||||||||||||||||||||||||||||||||
| 350 | -o => $opts, # String oder Array-Referenz oder undef | ||||||||||||||||||||||||||||||||||||||||||
| 351 | -p => $name, | ||||||||||||||||||||||||||||||||||||||||||
| 352 | @pnl, | ||||||||||||||||||||||||||||||||||||||||||
| 353 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 354 | } | ||||||||||||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||||||||||||
| 356 | # Abweichende Seitengeometrie | ||||||||||||||||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||||||||||||||||
| 358 | 2 | ▶ | if ($geometry) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | $code .= $l->c('\geometry{%s}',$geometry); | |||||||||||||||||||||||||||||||||||||||||
| 360 | } | ||||||||||||||||||||||||||||||||||||||||||
| 361 | elsif ($paperSize eq 'a4paper') { | ||||||||||||||||||||||||||||||||||||||||||
| 362 | # Default-Geometrie für A4 Papier | ||||||||||||||||||||||||||||||||||||||||||
| 363 | # MEMO: Bei Änderung auch die Tests und die Doku anpassen | ||||||||||||||||||||||||||||||||||||||||||
| 364 | 2 | $code .= $l->c('\geometry{height=22.5cm,bottom=3.8cm}'); | |||||||||||||||||||||||||||||||||||||||||
| 365 | } | ||||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||
| 367 | # Abschnittskonfiguration | ||||||||||||||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||||||||||||
| 369 | 2 | ▶ | if (defined $secNumDepth) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 370 | 0 | $code .= $l->c('\setcounter{secnumdepth}{%s}','--',$secNumDepth); | |||||||||||||||||||||||||||||||||||||||||
| 371 | } | ||||||||||||||||||||||||||||||||||||||||||
| 372 | 2 | ▶ | if (defined $tocDepth) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | $code .= $l->c('\setcounter{tocdepth}{%s}','--',$tocDepth); | |||||||||||||||||||||||||||||||||||||||||
| 374 | } | ||||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||
| 376 | # Paragraph-Eigenschaften | ||||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||
| 378 | 2 | ▶ | if ($parIndent) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 379 | 2 | $code .= $l->c('\setlength{\parindent}{%s}',$parIndent,@pnl); | |||||||||||||||||||||||||||||||||||||||||
| 380 | } | ||||||||||||||||||||||||||||||||||||||||||
| 381 | 2 | ▶ | if ($parSkip) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 382 | 2 | $code .= $l->c('\setlength{\parskip}{%s}',$parSkip); | |||||||||||||||||||||||||||||||||||||||||
| 383 | } | ||||||||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||||||||
| 385 | # Dokument-Vorspann | ||||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||
| 387 | 2 | ▶ | if (Quiq::Reference->isArrayRef($preamble)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | $preamble = join '',@$preamble; | |||||||||||||||||||||||||||||||||||||||||
| 389 | } | ||||||||||||||||||||||||||||||||||||||||||
| 390 | 2 | $code .= $preamble; | |||||||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||||||||
| 392 | # Dokument-Rumpf | ||||||||||||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||||||||||||
| 394 | 2 | ▶ | if (Quiq::Reference->isArrayRef($body)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | $body = join '',@$body; | |||||||||||||||||||||||||||||||||||||||||
| 396 | } | ||||||||||||||||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||||||||||||||||
| 398 | # Titelseite (an den Anfrang des Rumpfes) | ||||||||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||||||||
| 400 | 2 | ▶ | if ($title || $author || $date) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$title or $author or $date
$title or $author
MC/DC0%0/3
$title or $author or $date
$title
$author
$date
Truth table25%1/4
A or B or C
A= $titleB= $authorC= $date
| |||||||||||||||||||||||||||||||||||||||||||
| 401 | 0 | ▶ | if ($date) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 402 | # Spezielle Datumswerte: | ||||||||||||||||||||||||||||||||||||||||||
| 403 | # * today | ||||||||||||||||||||||||||||||||||||||||||
| 404 | # * now | ||||||||||||||||||||||||||||||||||||||||||
| 405 | # * strftime-Formate werden expandiert | ||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||
| 407 | 0 | ▶ | if ($date eq 'today') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 408 | 0 | $date = '\today'; | |||||||||||||||||||||||||||||||||||||||||
| 409 | } | ||||||||||||||||||||||||||||||||||||||||||
| 410 | elsif ($date eq 'now') { | ||||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | $date = '%Y-%m-%d %H:%M:%S'; | |||||||||||||||||||||||||||||||||||||||||
| 412 | } | ||||||||||||||||||||||||||||||||||||||||||
| 413 | 0 | $date = POSIX::strftime($date,localtime); | |||||||||||||||||||||||||||||||||||||||||
| 414 | } | ||||||||||||||||||||||||||||||||||||||||||
| 415 | 0 | ▶ | my $tmp .= $l->c('\title{%s}',$title // ''); | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$title // ""
MC/DC0%0/1
$title // ""
$title
Truth table0%0/2
A
A= $title
| |||||||||||||||||||||||||||||||||||||||||||
| 416 | 0 | ▶ | $tmp .= $l->c('\author{%s}',$author // ''); | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$author // ""
MC/DC0%0/1
$author // ""
$author
Truth table0%0/2
A
A= $author
| |||||||||||||||||||||||||||||||||||||||||||
| 417 | 0 | ▶ | $tmp .= $l->c('\date{%s}',$date // ''); | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$date // ""
MC/DC0%0/1
$date // ""
$date
Truth table0%0/2
A
A= $date
| |||||||||||||||||||||||||||||||||||||||||||
| 418 | 0 | $tmp .= $l->c('\maketitle'); | |||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | ▶ | if ($titlePageStyle) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 420 | 0 | $tmp .= $l->c('\thispagestyle{%s}',$titlePageStyle); | |||||||||||||||||||||||||||||||||||||||||
| 421 | } | ||||||||||||||||||||||||||||||||||||||||||
| 422 | 0 | $body = $tmp.$body; | |||||||||||||||||||||||||||||||||||||||||
| 423 | } | ||||||||||||||||||||||||||||||||||||||||||
| 424 | 2 | $body = Quiq::Unindent->trimNl($body); | |||||||||||||||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||||||||||||||||
| 426 | # Umgebung | ||||||||||||||||||||||||||||||||||||||||||
| 427 | 2 | $code .= $l->env('document',$body,@pnl); | |||||||||||||||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||||||||||||||||
| 429 | # Abschließender EOF-Kommentar | ||||||||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||||||
| 431 | 2 | ▶ | if (!$compactCode) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 432 | 0 | $code .= $l->comment('eof',-pnl=>1); | |||||||||||||||||||||||||||||||||||||||||
| 433 | } | ||||||||||||||||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||||||||||||||||
| 435 | 2 | return $code; | |||||||||||||||||||||||||||||||||||||||||
| 436 | } | ||||||||||||||||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||||||||||||||||
| 438 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||||||||||||||||
| 440 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||||||||||||
| 442 | 1.240 | ||||||||||||||||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||||||||||||||||
| 444 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||||||||||||||||
| 446 | Frank Seitz, L<http://fseitz.de/> | ||||||||||||||||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||||||||||||||||
| 448 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||||||||||||||||
| 450 | Copyright (C) 2026 Frank Seitz | ||||||||||||||||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||||||||||||||||
| 452 | =head1 LICENSE | ||||||||||||||||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||||||||||||||||
| 454 | This code is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||||||||||||||||
| 455 | it under the same terms as Perl itself. | ||||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||
| 457 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||||||||||||||||
| 459 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 460 | |||||||||||||||||||||||||||||||||||||||||||
| 461 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||||||||||||||
| 463 | # eof | ||||||||||||||||||||||||||||||||||||||||||