-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdbkindle.sty
233 lines (185 loc) · 5.85 KB
/
dbkindle.sty
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
%%
%% This is a DocBook LaTeX style example
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{dbkindle}[2011/05/17 DocBook Style for Kindle]
% The defined options required by dblatex
\DeclareOption{hyperlink}{ \def\DBKhyperlink{yes} }
\DeclareOption{nohyperlink}{ \def\DBKhyperlink{no} }
% Default values
\ExecuteOptions{hyperlink}
% If defined, process the options
\ProcessOptions\relax
% Needed packages
\usepackage{float}
%%%%%%%%%%%%%%%%% memoir needs modifications in dbk_core %%%%%%%%%%%%%%%%%%%%%%%%%%
%\usepackage{dbk_core}
%
% Basic core definitions used for DocBook
%
\usepackage{graphicx}
\usepackage{ifthen}
\usepackage{subfig}
\usepackage{enumitem}
\usepackage{footmisc}
%
% These <bookinfo|articleinfo> parameters must be defined
%
\newcommand{\DBKreference}{} % mapped to <pubsnumber>
\newcommand{\DBKsite}{} % mapped to <bookinfo/address>
\newcommand{\DBKdate}{\today} % mapped to <bookinfo/date>
\newcommand{\DBKreleaseinfo}{Working Paper} % mapped to <releaseinfo>
\newcommand{\DBKedition}{} % mapped to <edition>
\newcommand{\DBKsubtitle}{} % mapped to <subtitle>
\newcommand{\DBKpubdate}{} % mapped to <pubdate>
\newcommand{\DBKcopyright}{} % mapped to <copyright>
\newcommand{\DBKlegalblock}{} % mapped to <legalnotice> stuff
\newcommand{\DBKlegaltitle}{} % idem
% Main latex <othercredit> command. It will be redefined by the XSL stylesheets.
\newcommand{\DBKindexation}{}
% Watermark command
\def\showwatermark#1{}
% Front/main/back matter macros
\@ifundefined{frontmatter}{ \let\frontmatter\relax }{}
\@ifundefined{mainmatter}{ \let\mainmatter\relax }{}
\@ifundefined{backmatter}{ \let\backmatter\relax }{}
%
% Main latex <revhistory> command. It will be redefined by the XSL stylesheets.
%
\newcommand{\DBKrevhistory}{}
\usepackage{dbk_fonts}
% Remove leading spaces from section titles. The patch has to be defined prior to calling hyperref package which changes the definition of \M@sect command
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\makeatletter
\patchcmd{\M@sect}{\@M #9}{\@M \ignorespaces #9}{}{}
\makeatother
\usepackage{dbkindle_hyper}
\usepackage{dbk_biblio}
\usepackage{dbk_table}
\usepackage{dbk_graphic}
\usepackage{dbk_callout}
\usepackage{dbk_locale}
\usepackage{dbk_annot}
% Beware with changebar and AtEndDocument!
\usepackage{dbk_changebar}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% end of dbk_core
% LaTeX <othercredit> commands to define
%
% #1: mapped to <contrib>
% #2: mapped to <firstname> <surname>
%
\def\DBKinditem#1#2{
#2 & #1 \tabularnewline
\hline
}
\newenvironment{DBKindtable}{
\begin{tabular}{ |l|l| }
\hline
\emph{Collaborator} & \emph{Contribution}
\hline
}{
\end{tabular}
}
%
% Latex <revhistory> table
%
\newenvironment{DBKrevtable}{
\begin{longtable}{ |l|l|l|l| }
\hline
Revision number & Date & Release Info & Author \tabularnewline
\hline
\endhead
}{
\end{longtable}
}
%
% <legalnotice> environment skip the information
%
\newenvironment{DBKlegalnotice}{
}{
}
%
% These floats must be defined to map <example> and <equation>
%
%\usepackage{float}
\floatstyle{ruled}
\newfloat{example}{ht}{loe}[section]
\floatname{example}{Example}
\floatstyle{plain}
\newfloat{dbequation}{ht}{loe}[section]
\floatname{dbequation}{{\scshape Equation }}
%
% Nothing special for <note>, <caution>, <warning>
%
\newenvironment{DBKadmonition}[2] {
}{
}
%% OBSOLETE, memoir takes care of that
%% % force correct positioning of partially full pages by placing invisible (light gray) dots into page corners
%% \usepackage[width=85.09mm, height=111.76mm, center]{crop}
%% \usepackage[pdftex]{pict2e}
%% \newcommand*\cornerCrop{%
%% \begin{picture}(0,0)
%% \unitlength1pt
%% \put(0,0){\color{light-gray}\circle*{1}}
%% \end{picture}}
%% \cropdef\cornerCrop\cornerCrop\cornerCrop\cornerCrop{cornerDots}
%% \crop[cornerDots]
% Configure screen's geometry in that file
\usepackage{dbkindle_geometry}
\definecolor{light-gray}{gray}{0.95}
\renewcommand*{\trimmarkscolor}{\color{light-gray}}
% font
\usepackage{dbkindle_font}
% reduces amount of hyphenations but makes paragraphs less pretty.
% On the other hand without this you’ll get text running off the right side of the screen sometimes.
%\sloppy
% no header/footer
\pagestyle{empty}
\aliaspagestyle{chapter}{empty}
\aliaspagestyle{part}{empty}
% omit words Chapter, Part etc and their numbering
\setcounter{part}{-1}
\setcounter{chapter}{-1}
\renewcommand{\chaptername}{}
\renewcommand{\partname}{}
\renewcommand{\thechapter}{}
\renewcommand{\thepart}{}
\renewcommand{\thesection}{}
% Removes gap between section's number and title
\setsecnumformat{}
% babel requires different approach to turn non-english words for chapter, part, etc off
\ifdefined\addto %
\addto\captionsrussian{%
\def\chaptername{}%
\def\partname{}%
}%
\fi
% Do not make space between sentences wider than the space between words
\frenchspacing
% Fancy chapter titles
%\usepackage[Sonny]{fncychap}
% Fancy breaks
% Lists of available symbols:
% http://willbenton.com/wb-images/pifont.pdf
% http://mirror.unl.edu/ctan/fonts/fourier-GUT/doc/latex/fourier/fourier-orns.pdf
\usepackage{fourier-orns}
\renewcommand{\pfbreakdisplay}{%
\decofourright\quad\decofourright\quad\decofourright}
\usepackage{footnote} % To deal with footnotes in e.g. epigraphs
\usepackage{calc}
% Epigraphs
\setlength{\epigraphrule}{0pt}
\setlength{\beforeepigraphskip}{0pt}
\setlength{\afterepigraphskip}{0pt}
\setlength{\epigraphwidth}{\stockwidth * 3 / 4}
\epigraphfontsize{\footnotesize}
\usepackage{footnpag} % reset footnote counter when new page starts
\usepackage{ellipsis} % make ellipsis look nicer
%\renewcommand{\ldots}{\textellipsis}
\usepackage{bookmark}
%% not needed for lualatex
\usepackage{dbkindle_unicode}
\usepackage{dbkindle_title}
\usepackage{dbkindle_verbatim}
\usepackage{dbkindle_graphics}