]> pere.pagekite.me Git - text-madewithcc.git/blob - extra/pdf.xsl
Translated using Weblate (Norwegian Bokmål)
[text-madewithcc.git] / extra / pdf.xsl
1 <?xml version='1.0' encoding="UTF-8"?>
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
3
4 <xsl:param name="latex.class.book">myclass</xsl:param>
5
6 <!-- Layout for printing on US Letter paper -->
7 <!-- -->
8 <!-- Should be equivalent to next (commented) line, and should match the -->
9 <!-- default behaviour, but it didn't work... -->
10 <!-- -->
11 <!-- <xsl:param name="paper.type">USletter</xsl:param> -->
12 <xsl:param name="page.width">8.5in</xsl:param>
13 <xsl:param name="page.height">11in</xsl:param>
14
15 <xsl:param name="page.margin.inner">1.5in</xsl:param>
16 <xsl:param name="page.margin.outer">1.5in</xsl:param>
17
18 <xsl:param name="page.margin.top">1in</xsl:param>
19 <xsl:param name="page.margin.bottom">1in</xsl:param>
20
21 <xsl:param name="double.sided">1</xsl:param>
22 <xsl:param name="latex.class.options">openright,twoside</xsl:param>
23
24 <xsl:param name="latex.encoding">utf8</xsl:param>
25
26 <xsl:param name="preface.tocdepth">1</xsl:param>
27
28 <xsl:param name="toc.section.depth">0</xsl:param>
29
30 <!-- do not list figures -->
31 <xsl:param name="doc.lot.show">example</xsl:param>
32
33 <xsl:param name="latex.begindocument">
34 <xsl:text>
35 % Trick to avoid many words sticking out of the right margin of the text.
36 % Note, only one latex.begindocument can be active.
37 \sloppy
38
39 \begin{document}
40 </xsl:text>
41 </xsl:param>
42
43 <!--
44 Make final page blank, which is required for PDFs inteneded for
45 extended distribution with LuLu.
46 -->
47
48 <xsl:param name="latex.enddocument">
49 <xsl:text>\pagebreak
50 \thispagestyle{empty}
51 ~
52 \end{document}
53 </xsl:text>
54 </xsl:param>
55
56 <!-- Attributions should be italicized, right-aligned -->
57 <xsl:template match="attribution">
58 <xsl:param name="content">
59 <xsl:apply-templates/>
60 </xsl:param>
61 <xsl:text>\begin{flushright}
62 \textit{ </xsl:text>
63 <xsl:copy-of select="$content"/>
64 <xsl:text>}
65 \end{flushright}</xsl:text>
66 </xsl:template>
67
68 <!-- An attribution's citetitle should be rendered after a line
69 break -->
70 <xsl:template match="citetitle">
71 <xsl:param name="content">
72 <xsl:apply-templates/>
73 </xsl:param>
74 <xsl:text>\\ \quad \hfill </xsl:text>
75 <xsl:copy-of select="$content"/>
76 </xsl:template>
77
78 <!-- Bibliography and acknowledgements are formatted as numberless
79 chapters — And the easiest way to achieve it was abusing the
80 "Appendix" definition. -->
81 <xsl:template match="appendix">
82 <xsl:param name="content">
83 <xsl:apply-templates/>
84 </xsl:param>
85 <xsl:param name="title">
86 <xsl:apply-templates/>
87 </xsl:param>
88 <xsl:text>\chapter*{</xsl:text>
89 <xsl:copy-of select="title"/>
90 <xsl:text>}</xsl:text>
91 <xsl:text>\addcontentsline{toc}{chapter}{</xsl:text>
92 <xsl:copy-of select="title"/>
93 <xsl:text>}</xsl:text>
94 <xsl:copy-of select="$content"/>
95 </xsl:template>
96
97 <!-- Place title verso page behind the title page the hard way: put
98 colophon content in a file loaded by \maketitle -->
99 <xsl:template match="colophon">
100 <xsl:variable name="titlepage.verso">
101 <xsl:text>\begin{colophon}&#10;</xsl:text>
102 <xsl:apply-templates/>
103 <xsl:text>\end{colophon}&#10;</xsl:text>
104 </xsl:variable>
105 <xsl:call-template name="write.text.chunk">
106 <!-- The filename must end with 'input.rtex' to be parsed by dblatex -->
107 <xsl:with-param name="filename">
108 <xsl:text>titlepg.input.rtex</xsl:text>
109 </xsl:with-param>
110 <xsl:with-param name="method" select="'text'"/>
111 <xsl:with-param name="content">
112 <xsl:value-of select="$titlepage.verso"/>
113 </xsl:with-param>
114 <xsl:with-param name="encoding" select="$chunker.output.encoding"/>
115 </xsl:call-template>
116 </xsl:template>
117
118 </xsl:stylesheet>