summaryrefslogtreecommitdiff
path: root/support/tex4ebook/tex4ebook.sty
blob: 3ce94dd203b0331cb4527a79cfed7920efc3f411 (plain)
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
% Package tex4ebook. Author Michal Hoftich <michal.h21@gmail.com>
% This package is subject of LPPL license, version 1.3 
\ProvidesPackage{tex4ebook}[2016/03/31 version 0.1d]
\RequirePackage{etoolbox}
\RequirePackage{kvoptions}
\RequirePackage{graphicx}
% Command for generating NCX file. The hard work is done in the file
% tex4ebook.4ht
\def\ncxtable{}
% Command for generating OPF file 
\def\opftable{}

%Declare RFC3066 language code for babel language name
\def\DeclareLanguageEbook#1#2{%
\csgdef{rfclang#1}{#2}%
}
\def\GetLanguage{%
\ifx\bbl@main@language\@undefined en-US%  
\else%
\ifcsdef{rfclang\bbl@main@language}{\csuse{rfclang\bbl@main@language}}{}%
\fi%
}

\DeclareLanguageEbook{UKenglish}{en-GB}
\DeclareLanguageEbook{USenglish}{en-US}
\DeclareLanguageEbook{acadian}{fr}
\DeclareLanguageEbook{albanian}{sq}
\DeclareLanguageEbook{american}{en-US}
\DeclareLanguageEbook{amharic}{am}
\DeclareLanguageEbook{arabic}{ar}
\DeclareLanguageEbook{armenian}{hy}
\DeclareLanguageEbook{australian}{en-US}
\DeclareLanguageEbook{austrian}{de}
\DeclareLanguageEbook{basque}{eu}
\DeclareLanguageEbook{bengali}{bn}
\DeclareLanguageEbook{brazilian}{pt}
\DeclareLanguageEbook{brazil}{pt}
\DeclareLanguageEbook{breton}{br}
\DeclareLanguageEbook{british}{en-GB}
\DeclareLanguageEbook{bulgarian}{bg}
\DeclareLanguageEbook{canadian}{en-US}
\DeclareLanguageEbook{canadien}{fr}
\DeclareLanguageEbook{catalan}{ca}
\DeclareLanguageEbook{croatian}{hr}
\DeclareLanguageEbook{czech}{cs-CZ}
\DeclareLanguageEbook{danish}{da}
\DeclareLanguageEbook{divehi}{dv}
\DeclareLanguageEbook{dutch}{nl}
\DeclareLanguageEbook{english}{en}
\DeclareLanguageEbook{esperanto}{eo}
\DeclareLanguageEbook{estonian}{et}
\DeclareLanguageEbook{finnish}{f\/i}
\DeclareLanguageEbook{francais}{fr}
\DeclareLanguageEbook{french}{fr}
\DeclareLanguageEbook{galician}{gl}
\DeclareLanguageEbook{germanb}{de}
\DeclareLanguageEbook{german}{de}
\DeclareLanguageEbook{greek}{el}
\DeclareLanguageEbook{hebrew}{he}
\DeclareLanguageEbook{hindi}{hi}
\DeclareLanguageEbook{hungarian}{hu}
\DeclareLanguageEbook{icelandic}{is}
\DeclareLanguageEbook{interlingua}{ia}
\DeclareLanguageEbook{irish}{ga}
\DeclareLanguageEbook{italian}{it}
\DeclareLanguageEbook{kannada}{kn}
\DeclareLanguageEbook{khmer}{km}
\DeclareLanguageEbook{korean}{ko}
\DeclareLanguageEbook{lao}{lo}
\DeclareLanguageEbook{latin}{la}
\DeclareLanguageEbook{latvian}{lv}
\DeclareLanguageEbook{lithuanian}{lt}
\DeclareLanguageEbook{lowersorbian}{dsb}
\DeclareLanguageEbook{magyar}{hu}
\DeclareLanguageEbook{malayalam}{ml}
\DeclareLanguageEbook{marathi}{mr}
\DeclareLanguageEbook{naustrian}{de}
\DeclareLanguageEbook{newzealand}{en}
\DeclareLanguageEbook{ngerman}{de}
\DeclareLanguageEbook{norsk}{no}
\DeclareLanguageEbook{norwegiannynorsk}{nn}
\DeclareLanguageEbook{nynorsk}{no}
\DeclareLanguageEbook{occitan}{oc}
\DeclareLanguageEbook{oldchurchslavonic}{cu}
\DeclareLanguageEbook{persian}{fa}
\DeclareLanguageEbook{polish}{pl-PL}
\DeclareLanguageEbook{polutonikogreek}{el}
\DeclareLanguageEbook{portuges}{pt}
\DeclareLanguageEbook{portuguese}{pt}
\DeclareLanguageEbook{romanian}{ro}
\DeclareLanguageEbook{romansh}{rm}
\DeclareLanguageEbook{russian}{ru}
\DeclareLanguageEbook{samin}{se}
\DeclareLanguageEbook{sanskrit}{sa}
\DeclareLanguageEbook{scottish}{gd}
\DeclareLanguageEbook{serbian}{sr}
\DeclareLanguageEbook{serbo-croatian}{sh}
\DeclareLanguageEbook{slovak}{sk}
\DeclareLanguageEbook{slovene}{sl}
\DeclareLanguageEbook{slovenian}{sl}
\DeclareLanguageEbook{spanish}{es}
\DeclareLanguageEbook{swedish}{sv}
\DeclareLanguageEbook{tamil}{ta}
\DeclareLanguageEbook{telugu}{te}
\DeclareLanguageEbook{thai}{th}
\DeclareLanguageEbook{tibetan}{bo}
\DeclareLanguageEbook{turkish}{tr}
\DeclareLanguageEbook{turkmen}{tk}
\DeclareLanguageEbook{ukrainian}{uk}
\DeclareLanguageEbook{uppersorbian}{hsb}
\DeclareLanguageEbook{urdu}{ur}
\DeclareLanguageEbook{vietnamese}{vi}
\DeclareLanguageEbook{welsh}{cy}

\AtEndDocument{%
\ncxtable
\opftable
}

% Default empty values
\def\Title{Unnamed}
\def\Author{Anonymous}

% We need to save values of title, author etc.
\let\tf@orig@title\title

% normal \title
\newcommand\tf@title[1]{%
  \tf@orig@title{#1}%
  \let\Title\@title%
}

% \title with optional argument
\newcommand\tf@opttitle[2][]{%
  \tf@orig@title[#1]{#2}%
  \let\Title\@title%
}

% some classes (amsart) define \title command with optional argument
\renewcommand\title{%
\@ifnextchar[\tf@opttitle\tf@title%
}

\let\tf@orig@author\author
\newcommand\tf@author[1]{%
  \tf@orig@author{#1}%
  \def\Author{#1}%
}

\newcommand\tf@optauthor[2][]{%
  \tf@orig@author[#1]{#2}%
  \def\Author{#2}%
}

% support optiona argument for \author as well
\renewcommand\author{%
\@ifnextchar[\tf@optauthor\tf@author%
}

%\let\Author\@author
\let\Date\today
\let\origdate\date
\renewcommand\date[1]{%
  \origdate{#1}%
  \let\Date\@date%
}
%}


% Fixes for AMS classess
\AddToHook{class/after}{%
  \ifx\authors\@empty%
  \def\@maketitle@hook{
  \global\let\Author\authors
  }
  \fi%
}

\newcommand\coverimage[2][]{\includegraphics[#1]{#2}}