summaryrefslogtreecommitdiff
path: root/support/tex4ebook/tex4ebook.sty
blob: 1b0114748c9fcbb8f89189c8e082407ab2ea8a58 (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
% 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\DeclareLanguage#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%
}

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

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