From 6847a3511a972257e9c1039a92883b96bf26e43a Mon Sep 17 00:00:00 2001
From: Petter Reinholdtsen <pere@hungry.com>
Date: Sat, 14 Oct 2023 23:35:15 +0200
Subject: [PATCH] =?utf8?q?Bytt=20til=20US=20Trade=20(6x9")=20og=20basert?=
 =?utf8?q?=20sideutlegg=20p=C3=A5=20Free=20Culture-oppsettet.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit

---
 Makefile                   |  26 ++++-
 data/dblatex-postprocess   |  18 ++++
 data/fop-params.xconf      |  33 ++++++
 data/lulu.xsl              |  46 ++++++++
 data/pdf.xsl               |  97 +++++++++++++++++
 data/stylesheet-fo.xsl     |  33 ++++++
 data/user_param.xsl        |  62 +++++++++++
 data/xetex_param.xsl       | 109 +++++++++++++++++++
 myclass.cls                | 215 +++++++++++++++++++++++++++++++++++++
 rapport-docinfo-footer.xml |  87 +++++++++++++++
 rapport-docinfo.xml        |   2 +-
 rapport.adoc               |   2 +-
 12 files changed, 726 insertions(+), 4 deletions(-)
 create mode 100755 data/dblatex-postprocess
 create mode 100644 data/fop-params.xconf
 create mode 100644 data/lulu.xsl
 create mode 100644 data/pdf.xsl
 create mode 100644 data/stylesheet-fo.xsl
 create mode 100644 data/user_param.xsl
 create mode 100644 data/xetex_param.xsl
 create mode 100644 myclass.cls
 create mode 100644 rapport-docinfo-footer.xml

diff --git a/Makefile b/Makefile
index 82219a1..a73348f 100644
--- a/Makefile
+++ b/Makefile
@@ -1,12 +1,34 @@
+DBLATEX = dblatex
+
+DBLATEX_OPTS = \
+	-T simple \
+	-b xetex \
+	-r data/dblatex-postprocess \
+	--xsl-user=data/user_param.xsl \
+	--xsl-user=data/xetex_param.xsl \
+	-V \
+	-p data/pdf.xsl
+
 all: rapport.pdf rapport.epub
 
-rapport.xml: *.adoc
+rapport.xml: *.adoc rapport-docinfo*.xml
 	asciidoctor -b docbook5 -d book rapport.adoc
 rapport.pdf: rapport.xml
-	dblatex $^
+	$(DBLATEX) $(DBLATEX_OPTS) $<
 rapport.epub: rapport.xml
 	dbtoepub $^
 
+rapport-fop.fo: rapport.xml
+	xsltproc  \
+	    --output $(subst .pdf,.fo,$@).new \
+	    data/stylesheet-fo.xsl \
+	    $<
+	xmllint --format $@.new > $@
+	$(RM) $@.new
+
+rapport-fop.pdf: rapport-fop.fo
+	fop -c data/fop-params.xconf -fo $(subst .pdf,.fo,$@) -pdf $@ ; \
+
 clean:
 	$(RM) *~
 distclean:
diff --git a/data/dblatex-postprocess b/data/dblatex-postprocess
new file mode 100755
index 0000000..c008726
--- /dev/null
+++ b/data/dblatex-postprocess
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+set -e
+
+TEXFILE="$1"
+
+# Legg inn orddelingspunkt pÃ¥ problematiske ord for Ã¥ fÃ¥ jevnere
+# hÃ¸yrekant pÃ¥ tekstblokkene.  LaTeX deler ikke ord med bindestrek
+# automatisk, slik at endel ord blir veldig lange og stikker ut over
+# kanten.  Ãnsker ikke endre i originalteksten, sÃ¥ vi skriver om
+# aktuelle ord i latex-fila her til Ã¥ inneholde orddelingsmarkÃ¸r i
+# stedet.
+sed -i \
+    -e 's/kommersiell/kom\\-mer\\-siell/g' \
+    -e 's/â¯/\\thinspace/g' \
+    $TEXFILE
+
+exit 0
diff --git a/data/fop-params.xconf b/data/fop-params.xconf
new file mode 100644
index 0000000..2e1aff1
--- /dev/null
+++ b/data/fop-params.xconf
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<fop version="1.0">
+  <renderers>
+    <renderer mime="application/pdf">
+      <!-- Full path to truetype fonts to be embedded in PDF file -->
+      <fonts>
+
+        <font embed-url="file:///home/pere/.fonts/CrimsonText-Regular.ttf">
+          <font-triplet name="Crimson Text" style="normal" weight="normal"/>
+        </font>
+        <font embed-url="file:///home/pere/.fonts/CrimsonText-Italic.ttf">
+          <font-triplet name="Crimson Text" style="italic" weight="normal"/>
+        </font>
+        <font embed-url="file:///home/pere/.fonts/CrimsonText-Bold.ttf">
+          <font-triplet name="Crimson Text" style="normal" weight="bold"/>
+        </font>
+
+        <font embed-url="file:///usr/share/fonts/truetype/freefont/FreeSerif.ttf">
+          <font-triplet name="Times" style="normal" weight="normal"/>
+        </font>
+        <font embed-url="file:///usr/share/fonts/truetype/freefont/FreeSerifBold.ttf">
+          <font-triplet name="Times" style="normal" weight="bold"/>
+        </font>
+        <font embed-url="file:///usr/share/fonts/truetype/freefont/FreeSerifItalic.ttf">
+          <font-triplet name="Times" style="italic" weight="normal"/>
+        </font>
+        <font embed-url="file:///usr/share/fonts/truetype/freefont/FreeSerifBoldItalic.ttf">
+          <font-triplet name="Times" style="italic" weight="bold"/>
+        </font>
+      </fonts>
+    </renderer>
+  </renderers>
+</fop>
diff --git a/data/lulu.xsl b/data/lulu.xsl
new file mode 100644
index 0000000..d3ca3ac
--- /dev/null
+++ b/data/lulu.xsl
@@ -0,0 +1,46 @@
+<?xml version='1.0' encoding="iso-8859-1"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
+
+<!-- settings for LuLu PDF version -->
+<!--
+https://amyrhoda.wordpress.com/2012/05/25/latex-to-lulu-the-making-of-aosa-geometry-and-headers-and-footers/
+http://connect.lulu.com/t5/ISBN-Distribution/Mandatory-Print-Book-Distribution-Requirements/ta-p/33632
+http://www.lulu.com/create/books
+-->
+
+<xsl:param name="doc.collab.show">0</xsl:param>
+
+<!-- See "Global Page Setup" in the dblatex PDF manual for details -->
+<!-- FIXME change when page size changes -->
+<xsl:param name="page.width">6in</xsl:param>
+<xsl:param name="page.height">9in</xsl:param>
+<xsl:param name="page.margin.inner">0.8in</xsl:param>
+<xsl:param name="page.margin.outer">0.55in</xsl:param>
+
+<!-- reduce from 0.55in, to ignore header and footer in margin calculation -->
+<!-- FIXME figure out the proper number to use -->
+<xsl:param name="page.margin.top">0.05in</xsl:param>
+<xsl:param name="page.margin.bottom">0.15in</xsl:param>
+
+<xsl:param name="body.start.indent">0pt</xsl:param>
+<xsl:param name="double.sided">1</xsl:param>
+
+<!-- used by dblatex -->
+<!-- headinclude=on,footinclude=on - ? -->
+<!-- openright,twoside - proper double sided printing -->
+<xsl:param name="latex.class.options">openright,twoside</xsl:param>
+
+<!--
+Make final page blank, which is required for PDFs inteneded for
+extended distribution with LuLu.
+-->
+
+<xsl:param name="latex.enddocument">
+  <xsl:text>\pagebreak
+\thispagestyle{empty}
+~
+\end{document}
+  </xsl:text>
+</xsl:param>
+
+</xsl:stylesheet>
diff --git a/data/pdf.xsl b/data/pdf.xsl
new file mode 100644
index 0000000..c05dd95
--- /dev/null
+++ b/data/pdf.xsl
@@ -0,0 +1,97 @@
+<?xml version='1.0' encoding="iso-8859-1"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
+
+<!-- The TOC links in the titles, and in blue. -->
+<!-- ensure URLs in the text do not end up light gray too -->
+<xsl:param name="latex.hyperparam">linktocpage,colorlinks,linkcolor=black,urlcolor=black,pdfstartview=FitH</xsl:param>
+
+<xsl:param name="callout.linkends.hot">0</xsl:param>
+
+<!-- Put the dblatex logo -->
+<!-- xsl:param name="doc.publisher.show">1</xsl:param -->
+
+<!-- List the examples and equations too, no tables and figures -->
+<!-- xsl:param name="doc.lot.show">example,tables,figures</xsl:param -->
+
+<!-- Only want chapter numbers -->
+<xsl:param name="doc.section.depth">0</xsl:param>
+
+<xsl:param name="latex.class.book">myclass</xsl:param>
+<xsl:param name="latex.output.revhistory">0</xsl:param>
+
+<xsl:param name="imagedata.default.scale">maxwidth=15.5cm,maxheight=12cm</xsl:param>
+<xsl:param name="draft.mode">no</xsl:param>
+<xsl:param name="draft.watermark">0</xsl:param>
+<xsl:param name="doc.collab.show">0</xsl:param>
+
+<xsl:param name="insert.xref.page.number">1</xsl:param>
+
+<xsl:include href="lulu.xsl" />
+<!-- xsl:include href="createspace.xsl" /-->
+<!-- xsl:include href="licentia.xsl" /-->
+
+<!-- xsl:include href="origsize.xsl" /-->
+
+<!-- fall back to duplex A4 if not creating PDF for a specific size. -->
+<!-- xsl:param name="paper.type">A4</xsl:param -->
+<xsl:param name="double.sided">1</xsl:param>
+<xsl:param name="page.margin.inner">0.8in</xsl:param>
+<xsl:param name="page.margin.outer">0.55in</xsl:param>
+<xsl:param name="page.margin.top">0.55in</xsl:param>
+<xsl:param name="page.margin.bottom">0.55in</xsl:param>
+<xsl:param name="latex.class.options">a4paper,openright,twoside</xsl:param>
+
+<!-- font for XSL/FOP, see also fop-params.xconf -->
+<!-- The original book used Adobe Caslon, and this free font is pretty similar -->
+<xsl:param name="body.font.family">Crimson Text</xsl:param>
+<xsl:param name="sans.font.family">Crimson Text</xsl:param>
+<xsl:param name="title.font.family">Crimson Text</xsl:param>
+<xsl:param name="slide.font.family">Crimson Text</xsl:param>
+<xsl:param name="slide.title.font.family">Crimson Text</xsl:param>
+<xsl:param name="monospace.font.family">Latin Modern Mono</xsl:param>
+
+<!-- transform footnotes to endnotes -->
+<xsl:param name="footnote.as.endnote" select="1"/>
+
+<!-- configure the endnotes package -->
+<xsl:attribute-set name="endnotes.properties"
+                     use-attribute-sets="endnotes.properties.default">
+<!--
+Increase footnote/endnote size to be more than 6 pts, to avoid
+complaint from Lulu about the font being too small to be printed
+clearly.  Needed at least for pocket size books.  Probably wise to use
+the same size as the colophon page (see myclass.cls)
+
+make sure \fontsize{x}{y} use y=1.2*x, x >= 6
+-->
+
+  <!--xsl:attribute name="font-size">\fontsize{10}{12}</xsl:attribute-->
+  <xsl:attribute name="font-size">\footnotesize</xsl:attribute>
+  <!--xsl:attribute name="font-size">\normalsize</xsl:attribute-->
+</xsl:attribute-set>
+
+<!-- the endnotes are grouped by part, chapter, and preface -->
+<xsl:param name="endnotes.heading.groups" select="'part chapter preface'"/>
+<xsl:param name="endnotes.heading.style" select="'select:title'"/>
+<xsl:param name="endnotes.heading.command" select="'\enoteheader*'"/>
+
+<xsl:template match="preface" mode="endnotes">
+  <xsl:call-template name="endnotes.add.header"/>
+</xsl:template>
+
+<!-- even if grouped, never reset the endnotes counter, so clear the rule -->
+<xsl:param name="endnotes.counter.resetby"/>
+
+
+  <xsl:param name="latex.begindocument">
+    <xsl:text>
+% Trick to avoid many words sticking out of the right margin of the text.
+% Need to add it here with the end notes, as only one
+% latex.begindocument can be active.
+\sloppy
+
+\begin{document}
+    </xsl:text>
+  </xsl:param>
+
+</xsl:stylesheet>
diff --git a/data/stylesheet-fo.xsl b/data/stylesheet-fo.xsl
new file mode 100644
index 0000000..4d5797f
--- /dev/null
+++ b/data/stylesheet-fo.xsl
@@ -0,0 +1,33 @@
+<?xml version='1.0'?> 
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+  <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"/>
+
+  <!--
+  <xsl:include href="user_param.xsl" />
+  -->
+  <xsl:include href="pdf.xsl" />
+  <xsl:param name="fop1.extensions">1</xsl:param>
+<!--
+  <xsl:template match="footnote">
+    <fo:inline>
+      <xsl:call-template name="format.footnote.mark">
+        <xsl:with-param name="mark">
+          <xsl:apply-templates select="." mode="footnote.number"/>
+        </xsl:with-param>
+      </xsl:call-template>
+    </fo:inline>
+  </xsl:template>
+
+  <xsl:template match="footnote" mode="endnote">
+    <fo:block xsl:use-attribute-sets="footnote.properties">
+      <xsl:apply-templates/>
+    </fo:block>
+  </xsl:template>
+
+  <xsl:template name="make.endnotes.list">
+    <xsl:apply-templates mode="endnote"
+                         select="ancestor-or-self:://footnote"/>
+  </xsl:template>
+-->
+</xsl:stylesheet>
diff --git a/data/user_param.xsl b/data/user_param.xsl
new file mode 100644
index 0000000..21c2b15
--- /dev/null
+++ b/data/user_param.xsl
@@ -0,0 +1,62 @@
+<?xml version='1.0'?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
+
+<!--############################################################################
+    XSLT Stylesheet DocBook -> LaTeX 
+    ############################################################################ -->
+
+  <xsl:param name="draft.mode">maybe</xsl:param>
+  <xsl:param name="glossterm.auto.link">1</xsl:param>
+  <xsl:param name="latex.encoding">utf8</xsl:param>
+  <xsl:param name="latex.unicode.use">1</xsl:param>
+  <xsl:param name="monoseq.hyphenation">nohyphen</xsl:param>
+  <xsl:template match="book|article" mode="docinfo">
+    <!-- Apply default settings -->
+    <xsl:apply-imports/>
+  </xsl:template>
+
+  <xsl:param name="hyphenate">false</xsl:param>
+  <xsl:param name="generate.toc">book toc title</xsl:param>
+
+  <!-- Require dblatex 0.3.7 or newer -->
+  <xsl:param name="figure.title.top">0</xsl:param>
+  <xsl:param name="figure.anchor.top">1</xsl:param>
+
+  <xsl:param name="local.l10n.xml" select="document('')"/> 
+  <l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">
+    <!-- Drop the number in front of chapters -->
+    <l:context name="title-numbered">
+      <l:template name="chapter" text="%t"/>
+    </l:context>
+
+    <l:l10n language="en">
+      <!-- The default page citation [12] is hard to understand for
+           most readers.  use (p. 12) instead. -->
+      <l:context name="xref">
+	<l:template name="page.citation" text=" (p.&#160;%p)"/>
+      </l:context>
+    </l:l10n>
+
+    <l:l10n language="fr">
+      <l:context name="xref">
+	<l:template name="page.citation" text=" (p.&#160;%p)"/>
+      </l:context>
+    </l:l10n>
+
+    <l:l10n language="nb">
+      <!-- Fix bugs in default nb locale -->
+      <l:dingbat key="startquote" text="Â«"/>
+      <l:dingbat key="endquote" text="Â»"/>
+      <l:dingbat key="nestedstartquote" text="â"/>
+      <l:dingbat key="nestedendquote" text="â"/>
+
+      <l:context name="xref">
+	<l:template name="page.citation" text=" (s.&#160;%p)"/>
+      </l:context>
+    </l:l10n>
+  </l:i18n>
+
+  <!-- Make preface show up in toc for dblatex -->
+  <xsl:param name="preface.tocdepth">1</xsl:param>
+
+</xsl:stylesheet>
diff --git a/data/xetex_param.xsl b/data/xetex_param.xsl
new file mode 100644
index 0000000..ad994d8
--- /dev/null
+++ b/data/xetex_param.xsl
@@ -0,0 +1,109 @@
+<?xml version='1.0'?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
+
+<xsl:param name="book.font" select="'crimson'"/>
+
+<xsl:param name="xetex.font.crimson">
+  <xsl:text>\setmainfont{Crimson Text}&#10;</xsl:text>
+  <xsl:text>\setsansfont{Crimson Text}&#10;</xsl:text>
+  <xsl:text>\setmonofont{Latin Modern Mono}&#10;</xsl:text>
+
+  <!-- Force <emphasis role='strong'> to be bold, not semibold -->
+<!--
+  <xsl:text>\setmainfont[BoldFont={CrimsonText-Bold}]{Crimson Text}&#10;</xsl:text>
+-->
+
+  <!-- Use a font that has smallcaps -->
+<!--
+  <xsl:text>\newfontinstance\scshape[Letters=SmallCaps,Scale=1.15]{Crimson}&#10;</xsl:text>
+-->
+  <!-- Use a smaller font except for the letter heading which is bold -->
+<!--
+  <xsl:text>\newfontfamily\indexfont[Scale=0.7,
+                           BoldFeatures={Scale=1}]{Crimson Text}&#10;</xsl:text>
+-->
+</xsl:param>
+
+<xsl:param name="xetex.font.alegreya">
+  <xsl:text>\setmainfont[SmallCapsFont={Alegreya SC}]{Alegreya}&#10;</xsl:text>
+  <xsl:text>\setsansfont{Alegreya Sans}&#10;</xsl:text>
+  <xsl:text>\setmonofont{DejaVu Sans Mono}&#10;</xsl:text>
+
+  <!-- Use a smaller font except for the letter heading which is bold -->
+  <xsl:text>\newfontfamily\indexfont[Scale=0.7,
+                           BoldFeatures={Scale=1}]{Alegreya}&#10;</xsl:text>
+</xsl:param>
+
+<xsl:param name="xetex.font.gandhi">
+  <xsl:text>\setmainfont[SmallCapsFont={Alegreya SC}]{Gandhi Serif}&#10;</xsl:text>
+  <xsl:text>\setsansfont{Gandhi Sans}&#10;</xsl:text>
+  <xsl:text>\setmonofont{DejaVu Sans Mono}&#10;</xsl:text>
+
+  <!-- Use a smaller font except for the letter heading which is bold -->
+  <xsl:text>\newfontfamily\indexfont[Scale=0.7,
+                           BoldFeatures={Scale=1}]{Gandhi Serif}&#10;</xsl:text>
+</xsl:param>
+
+<xsl:param name="xetex.font">
+  <xsl:choose>
+  <xsl:when test="$book.font = 'crimson'">
+    <xsl:value-of select="$xetex.font.crimson"/>
+  </xsl:when>
+  <xsl:when test="$book.font = 'gandhi'">
+    <xsl:value-of select="$xetex.font.gandhi"/>
+  </xsl:when>
+  <xsl:when test="$book.font = 'alegreya'">
+    <xsl:value-of select="$xetex.font.alegreya"/>
+  </xsl:when>
+  <xsl:otherwise>
+    <!-- Fallback to the default Crimson font -->
+    <xsl:value-of select="$xetex.font.crimson"/>
+  </xsl:otherwise>
+  </xsl:choose>
+</xsl:param>
+
+
+<!-- Do it the hard way: put this content in a file loaded by \maketitle -->
+<xsl:template match="colophon">
+  <xsl:variable name="titlepage.verso">
+    <xsl:text>\begin{colophon}&#10;</xsl:text>
+    <xsl:apply-templates/>
+    <xsl:text>\end{colophon}&#10;</xsl:text>
+  </xsl:variable>
+  <xsl:call-template name="write.text.chunk">
+    <!-- The filename must end with 'input.rtex' to be parsed by dblatex -->
+    <xsl:with-param name="filename">
+      <xsl:text>titlepg.input.rtex</xsl:text>
+    </xsl:with-param>
+    <xsl:with-param name="method" select="'text'"/>
+    <xsl:with-param name="content">
+      <xsl:value-of select="$titlepage.verso"/>
+    </xsl:with-param>
+    <xsl:with-param name="encoding" select="$chunker.output.encoding"/>
+  </xsl:call-template>
+</xsl:template>
+
+<!-- French typography requises the surname of the cited authors being in
+     Small Capitals -->
+<xsl:template match="footnote//personname">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="footnote//surname">
+  <xsl:variable name="lang">
+    <xsl:call-template name="l10n.language"/>
+  </xsl:variable>
+
+  <xsl:choose>
+  <xsl:when test="$lang='fr'">
+    <xsl:text>\textsc{</xsl:text>
+    <xsl:apply-templates/>
+    <xsl:text>}</xsl:text>
+  </xsl:when>
+  <xsl:otherwise>
+    <xsl:apply-templates/>
+  </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/myclass.cls b/myclass.cls
new file mode 100644
index 0000000..73d0869
--- /dev/null
+++ b/myclass.cls
@@ -0,0 +1,215 @@
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{myclass}[]
+
+%% Just use the original class and pass the options
+\LoadClassWithOptions{report}
+% report, book, memoir, scrreprt or scrbook ?
+
+% Show frames, make it easier to debug borders
+%\usepackage{showframe}% http://ctan.org/pkg/showframe
+\makeatletter
+
+% 
+% Customize the titlepage: remove the date, place the publisher name, and 
+% load a specific file for the verso page, containing some legal notices
+%
+\def\maketitle{%
+  \titlerecto%
+  \titleverso}
+
+\def\titlerecto{\begin{titlepage}%
+  \null\vfil
+  \vskip 160\p@
+  \begin{center}%
+    {\LARGE \@title \par}%
+    \vskip 3em%
+    {\Large
+     \lineskip .75em%
+      \begin{tabular}[t]{c}%
+        \@author
+      \end{tabular}\par}%
+      \vskip 20em%
+    {\large \DBKpublishername \par}
+    \vskip .75em%
+    {\large \DBKpublisheraddress \par}%
+  \end{center}\par
+  \vfil\null
+  \end{titlepage}}%
+
+\def\titleverso{%
+  \def\titlepagefile{titlepg.input.tex}
+  \IfFileExists{\titlepagefile}{\input{\titlepagefile}}{}
+}%
+
+
+% Divide by 2 the index item indentation (10pt -> 5pt)
+\renewcommand\@idxitem{\par\hangindent 20\p@}
+\renewcommand\subitem{\@idxitem \hspace*{10\p@}}
+\renewcommand\subsubitem{\@idxitem \hspace*{15\p@}}
+
+% Put the index in the TOC
+\let\stdindex=\theindex
+\let\endstdindex=\endtheindex
+\renewenvironment{theindex}{
+  \begin{stdindex}
+  \@ifundefined{chapter}{}{
+    % To not have the number, replace by:
+    % \addcontentsline{toc}{chapter}{\numberline{}\indexname}
+    \refstepcounter{chapter}
+    \ifnum \c@secnumdepth >\z@
+      \ifnum \value{part} >\z@
+        \addcontentsline{toc}{part}{\numberline{\thechapter}\hspace{-1em}\indexname}
+      \else
+        \addcontentsline{toc}{chapter}{\numberline{\thechapter}\indexname}
+      \fi
+    \else
+      \addcontentsline{toc}{chapter}{\indexname}
+    \fi
+  }
+  % Adapt the vertical sizes to the smaller font
+  \setlength{\baselineskip}{0.7\baselineskip}%
+  \setlength{\parskip}{0.2\baselineskip}%
+  \indexfont
+}{
+  \end{stdindex}
+}
+\makeatother
+
+\newenvironment{colophon}{
+  \pagebreak %
+% FIXME change when page size changes, use {x}{x*1.2}
+
+% Note, these numbers are not correct any more for the sizes mentioned:
+%  \fontsize{6.5}{7.8}\selectfont % fits in one 4.25x6.875" pocket size page
+%  \fontsize{7.5}{9}\selectfont % fits in one 5.06x7.71" size page
+%  \fontsize{9.1}{10.92}\selectfont % fits in one 5.5x8.5" digest size page
+
+  \fontsize{8.2}{9.84}\selectfont % fits in one 6x9'' size page
+  \setlength{\parskip}{0.5em} %
+  \setlength{\parindent}{0pt} %
+}{}
+ 
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Based on ideas from https://bugs.debian.org/684772
+\usepackage{titlesec}
+\usepackage{titletoc}
+%
+% Useless with unnumbered sections (e.g. use of \setcounter{secnumdepth}{0})
+%
+%
+\newcommand\makeletterof[1]{%
+\ifthenelse{\equal{#1}{1}}{EN}{%
+\ifthenelse{\equal{#1}{2}}{TO}{%
+\ifthenelse{\equal{#1}{3}}{TRE}{%
+\ifthenelse{\equal{#1}{4}}{FIRE}{%
+\ifthenelse{\equal{#1}{5}}{FEM}{%
+\ifthenelse{\equal{#1}{6}}{SEKS}{%
+\ifthenelse{\equal{#1}{7}}{SJU}{%
+\ifthenelse{\equal{#1}{8}}{ÃTTE}{%
+\ifthenelse{\equal{#1}{9}}{NI}{%
+\ifthenelse{\equal{#1}{10}}{TI}{%
+\ifthenelse{\equal{#1}{11}}{ELLEVE}{%
+\ifthenelse{\equal{#1}{12}}{TOLV}{%
+#1}}}}}}}}}}}}}
+
+% Make TOC entries without label
+\titlecontents{chapter} %
+[1.5em] % 
+{\addvspace{0.3em plus 0pt}\bfseries} %
+{\hspace{-1.3em}} % no number, remove room reserved for it 
+{\hspace{-1.3em}} %
+{\hfill \contentspage} % dots and page number
+[\addvspace {0pt}]
+
+\dottedcontents{section} %
+[0em] % was (3.8)
+{\addvspace{0pt}} % 
+{2.3em} % tab
+{0.75em} % space between dots
+[\addvspace{0pt}]
+
+%% Redefines the headings to remove the chapter label
+\titleformat{\chapter}[block]
+{\filcenter\Large}{\filcenter}{20pt}{\Large}
+
+\titleformat{\section}
+{\filcenter\Large\bfseries}{\thesection}{1em}{}
+
+\titleformat{\subsection}
+{\filcenter\large\bfseries}{\thesubsection}{1em}{}
+
+%% New header, behaving like a section but formatted differently
+\titleclass{\enoteheader}{straight}[\chapter]
+\newcounter{enoteheader}
+\renewcommand{\theenoteheader}{\Alph{enoteheader}}
+
+\titleformat{\enoteheader}
+{\normalfont\large}{}{0pt}{}
+\titlespacing*{\enoteheader}{0pt}{2.5ex plus 1ex minus .2ex}{1.3ex plus .2ex}
+
+\dottedcontents{enoteheader} %
+[0em] % was (3.8)
+{\addvspace{0pt}} % 
+{2.3em} % tab
+{0.75em} % space between dots
+[\addvspace{0pt}]
+
+%% New header, behaving like a chapter but formatted differently
+\titleclass{\lotheader}{top}[\part]
+\newcounter{lotheader}
+\renewcommand{\thelotheader}{\Alph{lotheader}}
+
+\titleformat{\lotheader}[block]
+{\filcenter\huge}{\filcenter}{20pt}{\Huge}
+\titlespacing*{\lotheader}{0pt}{-30pt}{40pt}
+
+% Use the new header in TOC
+\let\stdtoc=\tableofcontents
+\let\stdchapter=\chapter
+\def\tableofcontents{\let\chapter\lotheader \stdtoc{} \let\chapter\stdchapter}
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+% From
+% https://amyrhoda.wordpress.com/2012/06/04/latex-to-lulu-the-making-of-aosa-other-useful-packages-and-settings/
+
+% The microtype package provides the ability to micromanage your
+% typography. When invoked without any options it does some nice things
+% like protruding punctuation over the edge of the right margin to make
+% the margin appear smoother. Basically it makes your book look more
+% professional with very little effort. It also has a ton of options if
+% you want to micromanage even more.
+\usepackage{microtype}
+
+% By dafault, LaTeX will try and make all your pages the length that
+% you set using the geometry setting. If a page has images, tables,
+% headings or paragraph breaks which make it shorter than that page
+% length, LaTeX will pad the page by adding whitespace between
+% elements. We thought that looked sillier than having pages be
+% different lengths, so we used the raggedbottom command.
+\raggedbottom
+
+% Hint for figure with empty title: remove the colon label separator
+\usepackage{caption}
+\captionsetup[figure]{labelsep=none}
+
+% Fix the page number reset done by abstract by redefining it
+% Patch from
+% https://github.com/petterreinholdtsen/free-culture-lessig/pull/7
+
+\def\nocount#1#2{}
+\let\stdsetcounter\setcounter
+\let\stdabstract=\abstract
+\let\endstdabstract=\endabstract
+\renewenvironment{abstract}{%
+  \let\setcounter\nocount%
+  \begin{stdabstract}%
+  \noindent%
+  \setlength\parskip{\medskipamount}%
+  \setlength\parindent{0pt}%
+}{
+  \end{stdabstract}
+  \let\setcounter\stdsetcounter
+}
diff --git a/rapport-docinfo-footer.xml b/rapport-docinfo-footer.xml
new file mode 100644
index 0000000..3460f07
--- /dev/null
+++ b/rapport-docinfo-footer.xml
@@ -0,0 +1,87 @@
+<colophon>
+<title></title>
+<?latex {\centering
+?>
+<para>
+Virkninger av angrefristloven: Sluttrapport til oppdragsgiverne /
+Ole-Erik Yrvin.
+</para>
+
+<para>
+FÃ¸rste gang publisert i 1979.
+</para>
+
+<para>
+  Denne utgaven ble publisert av Petter Reinholdtsen 2023.
+</para>
+
+<para>
+Typesatt med
+<ulink url="http://dblatex.sourceforge.net">dblatex</ulink> og
+skrifttypen Crimson Text.
+</para>
+
+<para>
+  Omslaget er laget av Petter Reinholdtsen.  Figurer i boken er
+  gjentegnet av Petter Reinholdtsen basert pÃ¥ originalfigurene fra
+  1979.
+</para>
+
+<para>
+  Kildefilene er tilgjengelig fra
+  <ulink url="https://codeberg.org/pere/text-angrefrist"/>.  Rapporter
+  eventuelle kommentarer og innspill om boken der.
+</para>
+
+<para>
+  <informalfigure id="cc-logo">
+    <graphic fileref="images/CC0_button.svg" align="center" width="11%"></graphic>
+  </informalfigure>
+</para>
+
+<para>
+  Denne dokumentet faller inn under unntakene i Ã¥ndsverkslovens Â§ 14,
+  og er ikke opphavsrettslig vernet.  For Ã¥ gjÃ¸re det enklere for folk
+  utenfor Norge, er den ogsÃ¥ publisert med bruksvilkÃ¥rene til Creative
+  Commons 0.  For mer informasjon om disse bruksvilkÃ¥rene, besÃ¸k
+  <ulink url="https://creativecommons.org/publicdomain/zero/1.0/deed.en"/>.
+</para>
+
+<para>
+  Videredistribusjon og bruk i kildeformat (Asciidoc) og
+  kompilert form (XML, HTML, PDF, PostScript, RTF og sÃ¥ videre) er
+  tillatt bÃ¥de med og uten endringer.
+</para>
+
+<?latex } %\centering
+?>
+
+<para>
+<informaltable id="isbn">
+<tgroup cols="2" align="left">
+<thead>
+ <row>
+ <entry>Format / MIME-type</entry>
+ <entry>ISBN</entry>
+ </row>
+</thead>
+
+<tbody>
+ <row>
+ <entry>US Trade utgave fra lulu.com</entry>
+ <entry>978-82-93828-18-1</entry>
+ </row>
+ <row>
+ <entry>application/pdf</entry>
+ <entry>*978-82-93828-19-8</entry>
+ </row>
+ <row>
+ <entry>application/epub+zip</entry>
+ <entry>978-82-93828-20-4</entry>
+ </row>
+</tbody>
+</tgroup>
+</informaltable>
+</para>
+
+</colophon>
diff --git a/rapport-docinfo.xml b/rapport-docinfo.xml
index 62ab1f8..3c55e38 100644
--- a/rapport-docinfo.xml
+++ b/rapport-docinfo.xml
@@ -1,7 +1,7 @@
 <pubdate>2023-10-15</pubdate>
 <edition>1</edition>
 <legalnotice>
-      <para>Denne spesifikasjonen faller inn under unntakene i
+      <para>Denne dokumentet faller inn under unntakene i
       Ã¥ndsverkslovens Â§ 14<footnote><para>Â«Lover, forskrifter,
       rettsavgjÃ¸relser og andre vedtak av offentlig myndighet er uten
       vern etter denne loven. Det samme gjelder forslag, utredninger,
diff --git a/rapport.adoc b/rapport.adoc
index 6f8f4c1..7b7b6a9 100644
--- a/rapport.adoc
+++ b/rapport.adoc
@@ -1,6 +1,6 @@
 = Virkninger av angrefristloven: Sluttrapport til oppdragsgiverne
 :lang: nb
-:docinfo: private-head
+:docinfo: private-head,private-footer
 
 include::rapport-forord.adoc[]
 
-- 
2.51.0

