Attempting to make a 6x9 format
[themediocreprogrammer.git] / Pandoc / templates / pdf.latex
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 %%%%%% Base Document Settings
3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4 \documentclass%
5 [12pt] % Set default font size
6 {book} % Set document Class
7
8 %% Set page size and margins
9 \usepackage{geometry}
10   \geometry{
11   paperheight=203.2mm, %actual height measurement of the page
12   paperwidth=127mm, %actual width measurement of the page
13   total={90.54mm, 127mm}, % widht/height of the "text box"/text area on the page
14   top=22.352mm, % top margin
15   bottom=19.177mm, %bottom margin
16   inner=19.177mm, %inner/gutter margin
17   outer=19.177mm, %outer margin
18   }
19  
20 %% Set line spacing
21 % 1.0 = single space
22 % 1.3 = 1.5 space
23 % 1.6 = double space
24 \linespread{1.3}
25  
26 %% Set no additional space between paragraphs
27 \setlength{\parskip}{0pt}
28  
29 %% Use this package to enable tables  
30 \usepackage{longtable,booktabs}
31
32 %% Hide the toprule
33 \renewcommand{\toprule}{}
34
35 %% Hide the bottomrule
36 \renewcommand{\bottomrule}{}
37
38 \setlength{\LTpost}{0pt}
39
40   
41 %% Set language and hyphenation rules
42 \usepackage[english]{babel}
43
44 %% Set encoding
45 \usepackage[utf8]{inputenc}
46
47 %% Enable widow/orphan control
48 %\usepackage[all,defaultlines=2]{nowidow}
49 \widowpenalty=10000
50 \clubpenalty=10000
51
52 %% Prevent overfull lines
53 \setlength{\emergencystretch}{3em}
54 \providecommand{\tightlist}{\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
55
56 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
57 %%%%%% Title Settings
58 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
59 %% Needed for styling chapter title headings
60 \usepackage{titlesec}
61
62 % Turn off subsection numbering for titles
63 \renewcommand{\thesection}{}
64
65 %% Style the chapter title that appears on the first page of each chapter
66 \titlespacing*{\chapter}
67 {0pt}%left margin
68 {150pt}%top margin
69 {25pt}%bottom margin
70
71 % This tells it to style the titleformat for chapters
72 \titleformat{\chapter}[display]{\bfseries\titlefont}{\Large Chapter \thechapter \normalfont}{0.5mm}{\small}
73
74 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
75 %%%%% Headers & Footers
76 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
77 %% Needed for headers and footers
78 \usepackage{fancyhdr}
79
80 %% Prevent headers from appearing on empty pages
81 \usepackage{emptypage}
82
83 %% Remove header/footer from the first page of every chapter
84 \fancypagestyle{plain}{ 
85 \fancyhf{} %remove/clear header/footer content
86 \renewcommand{\headrulewidth}{0.0pt} %remove black line/"rule" from header
87 }
88
89 %% Set the header height in: in, mm, cm, pt
90 \setlength{\headheight}{.35in}
91
92 %% Set the space between header and text
93 \setlength{\headsep}{.25in}
94
95 %% Set the header height in: in, mm, cm, pt
96 %\headheight=in
97
98 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
99 %%%%%% Images
100 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
101 %% Needed for images; used for cover
102 \usepackage{incgraph,tikz}
103
104 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
105 %%%%%% Fonts
106 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
107 %% Use TrueType system fonts
108 \usepackage{fontspec}
109
110 %% Set Main Fonts
111 \setmainfont[
112   Ligatures=TeX,
113   ItalicFont={Linux Libertine O:style=Italic},
114 ]{Linux Libertine O}
115
116 %\setmainfont[
117 %  Ligatures=TeX,
118 %  BoldFont={Aboriginal Serif Bold},
119 %  ItalicFont={Aboriginal Serif Italic},
120 %  BoldItalicFont={Aboriginal Serif Bold Italic},
121 %  SmallCapsFont={TeX Gyre Termes},
122 %  SmallCapsFeatures={Letters=SmallCaps},
123 %]{Minion Pro}
124
125
126 %% Make our quotes curly
127 \defaultfontfeatures{Mapping=tex-text}
128
129 %% Provides Creative Commons Icons
130 \usepackage{ccicons}
131 \usepackage{tgadventor}
132 \usepackage[T1]{fontenc}
133 \newfontfamily\sansfont{TeX Gyre Adventor}
134
135
136 %% Set Minion Pro macro \primaryfont
137 % This command uses locally installed OTF/TTF Fonts
138 %\newcommand*{\primaryfont}{\fontspec{Minion Pro}\selectfont}
139 %\newcommand*{\primaryfontHead}{\fontspec{MinionPro-BoldIt}\selectfont}
140
141 % These commands use free TeX fonts from CTAN that are nearly identical
142 %\usepackage{gentium}
143 %\usepackage[T1]{fontenc}
144 %\newfontfamily\primaryfont{Gentium Book Basic}
145
146 \usepackage{libertine}
147 \usepackage[T1]{fontenc}
148 \newfontfamily\primaryfont[Ligatures=TeX, Numbers=OldStyle]{Linux Libertine O}
149 \newfontfamily\titlefont[Scale=1.75, Ligatures=TeX]{Linux Libertine O}
150
151 %\setmainfont
152 %\setsansfont
153 %\setmonofont
154
155 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
156 %%%% Metadata Settings
157 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
158
159 %% Set Title from Yaml Metadata
160 \title{$title$}
161
162 %% Set subtitle if it exists in Yaml Metadata
163 $if(subtitle)$
164 \newcommand{\subtitle}{$subtitle$}
165 $endif$
166
167 %% Set author from Yaml Metadata
168 \author{$for(author)$$author$$endfor$}
169
170 %% Set editor from Yaml Metadata
171 \def\editor{$for(contributors)$$contributors.editor$$endfor$}
172
173 %% Set cover artist from Yaml Metadata
174 \def\artist{$for(contributors)$$contributors.artist$$endfor$}
175
176 %% Set designer from Yaml Metadata
177 \def\designer{$for(contributors)$$contributors.designer$$endfor$}
178
179 %% Set publisher from Yaml Metadata
180 \def\publisher{$for(publisher)$$publisher$$endfor$}
181
182 %% Set website from Yaml Metadata
183 \def\website{$for(website)$$website$$endfor$}
184
185 %% Use the year instead of the full date
186 \date{$year$}
187
188 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
189 %%%% Start the document
190 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
191 \begin{document}
192
193 %% Start with the frontmatter
194 % These pages don't count for document page numbering
195 \frontmatter
196
197 % TeX 'magic' required so we can use macros/variables with @
198 \makeatletter
199
200 %%%%%%%%%%%%%%%%%%%%%%%%%%%
201 %%%% Create a cover page
202 %%%%%%%%%%%%%%%%%%%%%%%%%%%
203 % No headers or footers
204 \pagestyle{empty}
205
206 % The image
207 \incgraph[documentpaper]
208 [height=\paperheight]{$cover-image$} % Fit to height
209
210 %% Stretch image to fit page
211 %  [width=\paperwidth,height=\paperheight]{$cover-image$}
212
213 % End the page
214 \clearpage
215 %%%%%%%%%%%%%%%%%%%%%%
216 %% Create a titlepage
217 %%%%%%%%%%%%%%%%%%%%%%
218 % No headers/footers
219 \pagestyle{empty}
220 % Center everything
221   \begin{center}
222
223 % Add a vertical space
224   \vspace*{3cm}
225   
226 % Write the Book Title
227   \makeatletter \Huge \bfseries \titlefont \textbf{\textsc{\@title}} \par \makeatother    
228
229 % Add a vertical space
230   \vspace{1cm}
231     
232 % Write the subtitle
233 $if(subtitle)$
234   \Large \primaryfont $subtitle$ \par
235 $endif$
236     
237 % Add a vertical space
238   \vspace{3cm}
239     
240 % Write the author name
241   \Large \normalfont \sansfont  \makeatletter \MakeUppercase\@author \makeatother \par
242
243 % Stop centering everythign
244   \end{center}
245
246 % End the page
247 \clearpage
248
249
250 %%%%%%%%%%%%%%%%%%%%%%%%%%%
251 %% Create a copyright page
252 %%%%%%%%%%%%%%%%%%%%%%%%%%%
253 % No headers/footers
254 \pagestyle{empty}
255
256 % Center everything
257   \begin{center} 
258
259 % Use Sans font
260   \sansfont
261   
262 % Write the Book Titlecopyright page
263   \makeatletter  \scriptsize \@title \par \makeatother
264     
265 % Write the CC logo, year, and author
266     \scriptsize Copyright \ccLogo\ \makeatletter \@date \ \@author \makeatother \par
267     \scriptsize Some rights reserved. \par
268     
269 % Add a vertical space
270     \vspace{0.3cm}
271
272 % Write what country it was published in
273     \scriptsize Published in the United States by \par
274     
275 % Write the publisher name
276     \scriptsize \publisher \par
277     
278 % Write the website
279     \scriptsize \website \par
280     
281 % Add a vertical space
282     \vspace{0.3cm}
283
284 % Write the specific license name
285     \scriptsize This book is distributed under a Creative Commons attribution-NonCommercial-Sharealike 4.0 License. \par
286
287 % Add a vertical space
288     \vspace{0.3cm}
289
290 % Write the Creative Commons Icons
291     \ccbyncsa
292     
293 % Stop centering everythign
294   \end{center}
295        
296 % Write license text
297    \scriptsize
298    \noindent \sansfont \linespread{1.0}
299     That means you are free:
300       \begin{itemize}
301         \setlength{\itemsep}{0pt}
302         \setlength{\parskip}{0pt}
303         \setlength{\parsep}{0pt} 
304           \item \textbf{To Share} -- copy and redistribute the material in any medium or format.
305          \item \textbf{To Adapt} -- remix, transform, and build upon the material.
306       \end{itemize}
307     The licensor cannot revoke these freedoms as long as you follow the license terms: \par
308       \begin{itemize}
309         \setlength{\itemsep}{0pt}
310         \setlength{\parskip}{0pt}
311         \setlength{\parsep}{0pt}
312           \item \textbf{Attribution} -- You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. \par
313           \item \textbf{NonCommercial} -- You may not use the material for commercial purposes. \par
314           \item \textbf{Share Alike} -- If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original. \par
315       \end{itemize}
316     \textbf No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
317     
318 % Add a vertical space
319     \vspace{.3cm}
320     
321 % Start centering again
322     \begin{center}
323
324 % Attribute the cover artist
325       $for(contributors)$$if(contributors.artist)$ Cover Artist: \artist \par$endif$$endfor$
326       
327 % Attribute the editor
328       $for(contributors)$$if(contributors.editor)$ Editor: \editor \par$endif$$endfor$
329       
330 % Attribute the designer (hey, that's me)
331       $for(contributors)$$if(contributors.designer)$ Design: \designer \par$endif$$endfor$
332    
333 % Add a vertical space
334       \vspace{0.3cm}
335       
336 % If ISBNs are defined in Yaml front matter then write them here
337       $if(paperback-isbn)$Paperback ISBN: {$paperback-isbn$} \par $endif$
338       $if(hardcover-isbn)$HardcoverISBN: {$hardcover-isbn$}\par $endif$
339       $if(epub-isbn)$ePub ISBN: {$epub-isbn$} \par $endif$
340       
341 % Stop centering
342     \end{center}
343     
344 % End the page
345 \clearpage \normalsize
346
347 %%%%%%%%%%%%%%%%%%%%%%%%%%%
348 %% Create the chapters
349 %%%%%%%%%%%%%%%%%%%%%%%%%%%
350 % This styles the header/footer for normal 'chapter' pages
351 \pagestyle{fancy}
352 \renewcommand{\chaptermark}[1]{\markboth {\@chapapp\ \thechapter \hspace{1mm}-\hspace{1mm}{#1}}{}}
353
354 \fancyfoot[C]{} % remove numbered footers
355 \fancyhead[RO,LE]{\primaryfont\bfseries \thepage} % add page numbers to the header
356 \fancyhead[LO]{\primaryfont\bfseries \textsc \leftmark} % add subtitle to header
357 \fancyhead[RE]{\primaryfont\bfseries \textsc \@title}
358 \renewcommand{\headrulewidth}{0.0pt} 
359
360 % This says to start the page numbering
361 \mainmatter
362
363 % Write the body/chapters
364 \primaryfont $body$
365
366 %%%%%%%%%%%%%%%%%%%%%%%%%%%
367 %%%%%%%%%%%%%%%%%%%%%%%%%%%
368 %% Create the bio page
369 %%%%%%%%%%%%%%%%%%%%%%%%%%%
370 %%%%%%%%%%%%%%%%%%%%%%%%%%%
371 % add blank even page before backmatter starts
372 \newcommand*\cleartoleftpage{%
373   \clearpage
374   \ifodd\value{page}\hbox{}\thispagestyle{empty}\newpage\fi
375 }
376
377 \cleartoleftpage
378
379 % Label as backmatter
380 \backmatter
381
382 % No headers/footers
383 \pagestyle{empty}
384
385 % Add space before/after the page title
386 \titlespacing*{\section}
387 {0pt}%left
388 {150pt}%top
389 {25pt}%bottom
390
391 % This designs the page title
392 \titleformat{\section}[display]{\bfseries\titlefont}{}{0.5mm}{\centering \Large} % Don't say 'chapter X'
393
394 % Don't indent new paragraphs
395 \setlength{\parindent}{0mm}
396
397 % Add space between paragraphs
398 \parskip = \baselineskip
399
400 % Include the file(s) we specified via the pandoc command, in this case our bio.md
401 $include-after$
402 % End the document
403 \end{document}