| |
---|
| | <xsl-out:variable name="document-name" select="reverse( tokenize( base-uri(), '/' ) )[1]" /> |
---|
| | |
---|
| | <!-- Include the generated Oracle documentation code. --> |
---|
| | <xsl-out:include href="oracle-docs.xsl" /> |
---|
| | |
---|
| | |
---|
| | <!-- |
---|
| | Boilerplate (Xe)LaTeX code for loading hyperref. If the package is already loaded (by the document class), attempting to load it again will cause an "option clash" error. To avoid this, check first whether it's already loaded. We apply the required settings afterwards regardless. |
---|
| | --> |
---|
| | <xsl-out:variable name="latex-hyperref-boilerplate"> |
---|
| | <xsl-out:text> |
---|
| | % Avoid option clash if document class already loaded it. |
---|
| | \makeatletter |
---|
| | \@ifpackageloaded{hyperref}{}{\usepackage{hyperref}} |
---|
| | \makeatother |
---|
| | |
---|
| | % Safer to specify the hyperref options directly rather than relying on |
---|
| | % the default hyperref.cfg, as XeLaTeX seems to ignore it :(. |
---|
| | \hypersetup{pdfpagemode=UseNone,colorlinks,urlcolor=blue,citecolor=blue,% |
---|
| | linkcolor=blue,breaklinks} |
---|
| | </xsl-out:text> |
---|
| | </xsl-out:variable> |
---|
| | |
---|
| | <!-- |
---|
| | We're going to use the text encoding in a few different places, so let's work out what it should be now. |
---|
| | --> |
---|
| | <xsl:variable name="text-encoding"> |
---|
| |
---|
| | </xsl:otherwise> |
---|
| | |
---|
| | </xsl:choose> |
---|
| | </xsl:variable> |
---|
| | |
---|
| | |
---|
| | |
---|
| | <!-- |
---|
| | First, output the document preamble according to target format. This is generally different for each target format. |
---|
| | --> |
---|
| | <xsl:choose> |
---|
| |
---|
| | </xsl-out:text> |
---|
| | |
---|
| | <xsl-out:apply-templates select="environment/latex-packages" /> |
---|
| | |
---|
| | <xsl-out:value-of select="$latex-hyperref-boilerplate" /> |
---|
| | |
---|
| | <xsl-out:text> |
---|
| | % Safer to specify the hyperref options directly rather than relying on |
---|
| | % the default hyperref.cfg, as XeLaTeX seems to ignore it :(. |
---|
| | \usepackage[ pdfpagemode=UseNone,% |
---|
| | colorlinks,% |
---|
| | urlcolor=blue,% |
---|
| | citecolor=blue,% |
---|
| | linkcolor=blue,% |
---|
| | breaklinks ]{hyperref} |
---|
| | |
---|
| | \renewcommand{\ttdefault}{blg} |
---|
| | </xsl-out:text> |
---|
| | </xsl-out:template> |
---|
| | |
---|
| |
---|
| | </xsl-out:text> |
---|
| | |
---|
| | <xsl-out:apply-templates select="environment/latex-packages" /> |
---|
| | |
---|
| | <xsl-out:value-of select="$latex-hyperref-boilerplate" /> |
---|
| | |
---|
| | <xsl-out:text> |
---|
| | % Safer to specify the hyperref options directly rather than relying on |
---|
| | % the default hyperref.cfg, as XeLaTeX seems to ignore it :(. |
---|
| | \usepackage[ pdfpagemode=UseNone,% |
---|
| | colorlinks,% |
---|
| | urlcolor=blue,% |
---|
| | citecolor=blue,% |
---|
| | linkcolor=blue,% |
---|
| | breaklinks ]{hyperref} |
---|
| | |
---|
| | \defaultfontfeatures{Mapping=tex-text} |
---|
| | \setmainfont{TeX Gyre Pagella} |
---|
| | \setmathsfont(Digits){TeX Gyre Pagella} |
---|
| | \setmonofont[Scale=MatchLowercase]{Letter Gothic 12 Pitch} |
---|
| |
---|
| | <xsl:when test="($target-format = 'latex') or ($target-format = 'xelatex')"> |
---|
| | |
---|
| | <!-- Set to pdf if using PDFLaTeX, otherwise eps. --> |
---|
| | <xsl-out:param name="image-format"><xsl:text>pdf</xsl:text></xsl-out:param> |
---|
| | |
---|
| | <!-- |
---|
| | |
---|
| | |
---|
| | <!-- |
---|
| | Generate macro to encode the document class name. |
---|
| | This is currently BROKEN. If the specified document class loads packages that are then loaded by the boilerplate below with different optons, it will cause LaTeX "option clash" errors. Therefore, DO NOT use the @latex-document-class attribute for now until a solution can be devised! |
---|
| | |
---|
| | Note that if the document class loads a package that the boilerplate in this template also attempts to load, it may cause an "option clash" error. If so, the loading of that package will need to be made conditional in the boilerplate (using \@ifpackageloaded). So far this applies to the following packages: |
---|
| | * geometry |
---|
| | * hyperref |
---|
| | |
---|
| | Other packages that *might* cause similar problems (guessing here): |
---|
| | * listings |
---|
| | --> |
---|
| | <xsl-out:template name="setup-document-class"> |
---|
| | <xsl-out:text> |
---|
| | \def\DocumentClass{</xsl-out:text> |
---|
| |
---|
| | </xsl-out:if> |
---|
| | <xsl-out:text>} |
---|
| | </xsl-out:text> |
---|
| | </xsl-out:template> |
---|
| | |
---|
| | <!-- |
---|
| | Generate macro to specify document class options. |
---|
| | --> |
---|
| | <xsl-out:template name="setup-class-options"> |
---|
| | <xsl-out:text> |
---|
| | \def\LaTeXOptions{</xsl-out:text> |
---|
| | <xsl-out:value-of select="string-join(( |
---|
| | if (@latex-font-size) then @latex-font-size else '12pt', |
---|
| | if (@latex-paper-size) then @latex-paper-size else 'a4paper', |
---|
| | @latex-class-options), ',')" /> |
---|
| | <xsl-out:text>} |
---|
| | </xsl-out:text> |
---|
| | </xsl-out:template> |
---|
| | |
---|
| | <!-- *** (Xe)LaTeX Source Output *** --> |
---|
| | |
---|
| | <xsl-out:template match="/document"> |
---|
| |
---|
| | <xsl-out:text> |
---|
| | % THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT! |
---|
| | |
---|
| | </xsl-out:text> |
---|
| | <xsl-out:call-template name="setup-class-options" /> |
---|
| | <xsl-out:call-template name="setup-document-class" /> |
---|
| | <xsl-out:text> |
---|
| | \PassOptionsToClass{\LaTeXOptions}{\DocumentClass} |
---|
| | \documentclass{\DocumentClass} |
---|
| | |
---|
| | \usepackage[margin=1in]{geometry} |
---|
| | % Avoid option clash if document class already loaded it. |
---|
| | \makeatletter |
---|
| | \@ifpackageloaded{geometry}{}{\usepackage[margin=1in]{geometry}} |
---|
| | \makeatother |
---|
| | |
---|
| | \usepackage{multirow} |
---|
| | \usepackage{graphicx} |
---|
| | \usepackage{verbatim} % needed for \verbatiminput |
---|
| | \usepackage{relalg} % needed for join operators |
---|
| |
---|
| | |
---|
| | <xsl-out:text> |
---|
| | \newenvironment{answer}{\par\vspace{0.5em}\itshape}{\normalfont\vspace{1.5em}} |
---|
| | |
---|
| | % Listings setup. We preload the most obviously like languages to speed things |
---|
| | % Listings setup. We preload the most commonly used languages to speed things |
---|
| | % up. Other languages will still work, just not quite as quickly. |
---|
| | \lstloadlanguages{Oracle} |
---|
| | \lstset{basicstyle=\ttfamily,basewidth=0.5em,escapeinside={(@}{@)}, |
---|
| | showspaces=false,showstringspaces=false} |
---|
| | |
---|
| | % Environment for worksheet exercises. |
---|
| | \newcounter{exercise} |
---|
| | \setcounter{exercise}{0} |
---|
| | \newenvironment{exercise}% |
---|
| | {\noindent\refstepcounter{exercise}\begin{boxedminipage}{\columnwidth}\textbf{Exercise \theexercise: }}% |
---|
| | {\end{boxedminipage}} |
---|
| | |
---|
| | </xsl-out:text> |
---|
| | |
---|
| | <xsl-out:apply-templates select="title" mode="preamble" /> |
---|
| |
---|
|