]> pere.pagekite.me Git - text-madewithcc.git/blob - extra/pdf.xsl
Translated using Weblate (German)
[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">6in</xsl:param>
13 <xsl:param name="page.height">9in</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 <!-- The TOC links in the titles, and in blue. -->
34 <!-- ensure URLs in the text do not end up light gray too -->
35 <xsl:param name="latex.hyperparam">linktocpage,colorlinks,linkcolor=black,urlcolor=black,pdfstartview=FitH</xsl:param>
36
37 <xsl:param name="latex.begindocument">
38 <xsl:text>
39 % Trick to avoid many words sticking out of the right margin of the text.
40 % Note, only one latex.begindocument can be active.
41 \sloppy
42
43 \usepackage{titlesec}
44
45 \titleformat{\chapter}[display]
46 {\raggedright\Huge}
47 {}
48 {0pt}
49 {\thechapter.\ }
50
51 \titleformat{name=\chapter,numberless}[display]
52 {\raggedright\Huge}
53 {}
54 {0pt}
55 {}
56
57 \begin{document}
58 </xsl:text>
59 </xsl:param>
60
61 <!--
62 Make final page blank, which is required for PDFs inteneded for
63 extended distribution with LuLu.
64 -->
65
66 <xsl:param name="latex.enddocument">
67 <xsl:text>\pagebreak
68 \thispagestyle{empty}
69 ~
70 \end{document}
71 </xsl:text>
72 </xsl:param>
73
74 <!-- Attributions should be italicized, right-aligned -->
75 <xsl:template match="attribution">
76 <xsl:param name="content">
77 <xsl:apply-templates/>
78 </xsl:param>
79 <xsl:text>\begin{flushright}
80 \textit{ </xsl:text>
81 <xsl:copy-of select="$content"/>
82 <xsl:text>}
83 \end{flushright}</xsl:text>
84 </xsl:template>
85
86 <!-- An attribution's citetitle should be rendered after a line
87 break -->
88 <xsl:template match="citetitle">
89 <xsl:param name="content">
90 <xsl:apply-templates/>
91 </xsl:param>
92 <xsl:text>\\ \quad \hfill </xsl:text>
93 <xsl:copy-of select="$content"/>
94 </xsl:template>
95
96 <!-- Bibliography and acknowledgements are formatted as numberless
97 chapters — And the easiest way to achieve it was abusing the
98 "Appendix" definition. -->
99 <xsl:template match="appendix">
100 <xsl:param name="content">
101 <xsl:apply-templates/>
102 </xsl:param>
103 <xsl:param name="title">
104 <xsl:apply-templates/>
105 </xsl:param>
106 <xsl:text>\chapter*{</xsl:text>
107 <xsl:copy-of select="title"/>
108 <xsl:text>}</xsl:text>
109 <xsl:text>\addcontentsline{toc}{chapter}{</xsl:text>
110 <xsl:copy-of select="title"/>
111 <xsl:text>}</xsl:text>
112 <xsl:copy-of select="$content"/>
113 </xsl:template>
114
115 <!-- Place title verso page behind the title page the hard way: put
116 colophon content in a file loaded by \maketitle -->
117 <xsl:template match="colophon">
118 <xsl:variable name="titlepage.verso">
119 <xsl:text>\begin{colophon}&#10;</xsl:text>
120 <xsl:apply-templates/>
121 <xsl:text>\end{colophon}&#10;</xsl:text>
122 </xsl:variable>
123 <xsl:call-template name="write.text.chunk">
124 <!-- The filename must end with 'input.rtex' to be parsed by dblatex -->
125 <xsl:with-param name="filename">
126 <xsl:text>titlepg.input.rtex</xsl:text>
127 </xsl:with-param>
128 <xsl:with-param name="method" select="'text'"/>
129 <xsl:with-param name="content">
130 <xsl:value-of select="$titlepage.verso"/>
131 </xsl:with-param>
132 <xsl:with-param name="encoding" select="$chunker.output.encoding"/>
133 </xsl:call-template>
134 </xsl:template>
135
136 <xsl:param name="local.l10n.xml" select="document('')"/>
137 <l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">
138 <l:l10n language="nb">
139 <!-- Fix bugs in default nb locale -->
140 <l:dingbat key="startquote" text="«"/>
141 <l:dingbat key="endquote" text="»"/>
142 <l:dingbat key="nestedstartquote" text="‘"/>
143 <l:dingbat key="nestedendquote" text="’"/>
144 <l:gentext key="Copyright" text=""/>
145 </l:l10n>
146 <l:l10n language="nn">
147 <!-- Fix bugs in default nn locale -->
148 <l:dingbat key="startquote" text="«"/>
149 <l:dingbat key="endquote" text="»"/>
150 <l:dingbat key="nestedstartquote" text="‘"/>
151 <l:dingbat key="nestedendquote" text="’"/>
152 <l:gentext key="Copyright" text=""/>
153 </l:l10n>
154 </l:i18n>
155
156 </xsl:stylesheet>