2 <!--#############################################################################
3 | $Id: preamble.mod.xsl,v 1.1.2.1 2003/05/01 14:06:15 jelmer Exp $
4 |- #############################################################################
7 | PURPOSE: Variables and templates to manage LaTeX preamble.
8 + ############################################################################## -->
10 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
11 xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
12 exclude-result-prefixes="doc" version='1.0'>
15 <doc:reference id="preamble" xmlns="">
17 <releaseinfo role="meta">
18 $Id: preamble.mod.xsl,v 1.1.2.1 2003/05/01 14:06:15 jelmer Exp $
21 <author> <firstname>Ramon</firstname> <surname>Casellas</surname> </author>
22 <author> <firstname>James</firstname> <surname>Devenish</surname> </author>
24 <copyright><year>2000</year><year>2001</year><year>2002</year><year>2003</year>
25 <holder>Ramon Casellas</holder>
29 <title>Variables and Templates used in LaTeX Preamble Generation</title>
32 <section><title>Introduction</title>
33 <para> This section described the variables and templates that are used in the generation of
34 the outtput LaTeX preamble. Basically, the LaTeX preamble depends on the XML document, that is,
35 on whether it is an article or a book.</para>
38 <section><title>Flow</title>
39 <section><title>Articles</title>
42 <section><title>Books</title>
51 <!--#############################################################################
52 | generate.latex.article.preamble and generate.latex.book.preamble
53 |- #############################################################################
54 | Top-level named templates.
57 + ############################################################################## -->
59 <!-- DOCUMENTATION -->
60 <doc:template name="generate.latex.article.preamble" xmlns="">
61 <refpurpose> Top level template, called by article template,
62 responsible of generating the LaTeX preamble according to user
63 XSL variables and templates.
66 <formalpara><title>Overview</title>
67 If the xsl:variable <literal>latex.override</literal>
68 is empty, the template outputs <literal>latex.article.preamblestart</literal>
69 and calls <literal>generate.latex.common.preamble</literal>. Otherwise,
70 it outputs the value of <literal>latex.override</literal> and
74 <refauthor>Ramon Casellas <email>casellas@aist.enst.fr</email></refauthor>
78 <xsl:template name="generate.latex.article.preamble">
80 <xsl:when test="$latex.override = ''">
81 <xsl:value-of select="$latex.article.preamblestart"/>
82 <xsl:value-of select="$latex.article.preamble.pre"/>
83 <xsl:call-template name="label.id"/>
84 <xsl:call-template name="generate.latex.common.preamble"/>
85 <xsl:call-template name="generate.latex.essential.preamble"/>
86 <xsl:value-of select="$latex.article.preamble.post"/>
89 <xsl:value-of select="$latex.override"/>
90 <xsl:call-template name="generate.latex.essential.preamble"/>
95 <!-- DOCUMENTATION -->
96 <doc:template name="generate.latex.book.preamble" xmlns="">
97 <refpurpose> Top level template, called by book template,
98 responsible of generating the LaTeX preamble according to user
99 XSL variables and templates.
102 <formalpara><title>Overview</title>
103 If the xsl:variable <literal>latex.override</literal>
104 is empty, the template outputs <literal>latex.book.preamblestart</literal>
105 and calls <literal>generate.latex.common.preamble</literal>. Otherwise,
106 it outputs the value of <literal>latex.override</literal> and
110 <refauthor>Ramon Casellas <email>casellas@aist.enst.fr</email></refauthor>
114 <xsl:template name="generate.latex.book.preamble">
116 <xsl:when test="$latex.override = ''">
117 <xsl:value-of select="$latex.book.preamblestart"/>
118 <xsl:value-of select="$latex.book.preamble.pre"/>
119 <xsl:call-template name="label.id"/>
120 <xsl:call-template name="generate.latex.common.preamble"/>
121 <xsl:call-template name="generate.latex.essential.preamble"/>
122 <xsl:value-of select="$latex.book.preamble.post"/>
125 <xsl:value-of select="$latex.override"/>
126 <xsl:call-template name="generate.latex.essential.preamble"/>
136 <!--#############################################################################
137 | latex.article.preamblestart and latex.book.preamblestart
138 |- #############################################################################
140 + ############################################################################## -->
142 <doc:variable name="latex.article.preamblestart" xmlns="">
143 <refpurpose> Generated Document class for articles. </refpurpose>
148 % --------------------------------------------
149 % Autogenerated LaTeX file for articles
150 % --------------------------------------------
151 \ifx\pdfoutput\undefined
152 \documentclass[spanish,french,english,a4paper,10pt,twoside,twocolumn]{article}
154 \documentclass[pdftex,spanish,french,english,a4paper,10pt,twoside,twocolumn]{article}
160 <xsl:variable name="latex.article.preamblestart">
161 <xsl:text>% -------------------------------------------- </xsl:text>
162 <xsl:text>% Autogenerated LaTeX file for articles </xsl:text>
163 <xsl:text>% -------------------------------------------- </xsl:text>
164 <xsl:text>\ifx\pdfoutput\undefined </xsl:text>
165 <xsl:text>\documentclass[</xsl:text>
166 <xsl:value-of select='$latex.documentclass.common' />
167 <xsl:text>,</xsl:text>
168 <xsl:value-of select='$latex.documentclass.article' />
169 <xsl:text>,</xsl:text>
170 <xsl:value-of select='$latex.documentclass.pdftex' />
171 <xsl:text>]{</xsl:text>
173 <xsl:when test="$latex.documentclass!=''"><xsl:value-of select="$latex.documentclass" /></xsl:when>
174 <xsl:otherwise><xsl:text>article</xsl:text></xsl:otherwise>
176 <xsl:text>} </xsl:text>
177 <xsl:text>\else </xsl:text>
178 <xsl:text>\documentclass[pdftex,</xsl:text>
179 <xsl:value-of select='$latex.documentclass.common' />
180 <xsl:text>,</xsl:text>
181 <xsl:value-of select='$latex.documentclass.article' />
182 <xsl:text>,</xsl:text>
183 <xsl:value-of select='$latex.documentclass.dvips' />
184 <xsl:text>]{</xsl:text>
186 <xsl:when test="$latex.documentclass!=''"><xsl:value-of select="$latex.documentclass" /></xsl:when>
187 <xsl:otherwise><xsl:text>article</xsl:text></xsl:otherwise>
189 <xsl:text>} </xsl:text>
190 <xsl:text>\fi </xsl:text>
193 <doc:variable name="latex.book.preamblestart" xmlns="">
194 <refpurpose>Generated Document class for books. </refpurpose>
199 % ------------------------------------------------------------
200 % Autogenerated LaTeX file for books
201 % ------------------------------------------------------------
202 \ifx\pdfoutput\undefined
203 \documentclass[spanish,french,english,a4paper,twoside,openright,10pt,final]{report}
205 \documentclass[pdftex,spanish,french,english,a4paper,twoside,openright,10pt,final]{report}
211 <xsl:variable name="latex.book.preamblestart">
212 <xsl:text>% ------------------------------------------------------------ </xsl:text>
213 <xsl:text>% Autogenerated LaTeX file for books </xsl:text>
214 <xsl:text>% ------------------------------------------------------------ </xsl:text>
215 <xsl:text>\ifx\pdfoutput\undefined </xsl:text>
216 <xsl:text>\documentclass[</xsl:text>
217 <xsl:value-of select='$latex.documentclass.common' />
218 <xsl:text>,</xsl:text>
219 <xsl:value-of select='$latex.documentclass.book' />
220 <xsl:text>,</xsl:text>
221 <xsl:value-of select='$latex.documentclass.pdftex' />
222 <xsl:text>]{</xsl:text>
224 <xsl:when test="$latex.documentclass!=''"><xsl:value-of select="$latex.documentclass" /></xsl:when>
225 <xsl:otherwise><xsl:text>report</xsl:text></xsl:otherwise>
227 <xsl:text>} </xsl:text>
228 <xsl:text>\else </xsl:text>
229 <xsl:text>\documentclass[pdftex,</xsl:text>
230 <xsl:value-of select='$latex.documentclass.common' />
231 <xsl:text>,</xsl:text>
232 <xsl:value-of select='$latex.documentclass.book' />
233 <xsl:text>,</xsl:text>
234 <xsl:value-of select='$latex.documentclass.dvips' />
235 <xsl:text>]{</xsl:text>
237 <xsl:when test="$latex.documentclass!=''"><xsl:value-of select="$latex.documentclass" /></xsl:when>
238 <xsl:otherwise><xsl:text>report</xsl:text></xsl:otherwise>
240 <xsl:text>} </xsl:text>
241 <xsl:text>\fi </xsl:text>
244 <!--#############################################################################
245 | generate.latex.common.preamble
246 |- #############################################################################
248 + ############################################################################## -->
250 <doc:variable name="generate.latex.common.preamble" xmlns="">
251 <refpurpose> Common LaTeX preamble shared by articles and books, and other
252 document classes. Most of the packages and package options are managed here </refpurpose>
256 The LaTeX preamble, after the document class and before the <literal>\begin{document}</literal>
263 <xsl:template name="generate.latex.common.preamble">
265 <xsl:when test="$latex.pdf.support=1"><xsl:value-of select="$latex.pdf.preamble"/></xsl:when>
266 <xsl:otherwise><xsl:text>\usepackage{graphicx} </xsl:text></xsl:otherwise>
268 <xsl:if test="local-name(.)='article'">
269 <xsl:value-of select="$latex.article.varsets"/>
271 <xsl:if test="local-name(.)='book'">
272 <xsl:value-of select="$latex.book.varsets"/>
274 <xsl:if test="$latex.use.fancyhdr=1">
275 <xsl:text>\usepackage{fancyhdr} </xsl:text>
276 <xsl:call-template name="generate.latex.pagestyle"/>
279 <xsl:if test="latex.fancyhdr.lh !=''"><xsl:text>\lhead{</xsl:text><xsl:value-of select="$latex.fancyhdr.lh"/><xsl:text>} </xsl:text></xsl:if>
280 <xsl:if test="latex.fancyhdr.ch !=''"><xsl:text>\chead{</xsl:text><xsl:value-of select="$latex.fancyhdr.ch"/><xsl:text>} </xsl:text></xsl:if>
281 <xsl:if test="latex.fancyhdr.rh !=''"><xsl:text>\rhead{</xsl:text><xsl:value-of select="$latex.fancyhdr.rh"/><xsl:text>} </xsl:text></xsl:if>
282 <xsl:if test="latex.fancyhdr.lf !=''"><xsl:text>\lfoot{</xsl:text><xsl:value-of select="$latex.fancyhdr.lf"/><xsl:text>} </xsl:text></xsl:if>
283 <xsl:if test="latex.fancyhdr.cf !=''"><xsl:text>\cfoot{</xsl:text><xsl:value-of select="$latex.fancyhdr.cf"/><xsl:text>} </xsl:text></xsl:if>
284 <xsl:if test="latex.fancyhdr.rf !=''"><xsl:text>\rfoot{</xsl:text><xsl:value-of select="$latex.fancyhdr.rf"/><xsl:text>} </xsl:text></xsl:if>
287 <xsl:text>\renewcommand{\headrulewidth}{0.4pt} </xsl:text>
288 <xsl:text>\renewcommand{\footrulewidth}{0.4pt} </xsl:text>
291 <xsl:text>% ---------------------- </xsl:text>
292 <xsl:text>% Most Common Packages </xsl:text>
293 <xsl:text>% ---------------------- </xsl:text>
294 <xsl:if test="$latex.use.makeidx=1"><xsl:text>\usepackage{makeidx} </xsl:text></xsl:if>
295 <xsl:text>\usepackage{varioref} </xsl:text>
296 <xsl:text>\usepackage{latexsym} </xsl:text>
297 <xsl:text>\usepackage{enumerate} </xsl:text>
298 <xsl:if test="$latex.use.fancybox=1">
299 <!-- must be before \usepackage{fancyvrb} -->
300 <xsl:text>\usepackage{fancybox} </xsl:text>
302 <xsl:text>\usepackage{float} </xsl:text>
303 <xsl:text>\usepackage{ragged2e} </xsl:text>
304 <xsl:if test="$latex.babel.language!=''">
305 <xsl:text>\usepackage[</xsl:text><xsl:value-of select="$latex.babel.language" /><xsl:text>]{babel} </xsl:text>
307 <xsl:if test="$latex.use.fancyvrb=1">
308 <!-- must be after \usepackage{fancybox} -->
309 <xsl:text>\usepackage{fancyvrb} </xsl:text>
310 <xsl:text>\makeatletter\@namedef{FV@fontfamily@default}{\def\FV@FontScanPrep{}\def\FV@FontFamily{}}\makeatother </xsl:text>
311 <xsl:if test="$latex.fancyvrb.tabsize!=''">
312 <xsl:text>\fvset{obeytabs=true,tabsize=</xsl:text>
313 <xsl:value-of select="$latex.fancyvrb.tabsize"/>
314 <xsl:text>} </xsl:text>
317 <xsl:if test="$latex.use.isolatin1=1"><xsl:text>\usepackage{isolatin1} </xsl:text></xsl:if>
318 <xsl:if test="$latex.use.parskip=1"><xsl:text>\usepackage{parskip} </xsl:text></xsl:if>
319 <xsl:if test="$latex.use.rotating=1"><xsl:text>\usepackage{rotating} </xsl:text></xsl:if>
320 <xsl:if test="$latex.use.subfigure=1"><xsl:text>\usepackage{subfigure} </xsl:text></xsl:if>
321 <xsl:if test="$latex.use.tabularx=1"><xsl:text>\usepackage{tabularx} </xsl:text></xsl:if>
322 <xsl:if test="$latex.use.umoline=1"><xsl:text>\usepackage{umoline} </xsl:text></xsl:if>
323 <xsl:if test="$latex.use.url=1"><xsl:text>\usepackage{url} </xsl:text></xsl:if>
325 <!-- Configure document font. -->
326 <xsl:if test="$latex.document.font != 'default'">
327 <xsl:text>% --------------- </xsl:text>
328 <xsl:text>% Document Font </xsl:text>
329 <xsl:text>% --------------- </xsl:text>
330 <xsl:text>\usepackage{</xsl:text><xsl:value-of select="$latex.document.font"/><xsl:text>} </xsl:text>
332 <!-- Support for keywords. -->
333 <xsl:text> \def\keywords{\vspace{-.3em} </xsl:text>
334 <xsl:text> \if@twocolumn </xsl:text>
335 <xsl:text> \small{\itshape </xsl:text>
336 <xsl:call-template name="gentext">
337 <xsl:with-param name="key">keywords</xsl:with-param>
339 <xsl:text> }\/\bfseries---$\!$% </xsl:text>
340 <xsl:text> \else </xsl:text>
341 <xsl:text> \begin{center}\small\bfseries </xsl:text>
342 <xsl:call-template name="gentext">
343 <xsl:with-param name="key">keywords</xsl:with-param>
345 <xsl:text> \end{center}\quotation\small </xsl:text>
346 <xsl:text> \fi} </xsl:text>
347 <xsl:text> \def\endkeywords{\vspace{0.6em}\par\if@twocolumn\else\endquotation\fi </xsl:text>
348 <xsl:text> \normalsize\rmfamily} </xsl:text>
350 <xsl:if test="$latex.math.support=1"><xsl:value-of select="$latex.math.preamble"/></xsl:if>
351 <xsl:if test="$latex.use.hyperref=1">
352 <xsl:call-template name="latex.hyperref.preamble"/>
354 <xsl:value-of select="$latex.admonition.environment"/>
355 <xsl:call-template name="latex.float.preamble"/>
356 <xsl:call-template name="latex.graphicext"/>
358 <xsl:when test='$latex.caption.swapskip=1'>
359 <xsl:text>% -------------------------------------------- </xsl:text>
360 <xsl:text>% $latex.caption.swapskip enabled for $formal.title.placement support </xsl:text>
361 <xsl:text>\newlength{\docbooktolatextempskip} </xsl:text>
362 <xsl:text>\newcommand{\captionswapskip}{\setlength{\docbooktolatextempskip}{\abovecaptionskip}</xsl:text>
363 <xsl:text>\setlength{\abovecaptionskip}{\belowcaptionskip}</xsl:text>
364 <xsl:text>\setlength{\belowcaptionskip}{\docbooktolatextempskip}} </xsl:text>
367 <xsl:text>\newcommand{\captionswapskip}{} </xsl:text>
370 <xsl:if test='$latex.hyphenation.tttricks=1'>
371 <xsl:text>% -------------------------------------------- </xsl:text>
372 <xsl:text>% Better linebreaks </xsl:text>
373 <xsl:text>\newcommand{\docbookhyphenatedot}[1]{{\hyphenchar\font=`\.\relax #1\hyphenchar\font=`\-}} </xsl:text>
374 <xsl:text>\newcommand{\docbookhyphenatefilename}[1]{{\hyphenchar\font=`\.\relax #1\hyphenchar\font=`\-}} </xsl:text>
375 <xsl:text>\newcommand{\docbookhyphenateurl}[1]{{\hyphenchar\font=`\/\relax #1\hyphenchar\font=`\-}} </xsl:text>
379 <doc:variable name="generate.latex.essential.preamble" xmlns="">
380 <refpurpose> Unavoidable LaTeX preamble shared by articles and books </refpurpose>
382 <para>Contains custom commands <emphasis>that you just can't get rid of!</emphasis></para>
385 <xsl:template name="generate.latex.essential.preamble">
386 <xsl:text>% -------------------------------------------- </xsl:text>
387 <xsl:text>\makeatletter </xsl:text>
388 <xsl:if test="$latex.use.hyperref!='1'">
389 <xsl:text>\newcommand{\href}[1]{{}} </xsl:text>
390 <xsl:text>\newcommand{\hyperlink}[1]{{}} </xsl:text>
391 <xsl:text>\newcommand{\hypertarget}[2]{#2} </xsl:text>
393 <xsl:if test="$latex.use.ucs='1'">
394 <xsl:text>\usepackage[</xsl:text>
395 <xsl:value-of select="$latex.ucs.options"/>
396 <xsl:text>]{ucs} </xsl:text>
398 <xsl:if test="$latex.entities='catcode'">
399 <xsl:text>\catcode`\&=\active\def&{\@ifnextchar##{\@docbooktolatexunicode\@gobble}{\&}} </xsl:text>
400 <xsl:if test="$latex.use.ucs!='1'">
402 % A few example Unicode characters.
403 % For full support, use the unicode pacakge from Dominique Unruh/CTAN.
404 \newcommand{\unichar}[1]{%
410 <xsl:text>\def\@docbooktolatexunicode#1;{\edef\@dbtemp{#1}\unichar{\@dbtemp}} </xsl:text>
412 <xsl:if test="$latex.entities='unicode'">
413 <xsl:text>\usepackage[utf8]{inputenc} </xsl:text>
416 \def\docbooktolatexgobble{\expandafter\@gobble}
417 % Facilitate use of \cite with \label
418 \newcommand{\docbooktolatexbibaux}[2]{%
419 \protected@write\@auxout{}{\string\global\string\@namedef{docbooktolatexcite@#1}{#2}}
421 \newcommand{\docbooktolatexcite}[2]{%
422 \@ifundefined{docbooktolatexcite@#1}%
424 {\def\@docbooktolatextemp{#2}\ifx\@docbooktolatextemp\@empty%
425 \cite{\@nameuse{docbooktolatexcite@#1}}%
426 \else\cite[#2]{\@nameuse{docbooktolatexcite@#1}}%
430 \newcommand{\docbooktolatexbackcite}[1]{%
431 \ifx\Hy@backout\@undefined\else%
432 \@ifundefined{docbooktolatexcite@#1}{%
436 \PackageInfo{backref}{back cite \string`#1\string' as \string`\@nameuse{docbooktolatexcite@#1}\string'}%
438 \Hy@backout{\@nameuse{docbooktolatexcite@#1}}%
442 % --------------------------------------------
443 % A way to honour <footnoteref>s
444 % Blame j-devenish (at) users.sourceforge.net
445 % In any other LaTeX context, this would probably go into a style file.
446 \newcommand{\docbooktolatexusefootnoteref}[1]{\@ifundefined{@fn@label@#1}%
447 {\hbox{\@textsuperscript{\normalfont ?}}%
448 \@latex@warning{Footnote label `#1' was not defined}}%
449 {\@nameuse{@fn@label@#1}}}
450 \newcommand{\docbooktolatexmakefootnoteref}[1]{%
451 \protected@write\@auxout{}%
452 {\global\string\@namedef{@fn@label@#1}{\@makefnmark}}%
453 \@namedef{@fn@label@#1}{\hbox{\@textsuperscript{\normalfont ?}}}%
455 % --------------------------------------------
456 % Hacks for honouring row/entry/@align
457 % (\hspace not effective when in paragraph mode)
458 % Naming convention for these macros is:
459 % 'docbooktolatex' 'align' {alignment-type} {position-within-entry}
460 % where r = right, l = left, c = centre
461 \newcommand{\docbooktolatexalignrl}{\protect\ifvmode\raggedleft\else\hfill\fi}
462 \newcommand{\docbooktolatexalignrr}{\protect}
463 \newcommand{\docbooktolatexalignll}{\protect\ifvmode\raggedright\else\fi}
464 \newcommand{\docbooktolatexalignlr}{\protect\ifvmode\else\hspace*\fill\fi}
465 \newcommand{\docbooktolatexaligncl}{\protect\ifvmode\centering\else\hfill\fi}
466 \newcommand{\docbooktolatexaligncr}{\protect\ifvmode\else\hspace*\fill\fi}
467 \ifx\captionswapskip\@undefined\newcommand{\captionswapskip}{}\fi
474 <!--#############################################################################
475 | Auxiliary templates and variables
476 |- #############################################################################
478 + ############################################################################## -->
480 <doc:template name="latex.float.preamble" xmlns="">
486 <xsl:template name="latex.float.preamble">
487 <xsl:text>% -------------------------------------------- </xsl:text>
488 <xsl:text>% Commands to manage/style/create floats </xsl:text>
489 <xsl:text>% figures, tables, algorithms, examples, eqn </xsl:text>
490 <xsl:text>% -------------------------------------------- </xsl:text>
491 <xsl:text> \floatstyle{ruled} </xsl:text>
492 <xsl:text> \restylefloat{figure} </xsl:text>
493 <xsl:text> \floatstyle{ruled} </xsl:text>
494 <xsl:text> \restylefloat{table} </xsl:text>
495 <xsl:text> \floatstyle{ruled} </xsl:text>
496 <xsl:text> \newfloat{program}{ht}{lop}[section] </xsl:text>
497 <xsl:text> \floatstyle{ruled} </xsl:text>
498 <xsl:text> \newfloat{example}{ht}{loe}[section] </xsl:text>
499 <xsl:text> \floatname{example}{</xsl:text>
500 <xsl:call-template name="gentext.element.name">
501 <xsl:with-param name="element.name">example</xsl:with-param>
503 <xsl:text>} </xsl:text>
504 <xsl:text> \floatstyle{ruled} </xsl:text>
505 <xsl:text> \newfloat{dbequation}{ht}{loe}[section] </xsl:text>
506 <xsl:text> \floatname{dbequation}{</xsl:text>
507 <xsl:call-template name="gentext.element.name">
508 <xsl:with-param name="element.name">equation</xsl:with-param>
510 <xsl:text>} </xsl:text>
511 <xsl:text> \floatstyle{boxed} </xsl:text>
512 <xsl:text> \newfloat{algorithm}{ht}{loa}[section] </xsl:text>
513 <xsl:text> \floatname{algorithm}{Algorithm} </xsl:text>
519 <!-- DOCUMENTATION -->
520 <doc:variable name="latex.pdf.preamble" xmlns="">
524 <formalpara><title>Default Value:</title>
527 % --------------------------------------------
528 % Check for PDFLaTeX/LaTeX
529 % --------------------------------------------
531 \ifx\pdfoutput\undefined
532 \pdffalse % we are not running PDFLaTeX
534 \pdfoutput=1 % we are running PDFLaTeX
537 % --------------------------------------------
538 % Load graphicx package with pdf if needed
539 % --------------------------------------------
541 \usepackage[pdftex]{graphicx}
544 \usepackage{graphicx}
549 <refauthor>Ramon Casellas <email>casellas@aist.enst.fr</email></refauthor>
553 <xsl:variable name="latex.pdf.preamble">
554 <xsl:text>\usepackage{ifthen} </xsl:text>
555 <xsl:text>% -------------------------------------------- </xsl:text>
556 <xsl:text>% Check for PDFLaTeX/LaTeX </xsl:text>
557 <xsl:text>% -------------------------------------------- </xsl:text>
558 <xsl:text>\newif\ifpdf </xsl:text>
559 <xsl:text>\ifx\pdfoutput\undefined </xsl:text>
560 <xsl:text>\pdffalse % we are not running PDFLaTeX </xsl:text>
561 <xsl:text>\else </xsl:text>
562 <xsl:text>\pdfoutput=1 % we are running PDFLaTeX </xsl:text>
563 <xsl:text>\pdftrue </xsl:text>
564 <xsl:text>\fi </xsl:text>
565 <xsl:text>% -------------------------------------------- </xsl:text>
566 <xsl:text>% Load graphicx package with pdf if needed </xsl:text>
567 <xsl:text>% -------------------------------------------- </xsl:text>
568 <xsl:text>\ifpdf </xsl:text>
569 <xsl:text>\usepackage[pdftex]{graphicx} </xsl:text>
570 <xsl:text>\pdfcompresslevel=9 </xsl:text>
571 <xsl:text>\else </xsl:text>
572 <xsl:text>\usepackage{graphicx} </xsl:text>
573 <xsl:text>\fi </xsl:text>
578 <!-- DOCUMENTATION -->
579 <doc:template name="latex.hyperref.preamble" xmlns="">
580 <refpurpose> Manage the part of the preamble that handles the hyperref package.</refpurpose>
582 <para> This template outputs the LaTeX code <literal>\usepackage[...]{hyperref}</literal>
583 in order to use hyperlinks, backrefs and other goodies. If PDF support is activated,
584 outputs laTeX code to detect whether the document is being compiled with
585 <filename>pdflatex</filename> or <filename>latex</filename> to supply the
586 right parameters (pdftex, dvips, etc). </para>
587 <formalpara><title>To Do</title> The package options should be optained
588 from XSL variables.</formalpara>
589 <formalpara><title>Default Value with PDF support</title>
591 % --------------------------------------------
592 % Load hyperref package with pdf if needed
593 % --------------------------------------------
595 \usepackage[pdftex,bookmarksnumbered,colorlinks,backref, bookmarks, breaklinks, linktocpage]{hyperref}
597 \usepackage[dvips,bookmarksnumbered,colorlinks,backref, bookmarks, breaklinks, linktocpage]{hyperref}
599 % --------------------------------------------
602 <formalpara><title>Default Value without PDF support</title>
604 % --------------------------------------------
605 % Load hyperref package
606 % --------------------------------------------
607 \usepackage[dvips,bookmarksnumbered,colorlinks,backref, bookmarks, breaklinks, linktocpage]{hyperref}
613 <xsl:template name="latex.hyperref.preamble">
615 <xsl:when test="$latex.pdf.support=1">
616 <xsl:text>% -------------------------------------------- </xsl:text>
617 <xsl:text>% Load hyperref package with pdf if needed </xsl:text>
618 <xsl:text>% -------------------------------------------- </xsl:text>
619 <xsl:text>\ifpdf </xsl:text>
620 <xsl:text>\usepackage[pdftex,</xsl:text>
621 <xsl:value-of select="$latex.hyperref.param.common" />
622 <xsl:text>,</xsl:text>
623 <xsl:value-of select="$latex.hyperref.param.pdftex" />
624 <xsl:text>]{hyperref} </xsl:text>
625 <xsl:text>\else </xsl:text>
626 <xsl:text>\usepackage[dvips,</xsl:text>
627 <xsl:value-of select="$latex.hyperref.param.common" />
628 <xsl:text>,</xsl:text>
629 <xsl:value-of select="$latex.hyperref.param.dvips" />
630 <xsl:text>]{hyperref} </xsl:text>
631 <xsl:text>\fi </xsl:text>
632 <xsl:text>% -------------------------------------------- </xsl:text>
635 <xsl:text>% -------------------------------------------- </xsl:text>
636 <xsl:text>% Load hyperref package </xsl:text>
637 <xsl:text>% -------------------------------------------- </xsl:text>
638 <xsl:text>\usepackage[dvips,</xsl:text>
639 <xsl:value-of select="$latex.hyperref.param.common" />
640 <xsl:text>,</xsl:text>
641 <xsl:value-of select="$latex.hyperref.param.dvips" />
642 <xsl:text>]{hyperref} </xsl:text>
659 <!--#############################################################################
660 | latex.math.preamble
661 |- #############################################################################
662 | This "preamble chunk" declares usage of most common AMS packages.
663 | Defines new useful commands.
664 + ############################################################################## -->
666 <!-- DOCUMENTATION -->
667 <doc:variable name="latex.math.preamble" xmlns="">
668 <refpurpose> Manage the math related preamble</refpurpose>
674 <xsl:variable name="latex.math.preamble">
675 <xsl:text>% -------------------------------------------- </xsl:text>
676 <xsl:text>% Math support </xsl:text>
677 <xsl:text>% -------------------------------------------- </xsl:text>
678 <xsl:text>\usepackage{amsmath,amsthm, amsfonts, amssymb, amsxtra,amsopn} </xsl:text>
679 <xsl:text>%\newtheorem{thm}{Theorem}[section] </xsl:text>
680 <xsl:text>%\newtheorem{cor}[section]{Corollary} </xsl:text>
681 <xsl:text>%\newtheorem{lem}[section]{Lemma} </xsl:text>
682 <xsl:text>%\newtheorem{defn}[section]{Definition} </xsl:text>
683 <xsl:text>%\newtheorem{prop}[section]{Proposition} </xsl:text>
684 <xsl:text>%\newtheorem{ax}{Axiom} </xsl:text>
685 <xsl:text>%\newtheorem{theorem}[section]{Theorem} </xsl:text>
686 <xsl:text>%\newtheorem{corollary}{Corollary} </xsl:text>
687 <xsl:text>%\newtheorem{lemma}{Lemma} </xsl:text>
688 <xsl:text>%\newtheorem{proposition}{Proposition} </xsl:text>
689 <xsl:text>%\theoremstyle{definition} </xsl:text>
690 <xsl:text>%\newtheorem{definition}{Definition} </xsl:text>
691 <xsl:text>%\theoremstyle{remark} </xsl:text>
692 <xsl:text>%\newtheorem{rem}{Remark} </xsl:text>
693 <xsl:text>%\newtheorem*{notation}{Notation} </xsl:text>
694 <xsl:text>%\newcommand{\ntt}{\normalfont\ttfamily} </xsl:text>
695 <xsl:text>%\newcommand{\thmref}[1]{Theorem~\ref{#1}} </xsl:text>
696 <xsl:text>%\newcommand{\secref}[1]{\S\ref{#1}} </xsl:text>
697 <xsl:text>%\newcommand{\lemref}[1]{Lemma~\ref{#1}} </xsl:text>
698 <xsl:text> \newcommand{\bysame}{\mbox{\rule{3em}{.4pt}}\,} </xsl:text>
699 <xsl:text> \newcommand{\A}{\mathcal{A}} </xsl:text>
700 <xsl:text> \newcommand{\B}{\mathcal{B}} </xsl:text>
701 <xsl:text> \newcommand{\XcY}{{(X,Y)}} </xsl:text>
702 <xsl:text> \newcommand{\SX}{{S_X}} </xsl:text>
703 <xsl:text> \newcommand{\SY}{{S_Y}} </xsl:text>
704 <xsl:text> \newcommand{\SXY}{{S_{X,Y}}} </xsl:text>
705 <xsl:text> \newcommand{\SXgYy}{{S_{X|Y}(y)}} </xsl:text>
706 <xsl:text> \newcommand{\Cw}[1]{{\hat C_#1(X|Y)}} </xsl:text>
707 <xsl:text> \newcommand{\G}{{G(X|Y)}} </xsl:text>
708 <xsl:text> \newcommand{\PY}{{P_{\mathcal{Y}}}} </xsl:text>
709 <xsl:text> \newcommand{\X}{\mathcal{X}} </xsl:text>
710 <xsl:text> \newcommand{\wt}{\widetilde} </xsl:text>
711 <xsl:text> \newcommand{\wh}{\widehat} </xsl:text>
712 <xsl:text> % -------------------------------------------- </xsl:text>
713 <xsl:text> %\DeclareMathOperator{\per}{per} </xsl:text>
714 <xsl:text> \DeclareMathOperator{\cov}{cov} </xsl:text>
715 <xsl:text> \DeclareMathOperator{\non}{non} </xsl:text>
716 <xsl:text> \DeclareMathOperator{\cf}{cf} </xsl:text>
717 <xsl:text> \DeclareMathOperator{\add}{add} </xsl:text>
718 <xsl:text> \DeclareMathOperator{\Cham}{Cham} </xsl:text>
719 <xsl:text> \DeclareMathOperator{\IM}{Im} </xsl:text>
720 <xsl:text> \DeclareMathOperator{\esssup}{ess\,sup} </xsl:text>
721 <xsl:text> \DeclareMathOperator{\meas}{meas} </xsl:text>
722 <xsl:text> \DeclareMathOperator{\seg}{seg} </xsl:text>
723 <xsl:text>% -------------------------------------------- </xsl:text>
729 <!--#############################################################################
731 |- #############################################################################
733 + ############################################################################## -->
735 <doc:template name="latex.graphicext" xmlns="">
736 <refpurpose> Declared graphic extensions </refpurpose>
738 This template checks whether the user has overriden <command>grafic.default.extension</command>
739 Otherwise, declares .pdf, .png, .jpg if using pdflatex and .eps if using latex.
740 <programlisting><![CDATA[
741 <xsl:template name="latex.graphicext">
743 <xsl:when test="$graphic.default.extension !=''">
744 <xsl:text>\DeclareGraphicsExtensions{</xsl:text>
745 <xsl:if test="not(contains($graphic.default.extension,'.'))">
746 <xsl:text>.</xsl:text>
748 <xsl:value-of select="$graphic.default.extension"/>
749 <xsl:text>} </xsl:text>
753 <xsl:when test="$latex.pdf.support=1">
754 <xsl:text>\ifpdf </xsl:text>
755 <xsl:text>\DeclareGraphicsExtensions{.pdf,.png,.jpg} </xsl:text>
756 <xsl:text>\else </xsl:text>
757 <xsl:text>\DeclareGraphicsExtensions{.eps} </xsl:text>
758 <xsl:text>\fi </xsl:text>
761 <xsl:text>\DeclareGraphicsExtensions{.eps} </xsl:text>
775 <xsl:template name="latex.graphicext">
777 <xsl:when test="$graphic.default.extension !=''">
778 <xsl:text>\DeclareGraphicsExtensions{</xsl:text>
779 <xsl:if test="not(contains($graphic.default.extension,'.'))">
780 <xsl:text>.</xsl:text>
782 <xsl:value-of select="$graphic.default.extension"/>
783 <xsl:text>} </xsl:text>
787 <xsl:when test="$latex.pdf.support=1">
788 <xsl:text>\ifpdf </xsl:text>
789 <xsl:text>\DeclareGraphicsExtensions{.pdf,.png,.jpg} </xsl:text>
790 <xsl:text>\else </xsl:text>
791 <xsl:text>\DeclareGraphicsExtensions{.eps} </xsl:text>
792 <xsl:text>\fi </xsl:text>
795 <xsl:text>\DeclareGraphicsExtensions{.eps} </xsl:text>
802 <xsl:template name="generate.latex.cell.separator">
804 <xsl:when test="$latex.entities='catcode'">
805 <xsl:text> \catcode`\&=4 &\catcode`\&=\active </xsl:text>
808 <xsl:text> & </xsl:text>