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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
|
% Copyright 2019 Ekaitz Zarraga <ekaitz@elenq.tech>
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
% http://www.apache.org/licenses/LICENSE-2.0
%
% Unless required by applicable law or agreed to in writing, software
% distributed under the License is distributed on an "AS IS" BASIS,
% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
% See the License for the specific language governing permissions and
% limitations under the License.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ElenQ book template
% -----------------------------------------------------------------------------
%
% Expects some metadata to be set:
%
% title: The title of the document
% subtitle: The subtitle of the book
% author: list of author's name
% license: License of the document
% lang: es-ES
% polyglossia:
% name: spanish
%
% It also accepts some optional metadata:
%
% toc: true | false # Activate table of contents (defaults to true)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[
b5paper,
12pt,
$if(lang)$
$babel-lang$,
$endif$
]{$documentclass$}
\usepackage{tikz}
\usepackage{epstopdf}
% Language control from Metadata
$if(lang)$
% Load polyglossia as late as possible: uses bidi with RTL langages (e.g. Hebrew, Arabic)
\usepackage{polyglossia}
\setmainlanguage[$polyglossia-lang.options$]{$polyglossia-lang.name$}
$for(polyglossia-otherlangs)$
\setotherlanguage[$polyglossia-otherlangs.options$]{$polyglossia-otherlangs.name$}
$endfor$
$endif$
% Clear-to-left command: Useful for credits and backcover
\newcommand*\cleartoleftpage{
\clearpage
\ifodd\value{page}\hbox{}\newpage\fi
}
% No indent
\usepackage{parskip}
% Margins
\usepackage[top=1.5cm,
bottom=1.5cm,
left=1.75cm,
right=2.1cm,
footskip=1.3cm,
includeheadfoot=true]{geometry}
% Spacing
\usepackage{setspace}
% Font
\usepackage{moresize}
\usepackage{anyfontsize} % para seleccionar tamaño de fuente
\usepackage{fontspec}
\setmainfont[
BoldFont = Lato-Bold.ttf,
ItalicFont = Lato-Italic.ttf,
BoldItalicFont = Lato-BoldItalic.ttf
]{Lato-Regular.ttf}
\newcommand{\euro}{€}
% Font footnote size
\makeatletter
\renewcommand\footnotesize{%
\@setfontsize\footnotesize\@ixpt{10}%
\abovedisplayskip 6\p@ \@plus2\p@ \@minus4\p@
\abovedisplayshortskip \z@ \@plus\p@
\belowdisplayshortskip 4\p@ \@plus2\p@ \@minus2\p@
\def\@listi{\leftmargin\leftmargini
\topsep 4\p@ \@plus2\p@ \@minus2\p@
\parsep 2\p@ \@plus\p@ \@minus\p@
\itemsep \parsep}%
\belowdisplayskip \abovedisplayskip
}
\makeatother
% Pretty hyperlinks
\usepackage{hyperref}
$if(colorlinks)$
\PassOptionsToPackage{usenames,dvipsnames}{color} % color is loaded by hyperref
$endif$
\hypersetup{unicode=true,
$if(title-meta)$
pdftitle={$title-meta$},
$endif$
$if(lang)$
pdflang={$lang$},
$endif$
$if(author-meta)$
pdfauthor={$author-meta$},
$endif$
$if(keywords)$
pdfkeywords={$for(keywords)$$keywords$$sep$; $endfor$},
$endif$
$if(colorlinks)$
colorlinks=true,
linkcolor=$if(linkcolor)$$linkcolor$$else$Maroon$endif$,
citecolor=$if(citecolor)$$citecolor$$else$Blue$endif$,
urlcolor=$if(urlcolor)$$urlcolor$$else$Blue$endif$,
$else$
pdfborder={0 0 0},
$endif$
breaklinks=true}
% Hyperlinks as footnotes control from Metadata
$if(links-as-notes)$
\renewcommand{\href}[2]{#2\footnote{\url{#1}}}
$endif$
% Verbatim in footnotes control from Metadata
$if(verbatim-in-note)$
\usepackage{fancyvrb}
\VerbatimFootnotes
$endif$
% Syntax highlight
\usepackage{color}
\usepackage{fancyvrb}
\newcommand{\VerbBar}{|}
\newcommand{\VERB}{\Verb[commandchars=\\\{\}]}
\DefineVerbatimEnvironment{Highlighting}{Verbatim}{
commandchars=\\\{\},
fontsize=\footnotesize,
xleftmargin=6mm,
numbersep=2mm
}
\newenvironment{Shaded}{}{}
\newcommand{\AlertTok}[1]{\textbf{#1}}
\newcommand{\AnnotationTok}[1]{\textit{#1}}
\newcommand{\AttributeTok}[1]{#1}
\newcommand{\BaseNTok}[1]{#1}
\newcommand{\BuiltInTok}[1]{#1}
\newcommand{\CharTok}[1]{#1}
\newcommand{\CommentTok}[1]{\textit{#1}}
\newcommand{\CommentVarTok}[1]{\textit{#1}}
\newcommand{\ConstantTok}[1]{#1}
\newcommand{\ControlFlowTok}[1]{\textbf{#1}}
\newcommand{\DataTypeTok}[1]{\underline{#1}}
\newcommand{\DecValTok}[1]{#1}
\newcommand{\DocumentationTok}[1]{\textit{#1}}
\newcommand{\ErrorTok}[1]{\textbf{#1}}
\newcommand{\ExtensionTok}[1]{#1}
\newcommand{\FloatTok}[1]{#1}
\newcommand{\FunctionTok}[1]{#1}
\newcommand{\ImportTok}[1]{#1}
\newcommand{\InformationTok}[1]{\textit{#1}}
\newcommand{\KeywordTok}[1]{\textbf{#1}}
\newcommand{\NormalTok}[1]{#1}
\newcommand{\OperatorTok}[1]{#1}
\newcommand{\OtherTok}[1]{#1}
\newcommand{\PreprocessorTok}[1]{\textbf{#1}}
\newcommand{\RegionMarkerTok}[1]{#1}
\newcommand{\SpecialCharTok}[1]{#1}
\newcommand{\SpecialStringTok}[1]{#1}
\newcommand{\StringTok}[1]{#1}
\newcommand{\VariableTok}[1]{#1}
\newcommand{\VerbatimStringTok}[1]{#1}
\newcommand{\WarningTok}[1]{\textit{#1}}
% Multiple page tables if needed
$if(tables)$
\usepackage{longtable,booktabs}
$endif$
% Strikeout text if needed
$if(strikeout)$
\usepackage[normalem]{ulem}
% avoid problems with \sout in headers with hyperref:
\pdfstringdefDisableCommands{\renewcommand{\sout}{}}
$endif$
% Definitions related to chapters only if book is used
% REMAKE CHAPTER FOR FANCYHEADER
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\let\stdchapter\chapter
\renewcommand*\chapter{%
\@ifstar{\starchapter}{\@dblarg\nostarchapter}}
\newcommand*\starchapter[1]{
\stdchapter*{#1}
\thispagestyle{chapter} % This is the point
\markboth{\MakeUppercase{#1}}{}
}
\def\nostarchapter[#1]#2{
\stdchapter[{#1}]{#2}
\thispagestyle{chapter}
}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Chapter formating
% https://www.sharelatex.com/learn/Sections_and_chapters#/Customize_chapters_and_sections
\usepackage{titlesec}
\newcommand{\hsp}{\hspace{20pt}}
\titlespacing*{\chapter}{0pt}{0pt}{40pt}
% Title font
\usepackage{titling}
\usepackage{fontspec}
% Specify different font for section headings
\newfontfamily\headingfont[]{Pathway Gothic One}
\titleformat{\chapter}
[block]
{\HUGE\headingfont}
{}
{0pt}
{\MakeUppercase}
%\titleformat*{\chapter}{\Huge\headingfont}
\titleformat*{\section}{\Huge\headingfont}
\titleformat*{\subsection}{\LARGE\headingfont}
\titleformat*{\subsubsection}{\Large\headingfont}
\renewcommand{\maketitlehooka}{\headingfont}
% Custom header
\usepackage{fancyhdr} % man http://osl.ugr.es/CTAN/macros/latex/contrib/fancyhdr/fancyhdr.pdf
% No 'chapter' word
%\addto\captionsenglish{\renewcommand\chaptername{}}
% Scale images to avoid overflow by default
\usepackage{textcomp}
\usepackage{graphicx,grffile}
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
\makeatother
% Scale images if necessary, so that they will not overflow the page
% margins by default, and it is still possible to overwrite the defaults
% using explicit options in \includegraphics[width, height, ...]{}
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
% Copyleft symbol
\newcommand{\copyleft}{\reflectbox{\copyright}}
% Prevent overfull lines
\setlength{\emergencystretch}{3em}
\providecommand{\tightlist}{
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
% Redefine (sub)paragraphs to behave more like sections
$if(subparagraph)$
$else$
\ifx\paragraph\undefined\else
\let\oldparagraph\paragraph
\renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
\fi
\ifx\subparagraph\undefined\else
\let\oldsubparagraph\subparagraph
\renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
\fi
$endif$
\pagestyle{fancy}
% Header
%% ADDED LATER
\renewcommand{\headrulewidth}{0pt}
\fancyhead{} % clear header
% Footer
\fancyfoot{} % clear footer
%\renewcommand{\footrulewidth}{0.4pt}
\fancyfoot[LE]{\thepage \hspace{20pt} \scriptsize{\leftmark}}
\fancyfoot[RO]{\thepage}
%\fancyfoot[LO, RE]{$if(license)$\textcopyleft $endif$ $author$}
% Header on CHAPTER PAGE TODO
\fancypagestyle{chapter}{%
%\fancyhead{}
%\fancyhead[L]{\logo{0.5}}
%\fancyhead[R]{\LARGE{$title$}}
}
% Footer on cover
\fancypagestyle{titlepage}{%
\fancyhead{} % clear header
%\renewcommand{\headrulewidth}{0pt}
\fancyfoot[R]{
$if(author)$
$for(author)$$author$$sep$, $endfor$
$endif$
}
\fancyfoot[L]{$if(license)$ $license$ $endif$}
}
% Beautiful quotes
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{framed}
% Use custom leftbar
\renewenvironment{leftbar}[1][\hsize]
{\footnotesize\color{darkgray}
\def\FrameCommand{{\color{lightgray}\vrule width 2pt}}
\MakeFramed{\hsize#1\advance\hsize-\width\FrameRestore}%
}
{\endMakeFramed}
% Put leftbar on quote
\let\oldquote=\quote
\let\oldendquote=\endquote
\renewenvironment{quote}
{\vspace{10pt}\leftbar\vspace*{-10pt}\oldquote}
{\oldendquote\endleftbar\vspace{10pt}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
$for(header-includes)$
$header-includes$
$endfor$
% Metathings for title, author and date
$if(title)$
\title{$title$$if(thanks)$\thanks{$thanks$}$endif$}
$endif$
$if(subtitle)$
\providecommand{\subtitle}[1]{}
\subtitle{$subtitle$}
$endif$
$if(author)$
\author{$for(author)$$author$$sep$ \and $endfor$}
$endif$
\date{$date$}
\begin{document}
% Cover
$if(title)$
\begin{titlepage}
\thispagestyle{titlepage}
\vspace*{4cm}
{\fontsize{35}{45}\headingfont \MakeUppercase{$title$}}
\hfill
$if(subtitle)$
\begin{doublespace}
{\LARGE \headingfont $subtitle$}
\end{doublespace}
$endif$
\end{titlepage}
$endif$
% Acknowledgements
$if(acknowledgement)$
\cleardoublepage
\vspace*{4cm}
$acknowledgement$
\vspace*{\fill}
$endif$
% Credits page
% TODO
\cleartoleftpage
\thispagestyle{empty}
\null\vfill
\begin{flushleft}
\footnotesize{
$if(isbn)$
ISBN: $isbn$\newline
$endif$
$if(extracredits)$
$for(extracredits)$$extracredits$$sep$\newline $endfor$\newline
$endif$
$if(author)$
\copyright $for(author)$$author$$sep$, $endfor$ \newline
$endif$
$if(license-summary)$
$license-summary$\newline
$endif$
}
\end{flushleft}
\vspace{0cm}
$for(include-before)$
$include-before$
$endfor$
% Table of contents
$if(toc)$
\renewcommand{\contentsname}{$toc-title$}
{
$if(colorlinks)$
\hypersetup{linkcolor=$if(toccolor)$$toccolor$$else$black$endif$}
$endif$
\setcounter{tocdepth}{$toc-depth$}
\setcounter{secnumdepth}{$if(toc-secnumdepth)$$toc-secnumdepth$$else$0$endif$}
\tableofcontents
}
$endif$
% List of tables and list of figures
$if(lot)$
\listoftables
$endif$
$if(lof)$
\listoffigures
$endif$
% Body
$body$
$for(include-after)$
$include-after$
$endfor$
% Add backcover
\cleartoleftpage
\thispagestyle{empty}
\null\vfill
%\logo{0.8}
\includegraphics[]{templates/img/publishing_logo.eps}
\vspace{0cm}
\end{document}
|