$Id: preamble.mod.xsl,v 1.1.2.1 2003/05/01 14:06:15 jelmer Exp $ Ramon Casellas James Devenish 2000200120022003 Ramon Casellas Variables and Templates used in LaTeX Preamble Generation
Introduction This section described the variables and templates that are used in the generation of the outtput LaTeX preamble. Basically, the LaTeX preamble depends on the XML document, that is, on whether it is an article or a book.
Flow
Articles
Books
Top level template, called by article template, responsible of generating the LaTeX preamble according to user XSL variables and templates. Overview If the xsl:variable latex.override is empty, the template outputs latex.article.preamblestart and calls generate.latex.common.preamble. Otherwise, it outputs the value of latex.override and exists. Ramon Casellas casellas@aist.enst.fr Top level template, called by book template, responsible of generating the LaTeX preamble according to user XSL variables and templates. Overview If the xsl:variable latex.override is empty, the template outputs latex.book.preamblestart and calls generate.latex.common.preamble. Otherwise, it outputs the value of latex.override and exists. Ramon Casellas casellas@aist.enst.fr Generated Document class for articles. % -------------------------------------------- % Autogenerated LaTeX file for articles % -------------------------------------------- \ifx\pdfoutput\undefined \documentclass[spanish,french,english,a4paper,10pt,twoside,twocolumn]{article} \else \documentclass[pdftex,spanish,french,english,a4paper,10pt,twoside,twocolumn]{article} \fi % -------------------------------------------- % Autogenerated LaTeX file for articles % -------------------------------------------- \ifx\pdfoutput\undefined \documentclass[ , , ]{ article } \else \documentclass[pdftex, , , ]{ article } \fi Generated Document class for books. % ------------------------------------------------------------ % Autogenerated LaTeX file for books % ------------------------------------------------------------ \ifx\pdfoutput\undefined \documentclass[spanish,french,english,a4paper,twoside,openright,10pt,final]{report} \else \documentclass[pdftex,spanish,french,english,a4paper,twoside,openright,10pt,final]{report} \fi % ------------------------------------------------------------ % Autogenerated LaTeX file for books % ------------------------------------------------------------ \ifx\pdfoutput\undefined \documentclass[ , , ]{ report } \else \documentclass[pdftex, , , ]{ report } \fi Common LaTeX preamble shared by articles and books, and other document classes. Most of the packages and package options are managed here The LaTeX preamble, after the document class and before the \begin{document} command. \usepackage{graphicx} \usepackage{fancyhdr} \renewcommand{\headrulewidth}{0.4pt} \renewcommand{\footrulewidth}{0.4pt} % ---------------------- % Most Common Packages % ---------------------- \usepackage{makeidx} \usepackage{varioref} \usepackage{latexsym} \usepackage{enumerate} \usepackage{fancybox} \usepackage{float} \usepackage{ragged2e} \usepackage[]{babel} \usepackage{fancyvrb} \makeatletter\@namedef{FV@fontfamily@default}{\def\FV@FontScanPrep{}\def\FV@FontFamily{}}\makeatother \fvset{obeytabs=true,tabsize= } \usepackage{isolatin1} \usepackage{parskip} \usepackage{rotating} \usepackage{subfigure} \usepackage{tabularx} \usepackage{umoline} \usepackage{url} % --------------- % Document Font % --------------- \usepackage{} \def\keywords{\vspace{-.3em} \if@twocolumn \small{\itshape keywords }\/\bfseries---$\!$% \else \begin{center}\small\bfseries keywords \end{center}\quotation\small \fi} \def\endkeywords{\vspace{0.6em}\par\if@twocolumn\else\endquotation\fi \normalsize\rmfamily} % -------------------------------------------- % $latex.caption.swapskip enabled for $formal.title.placement support \newlength{\docbooktolatextempskip} \newcommand{\captionswapskip}{\setlength{\docbooktolatextempskip}{\abovecaptionskip} \setlength{\abovecaptionskip}{\belowcaptionskip} \setlength{\belowcaptionskip}{\docbooktolatextempskip}} \newcommand{\captionswapskip}{} % -------------------------------------------- % Better linebreaks \newcommand{\docbookhyphenatedot}[1]{{\hyphenchar\font=`\.\relax #1\hyphenchar\font=`\-}} \newcommand{\docbookhyphenatefilename}[1]{{\hyphenchar\font=`\.\relax #1\hyphenchar\font=`\-}} \newcommand{\docbookhyphenateurl}[1]{{\hyphenchar\font=`\/\relax #1\hyphenchar\font=`\-}} Unavoidable LaTeX preamble shared by articles and books Contains custom commands that you just can't get rid of! % -------------------------------------------- \makeatletter \newcommand{\href}[1]{{}} \newcommand{\hyperlink}[1]{{}} \newcommand{\hypertarget}[2]{#2} \usepackage[ ]{ucs} \catcode`\&=\active\def&{\@ifnextchar##{\@docbooktolatexunicode\@gobble}{\&}} \def\@docbooktolatexunicode#1;{\edef\@dbtemp{#1}\unichar{\@dbtemp}} \usepackage[utf8]{inputenc} s % Blame j-devenish (at) users.sourceforge.net % In any other LaTeX context, this would probably go into a style file. \newcommand{\docbooktolatexusefootnoteref}[1]{\@ifundefined{@fn@label@#1}% {\hbox{\@textsuperscript{\normalfont ?}}% \@latex@warning{Footnote label `#1' was not defined}}% {\@nameuse{@fn@label@#1}}} \newcommand{\docbooktolatexmakefootnoteref}[1]{% \protected@write\@auxout{}% {\global\string\@namedef{@fn@label@#1}{\@makefnmark}}% \@namedef{@fn@label@#1}{\hbox{\@textsuperscript{\normalfont ?}}}% } % -------------------------------------------- % Hacks for honouring row/entry/@align % (\hspace not effective when in paragraph mode) % Naming convention for these macros is: % 'docbooktolatex' 'align' {alignment-type} {position-within-entry} % where r = right, l = left, c = centre \newcommand{\docbooktolatexalignrl}{\protect\ifvmode\raggedleft\else\hfill\fi} \newcommand{\docbooktolatexalignrr}{\protect} \newcommand{\docbooktolatexalignll}{\protect\ifvmode\raggedright\else\fi} \newcommand{\docbooktolatexalignlr}{\protect\ifvmode\else\hspace*\fill\fi} \newcommand{\docbooktolatexaligncl}{\protect\ifvmode\centering\else\hfill\fi} \newcommand{\docbooktolatexaligncr}{\protect\ifvmode\else\hspace*\fill\fi} \ifx\captionswapskip\@undefined\newcommand{\captionswapskip}{}\fi \makeatother ]]> % -------------------------------------------- % Commands to manage/style/create floats % figures, tables, algorithms, examples, eqn % -------------------------------------------- \floatstyle{ruled} \restylefloat{figure} \floatstyle{ruled} \restylefloat{table} \floatstyle{ruled} \newfloat{program}{ht}{lop}[section] \floatstyle{ruled} \newfloat{example}{ht}{loe}[section] \floatname{example}{ example } \floatstyle{ruled} \newfloat{dbequation}{ht}{loe}[section] \floatname{dbequation}{ equation } \floatstyle{boxed} \newfloat{algorithm}{ht}{loa}[section] \floatname{algorithm}{Algorithm} Default Value: \usepackage{ifthen} % -------------------------------------------- % Check for PDFLaTeX/LaTeX % -------------------------------------------- \newif\ifpdf \ifx\pdfoutput\undefined \pdffalse % we are not running PDFLaTeX \else \pdfoutput=1 % we are running PDFLaTeX \pdftrue \fi % -------------------------------------------- % Load graphicx package with pdf if needed % -------------------------------------------- \ifpdf \usepackage[pdftex]{graphicx} \pdfcompresslevel=9 \else \usepackage{graphicx} \fi Ramon Casellas casellas@aist.enst.fr \usepackage{ifthen} % -------------------------------------------- % Check for PDFLaTeX/LaTeX % -------------------------------------------- \newif\ifpdf \ifx\pdfoutput\undefined \pdffalse % we are not running PDFLaTeX \else \pdfoutput=1 % we are running PDFLaTeX \pdftrue \fi % -------------------------------------------- % Load graphicx package with pdf if needed % -------------------------------------------- \ifpdf \usepackage[pdftex]{graphicx} \pdfcompresslevel=9 \else \usepackage{graphicx} \fi Manage the part of the preamble that handles the hyperref package. This template outputs the LaTeX code \usepackage[...]{hyperref} in order to use hyperlinks, backrefs and other goodies. If PDF support is activated, outputs laTeX code to detect whether the document is being compiled with pdflatex or latex to supply the right parameters (pdftex, dvips, etc). To Do The package options should be optained from XSL variables. Default Value with PDF support % -------------------------------------------- % Load hyperref package with pdf if needed % -------------------------------------------- \ifpdf \usepackage[pdftex,bookmarksnumbered,colorlinks,backref, bookmarks, breaklinks, linktocpage]{hyperref} \else \usepackage[dvips,bookmarksnumbered,colorlinks,backref, bookmarks, breaklinks, linktocpage]{hyperref} \fi % -------------------------------------------- Default Value without PDF support % -------------------------------------------- % Load hyperref package % -------------------------------------------- \usepackage[dvips,bookmarksnumbered,colorlinks,backref, bookmarks, breaklinks, linktocpage]{hyperref} % -------------------------------------------- % Load hyperref package with pdf if needed % -------------------------------------------- \ifpdf \usepackage[pdftex, , ]{hyperref} \else \usepackage[dvips, , ]{hyperref} \fi % -------------------------------------------- % -------------------------------------------- % Load hyperref package % -------------------------------------------- \usepackage[dvips, , ]{hyperref} Manage the math related preamble % -------------------------------------------- % Math support % -------------------------------------------- \usepackage{amsmath,amsthm, amsfonts, amssymb, amsxtra,amsopn} %\newtheorem{thm}{Theorem}[section] %\newtheorem{cor}[section]{Corollary} %\newtheorem{lem}[section]{Lemma} %\newtheorem{defn}[section]{Definition} %\newtheorem{prop}[section]{Proposition} %\newtheorem{ax}{Axiom} %\newtheorem{theorem}[section]{Theorem} %\newtheorem{corollary}{Corollary} %\newtheorem{lemma}{Lemma} %\newtheorem{proposition}{Proposition} %\theoremstyle{definition} %\newtheorem{definition}{Definition} %\theoremstyle{remark} %\newtheorem{rem}{Remark} %\newtheorem*{notation}{Notation} %\newcommand{\ntt}{\normalfont\ttfamily} %\newcommand{\thmref}[1]{Theorem~\ref{#1}} %\newcommand{\secref}[1]{\S\ref{#1}} %\newcommand{\lemref}[1]{Lemma~\ref{#1}} \newcommand{\bysame}{\mbox{\rule{3em}{.4pt}}\,} \newcommand{\A}{\mathcal{A}} \newcommand{\B}{\mathcal{B}} \newcommand{\XcY}{{(X,Y)}} \newcommand{\SX}{{S_X}} \newcommand{\SY}{{S_Y}} \newcommand{\SXY}{{S_{X,Y}}} \newcommand{\SXgYy}{{S_{X|Y}(y)}} \newcommand{\Cw}[1]{{\hat C_#1(X|Y)}} \newcommand{\G}{{G(X|Y)}} \newcommand{\PY}{{P_{\mathcal{Y}}}} \newcommand{\X}{\mathcal{X}} \newcommand{\wt}{\widetilde} \newcommand{\wh}{\widehat} % -------------------------------------------- %\DeclareMathOperator{\per}{per} \DeclareMathOperator{\cov}{cov} \DeclareMathOperator{\non}{non} \DeclareMathOperator{\cf}{cf} \DeclareMathOperator{\add}{add} \DeclareMathOperator{\Cham}{Cham} \DeclareMathOperator{\IM}{Im} \DeclareMathOperator{\esssup}{ess\,sup} \DeclareMathOperator{\meas}{meas} \DeclareMathOperator{\seg}{seg} % -------------------------------------------- Declared graphic extensions This template checks whether the user has overriden grafic.default.extension Otherwise, declares .pdf, .png, .jpg if using pdflatex and .eps if using latex. \DeclareGraphicsExtensions{ . } \ifpdf \DeclareGraphicsExtensions{.pdf,.png,.jpg} \else \DeclareGraphicsExtensions{.eps} \fi \DeclareGraphicsExtensions{.eps} ]]> \DeclareGraphicsExtensions{ . } \ifpdf \DeclareGraphicsExtensions{.pdf,.png,.jpg} \else \DeclareGraphicsExtensions{.eps} \fi \DeclareGraphicsExtensions{.eps} \catcode`\&=4 &\catcode`\&=\active &