]> pere.pagekite.me Git - text-mekanikerord.git/blob - pdf.xsl
Correct PDF for printing.
[text-mekanikerord.git] / 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="paper.type">a4</xsl:param -->
5 <xsl:param name="double.sided">1</xsl:param>
6 <xsl:param name="page.width">6in</xsl:param>
7 <xsl:param name="page.height">9in</xsl:param>
8 <xsl:param name="page.margin.inner">0.75in</xsl:param>
9 <xsl:param name="page.margin.outer">0.50in</xsl:param>
10 <xsl:param name="page.margin.top">0.55in</xsl:param>
11 <xsl:param name="page.margin.bottom">0.55in</xsl:param>
12 <xsl:param name="latex.class.book">book</xsl:param>
13 <xsl:param name="latex.class.options">a4paper,openright,twoside</xsl:param>
14
15 <!-- The TOC links in the titles, and in blue. -->
16 <!-- ensure URLs in the text do not end up light gray too -->
17 <xsl:param name="latex.hyperparam">linktocpage,colorlinks,linkcolor=black,urlcolor=black,pdfstartview=FitH</xsl:param>
18
19 <!-- No use showing table of content, it is empty -->
20 <xsl:param name="doc.toc.show">0</xsl:param>
21
22 <!-- no need for a separate author list -->
23 <xsl:param name="doc.collab.show">0</xsl:param>
24
25 <!-- disable revision history until there is a history to display -->
26 <xsl:param name="latex.output.revhistory">0</xsl:param>
27
28 <!-- enable draft mode until ready to publish -->
29 <xsl:param name="draft.mode">no</xsl:param>
30 <xsl:param name="draft.watermark">0</xsl:param>
31
32 <!-- insert a few latex tricks at the top of the .tex document -->
33 <xsl:param name="latex.begindocument">
34 <xsl:text>% start of latex.begindocument
35 \usepackage{multicol}
36
37 % unboxed = wrap glossary term
38 % multicols = get two columns only in mainpart
39 \setlist[description]{%
40 style=unboxed,
41 before*=\begin{multicols}{2},
42 after*=\end{multicols}
43 % first*=
44 % topsep=30pt, % space before start / after end of list
45 % itemsep=5pt, % space between items
46 % font=\normalfont,
47 }
48
49 % Trick to avoid many words sticking out of the right margin of the text.
50 \sloppy
51
52 % The microtype package provides the ability to micromanage your
53 % typography. When invoked without any options it does some nice things
54 % like protruding punctuation over the edge of the right margin to make
55 % the margin appear smoother. Basically it makes your book look more
56 % professional with very little effort. It also has a ton of options if
57 % you want to micromanage even more.
58 \usepackage{microtype}
59
60 % Disable headers and footer texts
61 \pagestyle{myheadings}
62
63 \def\DBKpublisher{Petter Reinholdtsen \\ Oslo}
64
65 % Cludge to replace DBKcover \def in
66 % /usr/share/texmf/tex/latex/dblatex/style/dbk_title.sty where author
67 % and publisher is missing
68 \def\DBKcover{
69 \ifthenelse{\equal{\DBKedition}{}}{\def\edhead{}}{\def\edhead{Ed. \DBKedition}}
70 % interligne double
71 \setlength{\oldbaselineskip}{\baselineskip}
72 \setlength{\baselineskip}{2\oldbaselineskip}
73 \textsf{
74 \vfill
75 \vspace{2.5cm}
76 \begin{center}
77 \huge{\textbf{\DBKtitle}}\\ %
78 \ifx\DBKsubtitle\relax\else%
79 \underline{\ \ \ \ \ \ \ \ \ \ \ }\\ %
80 \ \\ %
81 \huge{\textbf{\DBKsubtitle}}\\ %
82 \fi
83 \ \\ %
84 % \huge{\editor} \\%
85 \end{center}
86 \vfill
87 \setlength{\baselineskip}{\oldbaselineskip}
88 \hspace{1cm}
89 \vspace{1cm}
90 \begin{center}
91 \Large{\DBKpublisher} \\
92 \end{center}
93 }
94 %
95 \newcommand{\sectionline}{%
96 \nointerlineskip \vspace{\baselineskip}%
97 \hspace{\fill}\rule{0.5\linewidth}{.7pt}\hspace{\fill}%
98 \par\nointerlineskip \vspace{\baselineskip}%
99 }%
100 %
101 % Format for the other pages
102 \newpage
103 \setlength{\baselineskip}{\oldbaselineskip}
104 \lfoot[]{}
105 }
106
107 \begin{document}
108 % end of latex.begindocument
109 </xsl:text>
110 </xsl:param>
111
112 <!-- disable chapter numbering for glossary -->
113 <xsl:param name="glossary.numbered">0</xsl:param>
114
115 <!-- disable chapter numbering for index -->
116 <xsl:param name="index.numbered">0</xsl:param>
117
118 <xsl:param name="local.l10n.xml" select="document('')"/>
119 <l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">
120 <l:l10n language="nb">
121 <!-- Fix bugs in default nb locale -->
122 <l:dingbat key="startquote" text="«"/>
123 <l:dingbat key="endquote" text="»"/>
124 <l:dingbat key="nestedstartquote" text="‘"/>
125 <l:dingbat key="nestedendquote" text="’"/>
126 <l:gentext key="Copyright" text=""/>
127 </l:l10n>
128 <l:l10n language="nn">
129 <!-- Fix bugs in default nn locale -->
130 <l:dingbat key="startquote" text="«"/>
131 <l:dingbat key="endquote" text="»"/>
132 <l:dingbat key="nestedstartquote" text="‘"/>
133 <l:dingbat key="nestedendquote" text="’"/>
134
135 <!--
136 Workaround for missing 'se' support in dblatex/docbook, use 'nn' as
137 replacement and rewrite the strings we use. Note PDF use some of
138 these, while HTML and ePub uses others.
139
140 A more future proof approach that would help others would be to submit
141 a se.xsl file to
142 https://github.com/docbook/xslt10-stylesheets/tree/master/gentext/locale .
143 -->
144 <l:gentext key="Editedby" text="Redigert av (se)"/>
145 <l:gentext key="Abstract" text="Čoahkkáigeassu"/>
146 <l:gentext key="TableofContents" text="Sisdoallu"/>
147 <l:gentext key="Copyright" text=""/>
148 <l:gentext key="Glossary" text="Sátnelistu"/>
149 <l:gentext key="glossary" text="Sátnelistu"/>
150 <l:gentext key="glosssee" text="Geahča"/>
151 <l:gentext key="GlossSee" text="Geahča"/>
152 <l:context name="glossary">
153 <l:template name="see" text="Geahča «%t»."/>
154 </l:context>
155 </l:l10n>
156 </l:i18n>
157
158 <!--
159 Make final page blank, which is required for PDFs inteneded for
160 extended distribution with LuLu.
161 -->
162
163 <xsl:param name="latex.enddocument">
164 <xsl:text>\pagebreak
165 \thispagestyle{empty}
166 ~
167 \end{document}
168 </xsl:text>
169 </xsl:param>
170
171 </xsl:stylesheet>