Gentoo Archives: gentoo-pms

From: David Leverton <levertond@××××××××××.com>
To: gentoo-pms@l.g.o
Cc: David Leverton <levertond@××××××××××.com>
Subject: [gentoo-pms] [PATCH] Work around TeX4ht being weird
Date: Mon, 13 Apr 2009 21:16:41
Message-Id: 1239657396-13771-1-git-send-email-levertond@googlemail.com
In Reply to: Re: [gentoo-pms] Patches for your reviewing pleasure: Various improvements, including cheat sheet by Christian Faulhammer
---
 pms.cls |   27 +--------------------------
 pms.tex |   35 +++++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+), 26 deletions(-)

Seems that loading hyperref inside a document class breaks TeX4ht: it
does funny magic to load itself after the document class, but it also
needs to be loaded before hyperref, so if hyperref is loaded in the
class, TeX4ht gets in too late.  This patch seems to get it to work,
but it's fairly hacky - might be cleaner just to revert the pms.cls
patch. :-(

diff --git a/pms.cls b/pms.cls
index ca0874c..8f9c093 100644
--- a/pms.cls
+++ b/pms.cls
@@ -9,32 +9,25 @@
 \LoadClass{\ClassToLoad}
 \PassOptionsToPackage{T1}{fontenc}
 \PassOptionsToPackage{orig,english}{isodate}
-\PassOptionsToPackage{position=top}{caption}
 \PassOptionsToPackage{utf8}{inputenc}
-% algorithmic and algorithm to be loaded last to avoid failures
 \RequirePackage{%
   fontenc,
   isodate,
   typearea,
-  caption,
   inputenc,
   appendix,
   booktabs,
   color,
   enumitem,
-  float,
   fullpage,
   graphicx,
-  hyperref,
   ifthen,
   longtable,
   lscape,
   marginnote,
   paralist,
   parskip,
-  verbatim,
-  algorithm,
-  algorithmic
+  verbatim
 }
 \ClassInfo{pms}{Capsulation of LaTeX stuff for the Package Manager
   Specification, loaded baseclass: \ClassToLoad\MessageBreak}
@@ -51,9 +44,6 @@
     \setboolean{TEX4HT-HACKS}{true}
 \fi
 
-\floatstyle{plaintop}
-\newfloat{listing}{tbp}{lol}[chapter]
-\floatname{listing}{Listing}
 \newcommand{\listoflistings}{\listof{listing}{Listings}}
 \newcommand{\featureref}[1]{\textsc{#1} on page~\pageref{feat:#1}}
 \newcommand{\compactfeatureref}[1]{#1~p\pageref{feat:#1}}
@@ -61,7 +51,6 @@
 \bibliographystyle{plainurl}
 
 \renewcommand{\t}[1]{\texttt{#1}}
-\renewcommand{\i}[1]{\textit{#1}}
 \newcommand{\e}[1]{\emph{#1}}
 \renewcommand{\b}[1]{\textbf{#1}}
 \newcommand{\note}[1]{\paragraph{Note:} #1}
@@ -108,20 +97,6 @@
   \end{table}
 }
 
-\hypersetup{%
-  urlcolor=black,
-  colorlinks=true,
-  citecolor=black,
-  linkcolor=black,
-  pdftitle={Package Manager Specification},
-  pdfauthor={Stephen P. Bennett, Ciaran McCreesh},
-  pdfcreator={pdfLaTeX and hyperref},
-  pdfsubject={Defining a feature set for package managers in the
-    Gentoo world},
-  pdflang={en},
-  pdfkeywords={Gentoo, package manager, specification},
-  pdfproducer={pdfLaTeX and hyperref},
-}
 \title{Package Manager Specification}
 \author{Stephen P. Bennett\\\url{spb@×××××××.org}
 \and Ciaran McCreesh\\\url{ciaran.mccreesh@××××××××××.com}}
diff --git a/pms.tex b/pms.tex
index 8426706..60eea42 100644
--- a/pms.tex
+++ b/pms.tex
@@ -1,5 +1,40 @@
 \documentclass{pms}
 
+% Can't be in pms.cls because that interferes with tex4ht's weird
+% hacks, specifically hyperref has to be loaded /after/
+% \documentclass, and then the other packages, plus the redefinition
+% of \i, have to be after hyperref.
+
+% algorithmic and algorithm to be loaded last to avoid failures
+\usepackage[position=top]{caption}
+\usepackage{%
+  hyperref,
+  float,
+  algorithm,
+  algorithmic
+}
+
+\renewcommand{\i}[1]{\textit{#1}}
+
+\floatstyle{plaintop}
+\newfloat{listing}{tbp}{lol}[chapter]
+\floatname{listing}{Listing}
+
+\hypersetup{%
+  urlcolor=black,
+  colorlinks=true,
+  citecolor=black,
+  linkcolor=black,
+  pdftitle={Package Manager Specification},
+  pdfauthor={Stephen P. Bennett, Ciaran McCreesh},
+  pdfcreator={pdfLaTeX and hyperref},
+  pdfsubject={Defining a feature set for package managers in the
+    Gentoo world},
+  pdflang={en},
+  pdfkeywords={Gentoo, package manager, specification},
+  pdfproducer={pdfLaTeX and hyperref},
+}
+
 \begin{document}
 \maketitle
 
-- 
1.6.2.2

Replies

Subject Author
Re: [gentoo-pms] [PATCH] Work around TeX4ht being weird Christian Faulhammer <fauli@g.o>