1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %%%%%%%%%%%%%%%%%%% BASE DOCUMENT SETTINGS
4 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8 [crop=true,varwidth,border=0.50001bp,11pt]
9 {book} % Set document Class
11 %% Set page size and margins
14 paperheight=228.6mm, %actual height measurement of the page
15 paperwidth=152.4mm, %actual width measurement of the page
16 total={108.65mm, 142.53mm}, % widht/height of the "text box"/text area on the page
17 top=30.0mm, % top margin
18 bottom=27.0mm, %bottom margin
19 inner=22.0mm, %inner/gutter margin
20 outer=19.0mm, %outer margin
29 %% Set lineheight / distance between lines
30 %\setlength{\baselineskip}{16pt}
32 %% Set no additional space between paragraphs
33 \setlength{\parskip}{0pt}
35 %% Use this package to enable tables
36 \usepackage{longtable,booktabs}
39 \renewcommand{\toprule}{}
41 %% Hide the bottomrule
42 \renewcommand{\bottomrule}{}
44 \setlength{\LTpost}{0pt}
46 %% Set language and hyphenation rules
47 \usepackage[english]{babel}
50 %\usepackage[utf8]{inputenc}
52 %% Enable widow/orphan control
53 %\usepackage[all,defaultlines=3]{nowidow}
57 %% Prevent lines from spilling over
58 \setlength{\emergencystretch}{3em}
59 \providecommand{\tightlist}{\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
61 %%%%%%%%% PDF-X stuff, IF USING xelatex %%%%%%%%%
62 % Thanks to LSinev for most of this PDF X-1a stuff;
63 % https://gist.github.com/LSinev/74ea05423c9208d6677d
65 %(mm size * 72)/25.4 = bp size
67 \AtBeginShipout{% %A hook that is executed for every page (after first one)
68 \special{pdf: put @thispage
70 /TrimBox [0 0 360 576] %put here other numbers = size of page in bp
74 \special{pdf: put @thispage
76 /TrimBox [0 0 360 576] %put here other numbers = size of page in bp
81 /GTS_PDFXVersion (PDF/X-1:2001)
82 /GTS_PDFXConformance (PDF/X-1a:2001)
86 \special{pdf:put @catalog
94 /OutputConditionIdentifier (Custom)
95 /RegistryName (http://www.color.org/)
101 \usepackage{datetime} % for \pdfdate command
103 %% URL / Hyperlink style
104 \usepackage[bookmarks=true]{hyperref}
108 \hypersetup{pdfstartpage={}}
110 \hypersetup{unicode=true,
112 pdftitle={$title-meta$}, %set pdftitle metadata from Yaml front matter
114 pdfinfo={% Setting some more PDF/X stuff for xelatex
115 ModDate={D:\pdfdate},% PDF/X document should have a modification date
116 Trapped={False},% PDF/X document should have Trapped tag set
119 pdfauthor={$author-meta$}, %set pdfauthor metadata from Yaml front matter
122 pdfkeywords={$for(keywords)$$keywords$$sep$; $endfor$}, %set pdfkeywords metadata from Yaml front matter
126 linkcolor=$if(linkcolor)$$linkcolor$$else$Maroon$endif$,
127 citecolor=$if(citecolor)$$citecolor$$else$Blue$endif$,
128 urlcolor=$if(urlcolor)$$urlcolor$$else$Blue$endif$,
130 pdfborder={0 0 0}, %turn off the url border that normally gets added to urls in pdfs
134 \urlstyle{same} % don't use monospace font for urls
136 %% Export PDF as PDF/X-1a for best Createspace results
137 %\usepackage[X-1a]{pdfx}
140 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
141 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
142 %%%%%%%%%%%%%%%%%%% TITLE SETTINGS
143 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
144 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
145 %% Needed for styling chapter title headings
146 \usepackage{titlesec}
148 % Turn off subsection numbering for titles
149 \renewcommand{\thesection}{}
151 %% Style the chapter title that appears on the first page of each chapter
152 \titlespacing*{\chapter}
157 % This tells it to style the titleformat for chapters
158 % \titleformat{\chapter}[display]{\bfseries\titlefont}{\Large Chapter \thechapter \normalfont}{0.5mm}{\small}
161 %% This part says to style the titles for "chapters"
162 % \titleformat{\chapter}[display]
167 %% This styles the "Chapter 1" part
168 %{\Large Chapter \thechapter \normalfont}
170 %% This is the spacing between the "Chapter 1" and the actual chapter title
173 %% This is the size of the chapter title
176 % Add spacing for the chapter title that appears on the first page of each chapter
179 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
180 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
181 %%%%%%%%%%%%%%%%%%% HEADERS AND FOOTERS
182 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
183 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
184 %% Needed for headers and footers
185 \usepackage{fancyhdr}
187 %% Prevent headers from appearing on empty pages
188 \usepackage{emptypage}
190 %% Remove header/footer from the first page of every chapter
191 \fancypagestyle{plain}{
192 \fancyhf{} %remove/clear header/footer content
193 \renewcommand{\headrulewidth}{0.0pt} %remove black line/"rule" from header
196 %% Set the header height in: in, mm, cm, pt
197 \setlength{\headheight}{0.10in}
199 %% Set the space between header and text
200 \setlength{\headsep}{.25in}
202 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
203 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
204 %%%%%%%%%%%%%%%%%%% FONTS
205 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
206 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
207 %% Use TrueType system fonts
208 \usepackage{fontspec}
210 %% Used to set some things to all caps
211 \usepackage{textcase}
216 %ItalicFont={Linux Libertine O:style=Italic},
217 %BoldFont={Linux Libertine O:style=Bold},
218 %BoldItalicFont={Linux Libertine O:style=Bold Italic},
219 %]{Linux Libertine O}
222 ItalicFont={Linux Biolinum O:style=Italic},
223 BoldFont={Linux Biolinum O:style=Bold},
224 BoldItalicFont={Linux Biolinum O:style=Bold Italic},
229 % BoldFont={Aboriginal Serif Bold},
230 % ItalicFont={Aboriginal Serif Italic},
231 % BoldItalicFont={Aboriginal Serif Bold Italic},
232 % SmallCapsFont={TeX Gyre Termes},
233 % SmallCapsFeatures={Letters=SmallCaps},
236 %% Make our quotes curly
237 \defaultfontfeatures{Mapping=tex-text}
239 %% Provides Creative Commons Icons
242 %% Set Adobe Garamond Pro Bold macro \garmondL
243 %\newcommand*{\garamondL}{\fontspec[Scale=2.0]{Adobe Garamond Pro Bold}\selectfont}
244 %\newcommand*{\garamond}{\fontspec{Adobe Garamond Pro}\selectfont}
246 %% Set URW Gothic macro \goth
247 % This command uses locally installed OTF/TTF Fonts
248 %\newcommand*{\goth}{\fontspec{URW Gothic L}\selectfont}
250 % These commands use free TeX fonts from CTAN that are nearly identical
251 \usepackage{tgadventor}
252 \usepackage[T1]{fontenc}
253 \newfontfamily\sansfont{TeX Gyre Adventor}
256 %% Set Minion Pro macro \minion
257 % This command uses locally installed OTF/TTF Fonts
258 %\newcommand*{\minion}{\fontspec{Minion Pro}\selectfont}
259 %\newcommand*{\minionHead}{\fontspec{MinionPro-BoldIt}\selectfont}
261 % These commands use free TeX fonts from CTAN that are nearly identical
262 %\usepackage{gentium}
263 %\usepackage[T1]{fontenc}
264 %\newfontfamily\minion{Gentium Book Basic}
266 \usepackage{libertine}
267 \usepackage[T1]{fontenc}
268 % \newfontfamily\primaryfont[Ligatures=TeX, Numbers=OldStyle]{Linux Libertine O}
269 %\newfontfamily\titlefont[Scale=1.75, Ligatures=TeX]{Linux Libertine O}
270 \newfontfamily\setmainfont[Ligatures=TeX, Numbers=OldStyle]{Linux Biolinum O}
271 \newfontfamily\primaryfont[Ligatures=TeX, Numbers=OldStyle]{Linux Biolinum O}
272 \newfontfamily\idtitlefont[Ligatures=TeX, Numbers=OldStyle]{Linux Biolinum O}
273 \newfontfamily\headerfont[Ligatures=TeX, Numbers=OldStyle]{Linux Biolinum O}
274 \newfontfamily\normalfont[Ligatures=TeX, Numbers=OldStyle]{Linux Biolinum O}
275 \newfontfamily\titlefont[Scale=1.75, Ligatures=TeX]{Linux Biolinum O}
277 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
279 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
280 %% Needed for images; used for cover
281 % \usepackage{incgraph,tikz}
282 \usepackage{pdfpages}
285 %\renewcommand{\sfdefault}{URW Gothic}
288 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
289 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
290 %%%%%%%%%%%%%%%%%%% METADATA and MACROS
291 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
292 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
294 %% Set Title from Yaml Metadata
297 %% Set subtitle if it exists in Yaml Metadata
299 \newcommand{\subtitle}{$subtitle$}
302 %% Set author from Yaml Metadata
303 \author{$for(author)$$author$$endfor$}
305 %% Set editor from Yaml Metadata
306 \def\editor{$for(contributors)$$contributors.editor$$endfor$}
308 %% Set cover artist from Yaml Metadata
309 \def\artist{$for(contributors)$$contributors.artist$$endfor$}
311 %% Set designer from Yaml Metadata
312 \def\designer{$for(contributors)$$contributors.designer$$endfor$}
314 %% Set publisher from Yaml Metadata
315 \def\publisher{$for(publisher)$$publisher$$endfor$}
317 %% Set website from Yaml Metadata
318 \def\website{$for(website)$$website$$endfor$}
320 %% Use the year instead of the full date
323 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
324 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
325 %%%%%%%%%%%%%%%%%%% START THE DOCUMENT
326 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
327 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
330 %% Start with the frontmatter
331 % These pages don't count for document page numbering
334 %%%%%%%%%%%%%%%%%%%%%%%%%%%
335 %%%% Create a cover page
336 %%%%%%%%%%%%%%%%%%%%%%%%%%%
337 % No headers or footers
341 \includepdf{$cover-image$}
342 % \incgraph[documentpaper]
343 % [height=\paperheight]{$cover-image$} % Fit to height
345 %% Stretch image to fit page
346 % [width=\paperwidth,height=\paperheight]{$cover-image$}
351 %%%%%%%%%%%%%%%%%%%%%%%%%%%
352 %%%%%%%%%%%%%%%%%%%%%%%%%%%
353 %% Create a titlepage
354 %%%%%%%%%%%%%%%%%%%%%%%%%%%
355 %%%%%%%%%%%%%%%%%%%%%%%%%%%
361 % Add a vertical space
364 % Write the Book Title
365 \makeatletter \Huge \bfseries \titlefont \textbf{\textsc{\@title}} \par \makeatother
367 % Add a vertical space
372 \Large \primaryfont $subtitle$ \par
375 % Add a vertical space
378 % Write the author name
379 \Large \normalfont \sansfont \makeatletter \MakeUppercase\@author \makeatother \par
381 % Stop centering everythign
387 %%%%%%%%%%%%%%%%%%%%%%%%%%%
388 %%%%%%%%%%%%%%%%%%%%%%%%%%%
389 %% Create a copyright page
390 %%%%%%%%%%%%%%%%%%%%%%%%%%%
391 %%%%%%%%%%%%%%%%%%%%%%%%%%%
401 % Write the Book Titlecopyright page
402 \makeatletter \small \@title \par \makeatother
404 % Write the CC logo, year, and author
405 Copyright \ccLogo\ \makeatletter \@date \ \@author \makeatother \par
406 Some rights reserved. \par
408 % Add a vertical space
411 % Write what country it was published in
412 Published in the United States by \par
414 % Write the publisher name
420 % Add a vertical space
423 % Write the specific license name
424 This book is distributed under a Creative Commons Attribution-Sharealike 4.0 License. \par
426 % Add a vertical space
429 % Write the Creative Commons Icons
432 % Stop centering everythign
438 That means you are free:
440 \setlength{\itemsep}{0pt}
441 \setlength{\parskip}{0pt}
442 \setlength{\parsep}{0pt}
443 \item \textbf{To Share} -- copy and redistribute the material in any medium or format.
444 \item \textbf{To Adapt} -- remix, transform, and build upon the material.
446 The licensor cannot revoke these freedoms as long as you follow the license terms: \par
448 \setlength{\itemsep}{0pt}
449 \setlength{\parskip}{0pt}
450 \setlength{\parsep}{0pt}
451 \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
452 % \item \textbf{NonCommercial} -- You may not use the material for commercial purposes. \par
453 \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
455 \textbf No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
457 % Add a vertical space
460 % Start centering again
463 % Attribute the cover artist
464 $for(contributors)$$if(contributors.artist)$ Cover Artist: \artist \par$endif$$endfor$
466 % Attribute the editor
467 $for(contributors)$$if(contributors.editor)$ Editor: \editor \par$endif$$endfor$
469 % Attribute the designer (hey, that's me)
470 $for(contributors)$$if(contributors.designer)$ Design: \designer \par$endif$$endfor$
472 % Add a vertical space
475 % If ISBNs are defined in Yaml front matter then write them here
476 $if(paperback-isbn)$Paperback ISBN: {$paperback-isbn$} \par $endif$
477 $if(hardcover-isbn)$HardcoverISBN: {$hardcover-isbn$}\par $endif$
478 $if(epub-isbn)$ePub ISBN: {$epub-isbn$} \par $endif$
486 %%%%%%%%%%%%%%%%%%%%%%%%%%%
487 %%%%%%%%%%%%%%%%%%%%%%%%%%%
488 %% Create a dedication page
489 %%%%%%%%%%%%%%%%%%%%%%%%%%%
490 %%%%%%%%%%%%%%%%%%%%%%%%%%%
501 % Write the Book Title
502 \normalfont\normalsize $dedication$ \par
511 %%%%%%%%%%%%%%%%%%%%%%%%%%%
512 %%%%%%%%%%%%%%%%%%%%%%%%%%%
513 %% Create the chapters
514 %%%%%%%%%%%%%%%%%%%%%%%%%%%
515 %%%%%%%%%%%%%%%%%%%%%%%%%%%
516 % This styles the header/footer for normal 'chapter' pages
519 %\renewcommand{\chaptermark}[1]{\markboth{#1}{}} % This removes the 'Chapter x' from the header
520 \renewcommand{\chaptermark}[1]{\markboth {\@chapapp\ \thechapter \hspace{1mm}-\hspace{1mm}{#1}}{}}
522 \fancyfoot[C]{} % remove numbered footers
523 \fancyhead[RO,LE]{\primaryfont\bfseries \thepage} % add page numbers to the header
524 \fancyhead[LO]{\primaryfont\bfseries \textsc \leftmark} % add subtitle to header
525 \fancyhead[RE]{\primaryfont\bfseries \textsc \@title}
526 \renewcommand{\headrulewidth}{0.0pt}
529 % This says to start the page numbering
532 % Write the body/chapters
533 \primaryfont \normalsize \flushbottom $body$
535 %%%%%%%%%%%%%%%%%%%%%%%%%%%
536 %%%%%%%%%%%%%%%%%%%%%%%%%%%
537 %% Create the bio page
538 %%%%%%%%%%%%%%%%%%%%%%%%%%%
539 %%%%%%%%%%%%%%%%%%%%%%%%%%%
540 % add blank even page before backmatter starts
541 \newcommand*\cleartoleftpage{%
543 \ifodd\value{page}\hbox{}\thispagestyle{empty}\newpage\fi
548 % Label as backmatter
554 % Add space before/after the page title
555 \titlespacing*{\section}
560 % This designs the page title
561 \titleformat{\section}[display]{\bfseries\titlefont}{}{0.5mm}{\centering \Large} % Don't say 'chapter X'
563 % Don't indent new paragraphs
564 \setlength{\parindent}{0mm}
566 % Add space between paragraphs
567 \parskip = \baselineskip
569 % Include the file(s) we specified via the pandoc command, in this case our bio.md