]> pere.pagekite.me Git - homepage.git/commitdiff
New blog post about dblatex.
authorPetter Reinholdtsen <pere@hungry.com>
Thu, 16 Jul 2015 16:06:47 +0000 (18:06 +0200)
committerPetter Reinholdtsen <pere@hungry.com>
Thu, 16 Jul 2015 16:06:47 +0000 (18:06 +0200)
blog/data/2015-07-16-dblatex-endnotes.txt [new file with mode: 0644]

diff --git a/blog/data/2015-07-16-dblatex-endnotes.txt b/blog/data/2015-07-16-dblatex-endnotes.txt
new file mode 100644 (file)
index 0000000..69600e2
--- /dev/null
@@ -0,0 +1,54 @@
+Title: Typesetting DocBook footnotes as endnotes with dblatex
+Tags: english, docbook, freeculture
+Date: 2015-07-16 18:10
+
+<p>I'm still working on the Norwegian version of the
+<a href="http://free-culture.cc/">Free Culture book by Lawrence
+Lessig</a>, and is now working on the final typesetting and layout.
+One of the features I want to get the structure similar to the
+original book is to typeset the footnotes as endnotes in the notes
+chapter.  Based on the
+<a href="https://bugs.debian.org/685063">feedback from the Debian
+maintainer and the dblatex developer</a>, I came up with this recipe I
+would like to share with you.  The proposal was to create a new LaTeX
+class file and add the LaTeX code there, but this is not always
+practical, when I want to be able to replace the class using a make
+file variable.  So my proposal misuses the latex.begindocument XSL
+parameter value, to get a small fragment into the correct location in
+the generated LaTeX File.</p>
+
+<p>First, decide where in the DocBook document to place the endnotes,
+and add this text there:</p>
+
+<pre>
+&lt;?latex \theendnotes ?&gt;
+</pre>
+
+<p>Next, create a xsl stylesheet file dblatex-endnotes.xsl to add the
+code needed to add the endnote instructions in the preamble of the
+generated LaTeX document, with content like this:</p>
+
+<pre>
+&lt;?xml version='1.0'?&gt;
+&lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'&gt;
+  &lt;xsl:param name="latex.begindocument"&gt;
+    &lt;xsl:text&gt;
+\usepackage{endnotes}
+\let\footnote=\endnote
+\def\enoteheading{\mbox{}\par\vskip-\baselineskip }
+\begin{document}
+    &lt;/xsl:text&gt;
+  &lt;/xsl:param&gt;
+&lt;/xsl:stylesheet&gt;
+</pre>
+
+<p>Finally, load this xsl file when running dblatex, for example like
+this:</p>
+
+<pre>
+dblatex --xsl-user=dblatex-endnotes.xsl freeculture.nb.xml
+</pre>
+
+<p>The end result can be seen on github, where
+<a href="https://github.com/petterreinholdtsen/free-culture-lessig">my
+book project</a> is located.</p>