1 |
commit: 1a510e755d964b4b96a1cbc429b3e5774e8234bc |
2 |
Author: Ulrich Müller <ulm <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Jun 24 16:39:44 2020 +0000 |
4 |
Commit: Ulrich Müller <ulm <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Jun 24 16:39:44 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/pms.git/commit/?id=1a510e75 |
7 |
|
8 |
pms.cls: Drop the caption package because it interferes with TeX4ht. |
9 |
|
10 |
The "caption" package already caused issues in the past (for example, |
11 |
see commits b35f619 and 467f1b7), and version v3.4h finally broke the |
12 |
list of tables in HTML output. TeX4ht upstream says that the package |
13 |
should be avoided: https://puszcza.gnu.org.ua/bugs/?313#comment8 |
14 |
|
15 |
Positioning the caption above the table is simple enough without using |
16 |
the package. So we only lose the boldface labels which is a very minor |
17 |
issue. |
18 |
|
19 |
As an added bonus, this allows removal of most workarounds that were |
20 |
necessary for TeX4ht. |
21 |
|
22 |
Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org> |
23 |
|
24 |
pms.cls | 67 +++++++++++++++++++++++++++-------------------------------------- |
25 |
1 file changed, 28 insertions(+), 39 deletions(-) |
26 |
|
27 |
diff --git a/pms.cls b/pms.cls |
28 |
index d7047cf..d7dc8e8 100644 |
29 |
--- a/pms.cls |
30 |
+++ b/pms.cls |
31 |
@@ -17,8 +17,6 @@ |
32 |
\PassOptionsToPackage{textwidth=400pt,textheight=700pt, |
33 |
left=20mm,marginparsep=10pt,marginparwidth=40mm, |
34 |
vmarginratio=1:2,includehead}{geometry} |
35 |
-% Position caption of float environments at the top |
36 |
-\PassOptionsToPackage{position=top,labelfont=bf}{caption} |
37 |
% Enable UTF-8 input encoding |
38 |
\PassOptionsToPackage{utf8}{inputenc} |
39 |
\PassOptionsToPackage{quiet}{marginnote} |
40 |
@@ -43,20 +41,14 @@ |
41 |
parskip, % Space between paragraphs instead of indentation |
42 |
underscore, % Allow simple _ instead of \_ |
43 |
chngcntr, % Redefinition of counters |
44 |
- tocbibind % Add bibliography to table of contents |
45 |
+ tocbibind, % Add bibliography to table of contents |
46 |
+ float, % More control over float environments |
47 |
+ hyperref, % Support for hyperlinks |
48 |
+ gitinfo2, % Metadata from git |
49 |
+ algorithm, % |
50 |
+ algorithmic % Set algorithms |
51 |
} |
52 |
|
53 |
-% tex4ht workaround: hyperref needs to be loaded /after/ tex4ht injects itself |
54 |
-\g@addto@macro\@documentclasshook{ |
55 |
- \RequirePackage{ |
56 |
- caption, % Extended float environment formatting |
57 |
- float, % More control over float environments |
58 |
- hyperref, % Support for hyperlinks |
59 |
- gitinfo2, % Metadata from git |
60 |
- algorithm, % |
61 |
- algorithmic % Set algorithms |
62 |
- } |
63 |
-} |
64 |
\ClassInfo{pms}{Capsulation of LaTeX stuff for the Package Manager |
65 |
Specification, loaded baseclass: \ClassToLoad\MessageBreak} |
66 |
|
67 |
@@ -75,15 +67,6 @@ |
68 |
\setboolean{TEX4HT-HACKS}{true} |
69 |
\fi |
70 |
|
71 |
-% tex4ht workaround: these need to happen after loading the float package |
72 |
-\g@addto@macro\@documentclasshook{ |
73 |
- \floatstyle{ruled} |
74 |
- \captionsetup[ruled]{labelsep=default,labelfont=bf} |
75 |
- \newfloat{listing}{tbp}{lol}[chapter] |
76 |
- \floatname{listing}{Listing} |
77 |
-} |
78 |
-\newcommand{\listoflistings}{\listof{listing}{List of Listings}} |
79 |
- |
80 |
% Define own label and reference commands, that display the label in |
81 |
% the page margin. |
82 |
\ifthenelse{\boolean{TEX4HT-HACKS}}{% |
83 |
@@ -117,11 +100,8 @@ |
84 |
\counterwithout{footnote}{chapter} |
85 |
|
86 |
% Some shorthands for the lazy ones. |
87 |
-% tex4ht workaround: this needs to happen after loading hyperref |
88 |
-\g@addto@macro\@documentclasshook{ |
89 |
- \renewcommand{\i}[1]{\textit{#1}} |
90 |
- \renewcommand{\t}[1]{\texttt{#1}} |
91 |
-} |
92 |
+\renewcommand{\i}[1]{\textit{#1}} |
93 |
+\renewcommand{\t}[1]{\texttt{#1}} |
94 |
\newcommand{\e}[1]{\emph{#1}} |
95 |
\newcommand{\note}[1]{\begin{trivlist}\item\textbf{Note:} #1\end{trivlist}} |
96 |
|
97 |
@@ -138,6 +118,17 @@ |
98 |
% Define a new column type P for tables, like p but with ragged-right text |
99 |
\newcolumntype{P}[1]{>{\setlength\rightskip{0pt plus 1fil}}p{#1}} |
100 |
|
101 |
+% Define a float environment for listings |
102 |
+\floatstyle{ruled} |
103 |
+\newfloat{listing}{tbp}{lol}[chapter] |
104 |
+\floatname{listing}{Listing} |
105 |
+\newcommand{\listoflistings}{\listof{listing}{List of Listings}} |
106 |
+ |
107 |
+% We always place captions above floats, so redefine vertical spacings |
108 |
+% Don't use the "caption" package because it interferes with TeX4ht |
109 |
+\setlength\belowcaptionskip{\abovecaptionskip} |
110 |
+\setlength\abovecaptionskip{0pt} |
111 |
+ |
112 |
% Prevent numbers in list of tables from overrunning into the table captions |
113 |
\renewcommand*{\l@figure}{\@dottedtocline{1}{1.5em}{2.8em}} % was 2.3em |
114 |
\let\l@table\l@figure |
115 |
@@ -148,18 +139,16 @@ |
116 |
\setlength\emergencystretch{1em} % was 0 |
117 |
|
118 |
% Define some PDF meta-data. |
119 |
-% tex4ht workaround: this needs to happen after loading hyperref |
120 |
-\g@addto@macro\@documentclasshook{ |
121 |
- \hypersetup{% |
122 |
- urlcolor=black, |
123 |
- colorlinks=true, |
124 |
- citecolor=black, |
125 |
- linkcolor=black, |
126 |
- pdflang={en}, |
127 |
- pdfcreator={pdfLaTeX and hyperref}, |
128 |
- pdfproducer={pdfLaTeX and hyperref}, |
129 |
- } |
130 |
+\hypersetup{% |
131 |
+ urlcolor=black, |
132 |
+ colorlinks=true, |
133 |
+ citecolor=black, |
134 |
+ linkcolor=black, |
135 |
+ pdflang={en}, |
136 |
+ pdfcreator={pdfLaTeX and hyperref}, |
137 |
+ pdfproducer={pdfLaTeX and hyperref}, |
138 |
} |
139 |
+ |
140 |
% Reads the last commit date from the Git repository and even succeeds |
141 |
% when none is available |
142 |
\date{% |