From: Craig Maloney Date: Mon, 10 Feb 2020 01:00:43 +0000 (-0500) Subject: Attempting to make a 6x9 format X-Git-Tag: 20200509.01^2~3 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=52f58c9288ca127e1d434db84d321b71eb0d30a9;p=themediocreprogrammer.git Attempting to make a 6x9 format --- diff --git a/Makefile b/Makefile index 60304fb..03ff7b4 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,8 @@ BUILD = build BOOKNAME = the_mediocre_programmer TITLE = title.txt -METADATA = metadata.xml +METADATA_XML = metadata.xml +METADATA_YAML = metadata.yaml CHAPTERS = intro.md chapter01.md chapter02.md chapter03.md chapter04.md chapter05.md chapter06.md chapter07.md epilogue.md gratitude.md appendixa.md TOC = --toc --toc-depth=2 COVER_IMAGE = images/cover_ebook_1600x2400.png @@ -20,16 +21,17 @@ html: $(BUILD)/html/$(BOOKNAME).html pdf: $(BUILD)/pdf/$(BOOKNAME).pdf -$(BUILD)/epub/$(BOOKNAME).epub: $(TITLE) $(CHAPTERS) +$(BUILD)/epub/$(BOOKNAME).epub: $(TITLE) $(CHAPTERS) $(METADATA_YAML) mkdir -p $(BUILD)/epub - pandoc $(TOC) --chapters --number-offset=0 -S --epub-metadata=$(METADATA) --epub-cover-image=$(COVER_IMAGE) -o $@ $^ + pandoc -s $(TOC) --chapters --number-offset=0 -S --epub-metadata=$(METADATA_XML) --epub-cover-image=$(COVER_IMAGE) -o $@ $^ -$(BUILD)/html/$(BOOKNAME).html: $(CHAPTERS) +$(BUILD)/html/$(BOOKNAME).html: $(CHAPTERS) $(METADATA_YAML) mkdir -p $(BUILD)/html - pandoc $(TOC) --chapters --number-offset=0 --standalone --to=html5 -o $@ $^ + pandoc -s $(TOC) --chapters --number-offset=0 --standalone --to=html5 -o $@ $^ -$(BUILD)/pdf/$(BOOKNAME).pdf: $(TITLE) $(CHAPTERS) +$(BUILD)/pdf/$(BOOKNAME).pdf: $(CHAPTERS) $(METADATA_YAML) mkdir -p $(BUILD)/pdf - pandoc $(TOC) --chapters --number-offset=0 --latex-engine=pdflatex -V documentclass=$(LATEX_CLASS) -o $@ $^ + # pandoc $(TOC) --chapters --number-offset=0 --latex-engine=pdflatex -V documentclass=$(LATEX_CLASS) -V papersize=6x9 -o $@ $^ + pandoc -s $(TOC) --chapters --number-offset=0 --template=Pandoc/templates/cs-6x9-pdf.latex --latex-engine=xelatex -o $@ $^ .PHONY: all book clean epub html pdf diff --git a/Pandoc/css/style.css b/Pandoc/css/style.css new file mode 100644 index 0000000..93d39d7 --- /dev/null +++ b/Pandoc/css/style.css @@ -0,0 +1,42 @@ +/************** Styling Notes + * Nook has issues with Margin settings, so we default to padding instead since it works as expected across all devices. + * Nook has issues with 'shorthand' margin/padding rules (T R B L) so we use the full version (margin-top, etc) instead. + * Other notes will be added as needed + */ + +/* Set our 'sane' defaults */ +html, body, div, h1, h2, h3, h4, h5, h6, ul, ol, dl, li, dt, dd, p, pre, table, th, td, tr { margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; padding-top: 0; padding-right: 0; padding-bottom: 0; padding-left: 0; } + +/* Make sure all paragraphs are 'justified' */ +p { text-align: justify; } + +/* Don't indent the first paragraph of a chapter */ +p+p { text-indent: 1.5em; } + +/* Center but don't indent */ +p+p.center { text-indent: 0; text-align: center; } + +/* center */ +.center { text-indent: 0; text-align: center; } + +/* Center all of our headings */ +h1, h2, h3, h4, h6 { text-align: center; } + +h5 { text-align: center; font-weight: normal; font-size: medium; } + +/* Indent our lists */ +li { text-align: left; padding-left: 4em; } + +/* Add a top margin for good spacing */ +.top-margin { padding-top: 3em; } + +/* Remove the numbers from the Pandoc generated ToC */ +ol.toc { list-style-type:none; } + +/* Style our Horizontal Rules */ +hr { border: 0; height: 1px; background-image: linear-gradient(to right, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0)); } + +/* Style our 'tables' + * this is a dirty hack since we're writing fiction and probably not using tables + * but I'm using Pandoc's table markdown syntax to center certain text, like songs */ +table {margin-left: auto; margin-right: auto; margin-top: 10px;} diff --git a/Pandoc/templates/amazon-epub.html b/Pandoc/templates/amazon-epub.html new file mode 100644 index 0000000..a79a0f1 --- /dev/null +++ b/Pandoc/templates/amazon-epub.html @@ -0,0 +1,99 @@ + + + + + + + + $pagetitle$ + + + + + $if(titlepage)$ + $for(title)$ + $if(title.text)$ +

$title.text$

+ $else$ +

$title$

+ $endif$ + $endfor$ + + $if(subtitle)$ +

$subtitle$

+ $endif$ + + $for(year)$ +

© $year$

+ $endfor$ + + $for(author)$ +

$author$

+ $endfor$ + + $for(creator)$ +

$creator.text$

+ $endfor$ + + $if(publisher)$ +

$publisher$

+ $endif$ + + $for(book1)$ + $if(book1.title)$ +

Also Available

+ $endif$ + $endfor$ + + $for(book1)$$if(book1.link)$ +

$book1.title$

+ $else$ +

$book1.title$

+ $endif$ + $endfor$ + $for(book2)$$if(book2.link)$ +

$book2.title$

+ $else$ +

$book2.title$

+ $endif$ + $endfor$ + $for(book3)$$if(book3.link)$ +

$book3.title$

+ $else$ +

$book3.title$

+ $endif$ + $endfor$ + $for(book4)$$if(book4.link)$ +

$book4.title$

+ $else$ +

$book4.title$

+ $endif$ + $endfor$ + $for(book5)$$if(book5.link)$ +

$book5.title$

+ $else$ +

$book5.title$

+ $endif$ + $endfor$ + + $if(contributors)$ +
+ $for(contributors)$ + $if(contributors.designer)$ +
Book Design: $contributors.designer$
+ $endif$ + $if(contributors.artist)$ +
Cover Artist: $contributors.artist$
+ $endif$ + $if(contributors.editor)$ +
Editor: $contributors.editor$
+ $endif$ + $endfor$ +
+ $endif$ + + $endif$ + + $body$ + + diff --git a/Pandoc/templates/cs-5x8-pdf.latex b/Pandoc/templates/cs-5x8-pdf.latex new file mode 100644 index 0000000..db66d2e --- /dev/null +++ b/Pandoc/templates/cs-5x8-pdf.latex @@ -0,0 +1,532 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%% BASE DOCUMENT SETTINGS +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Set document class +\documentclass% +[crop=true,varwidth,border=0.50001bp,11pt] +{book} % Set document Class + +%% Set page size and margins +\usepackage{geometry} + \geometry{ + paperheight=203.2mm, %actual height measurement of the page + paperwidth=127mm, %actual width measurement of the page + total={90.54mm, 127mm}, % widht/height of the "text box"/text area on the page + top=19.177mm, % top margin + bottom=19.177mm, %bottom margin + inner=22.352mm, %inner/gutter margin + outer=17.907mm, %outer margin + } + +%% Set lineheight / distance between lines +\setlength{\baselineskip}{16pt} + +%% Set no additional space between paragraphs +\setlength{\parskip}{0pt} + +%% Use this package to enable tables +\usepackage{longtable,booktabs} + +%% Hide the toprule +\renewcommand{\toprule}{} + +%% Hide the bottomrule +\renewcommand{\bottomrule}{} + +\setlength{\LTpost}{0pt} + +%% Set language and hyphenation rules +\usepackage[english]{babel} + +%% Set encoding +%\usepackage[utf8]{inputenc} + +%% Enable widow/orphan control +%\usepackage[all,defaultlines=3]{nowidow} +\widowpenalty=10000 +%\clubpenalty=10000 + + +%% Prevent lines from spilling over +\setlength{\emergencystretch}{3em} +\providecommand{\tightlist}{\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} + +%%%%%%%%% PDF-X stuff, IF USING xelatex %%%%%%%%% +% Thanks to LSinev for most of this PDF X-1a stuff; +% https://gist.github.com/LSinev/74ea05423c9208d6677d + +%(mm size * 72)/25.4 = bp size +\usepackage{atbegshi} +\AtBeginShipout{% %A hook that is executed for every page (after first one) + \special{pdf: put @thispage + << + /TrimBox [0 0 360 576] %put here other numbers = size of page in bp + >> + } +} +\special{pdf: put @thispage + << + /TrimBox [0 0 360 576] %put here other numbers = size of page in bp + >> +} +\special{pdf:docinfo + << + /GTS_PDFXVersion (PDF/X-1:2001) + /GTS_PDFXConformance (PDF/X-1a:2001) + >> +} + +\special{pdf:put @catalog +<< + /PageMode /UseNone + /OutputIntents [ + << + /Info (none) + /Type /OutputIntent + /S /GTS_PDFX + /OutputConditionIdentifier (Custom) + /RegistryName (http://www.color.org/) + >> + ] +>> +}% + +\usepackage{datetime} % for \pdfdate command + +%% URL / Hyperlink style +\usepackage[bookmarks=false]{hyperref} +\NoHyper + + +\hypersetup{pdfstartpage={}} + +\hypersetup{unicode=true, +$if(title-meta)$ + pdftitle={$title-meta$}, %set pdftitle metadata from Yaml front matter +$endif$ + pdfinfo={% Setting some more PDF/X stuff for xelatex + ModDate={D:\pdfdate},% PDF/X document should have a modification date + Trapped={False},% PDF/X document should have Trapped tag set + }, +$if(author-meta)$ + pdfauthor={$author-meta$}, %set pdfauthor metadata from Yaml front matter +$endif$ +$if(keywords)$ + pdfkeywords={$for(keywords)$$keywords$$sep$; $endfor$}, %set pdfkeywords metadata from Yaml front matter +$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}, %turn off the url border that normally gets added to urls in pdfs +$endif$ + breaklinks=true} + +\urlstyle{same} % don't use monospace font for urls + +%% Export PDF as PDF/X-1a for best Createspace results +%\usepackage[X-1a]{pdfx} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%% TITLE SETTINGS +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Needed for styling chapter title headings +\usepackage{titlesec} + +% Turn off subsection numbering for titles +\renewcommand{\thesection}{} + +%% Style the chapter title that appears on the first page of each chapter +\titlespacing*{\chapter} +{0pt}%left margin +{150pt}%top margin +{25pt}%bottom margin + +% This tells it to style the titleformat for chapters +\titleformat{\chapter}[display]{\bfseries\titlefont}{\Large Chapter \thechapter \normalfont}{0.5mm}{\small} + +%%%%%%%%%%%%%%%%%% +%% This part says to style the titles for "chapters" +% \titleformat{\chapter}[display] + +%% Use this font +%{\garamondL} + +%% This styles the "Chapter 1" part +%{\Large Chapter \thechapter \normalfont} + +%% This is the spacing between the "Chapter 1" and the actual chapter title +%{0.5ex} + +%% This is the size of the chapter title +%{\small}% + +% Add spacing for the chapter title that appears on the first page of each chapter +%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%% HEADERS AND FOOTERS +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Needed for headers and footers +\usepackage{fancyhdr} + +%% Prevent headers from appearing on empty pages +\usepackage{emptypage} + +%% Remove header/footer from the first page of every chapter +\fancypagestyle{plain}{ +\fancyhf{} %remove/clear header/footer content +\renewcommand{\headrulewidth}{0.0pt} %remove black line/"rule" from header +} + +%% Set the header height in: in, mm, cm, pt +\setlength{\headheight}{.35in} + +%% Set the space between header and text +\setlength{\headsep}{.25in} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%% FONTS +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Use TrueType system fonts +\usepackage{fontspec} + +%% Used to set some things to all caps +\usepackage{textcase} + +%% Set Main Fonts +\setmainfont[ + Ligatures=TeX, + ItalicFont={Linux Libertine O:style=Italic}, + BoldFont={Linux Libertine O:style=Bold}, + BoldItalicFont={Linux Libertine O:style=Bold Italic}, +]{Linux Libertine O} + +%\setmainfont[ +% Ligatures=TeX, +% BoldFont={Aboriginal Serif Bold}, +% ItalicFont={Aboriginal Serif Italic}, +% BoldItalicFont={Aboriginal Serif Bold Italic}, +% SmallCapsFont={TeX Gyre Termes}, +% SmallCapsFeatures={Letters=SmallCaps}, +%]{Minion Pro} + +%% Make our quotes curly +\defaultfontfeatures{Mapping=tex-text} + +%% Provides Creative Commons Icons +\usepackage{ccicons} + +%% Set Adobe Garamond Pro Bold macro \garmondL +%\newcommand*{\garamondL}{\fontspec[Scale=2.0]{Adobe Garamond Pro Bold}\selectfont} +%\newcommand*{\garamond}{\fontspec{Adobe Garamond Pro}\selectfont} + +%% Set URW Gothic macro \goth +% This command uses locally installed OTF/TTF Fonts +%\newcommand*{\goth}{\fontspec{URW Gothic L}\selectfont} + +% These commands use free TeX fonts from CTAN that are nearly identical +\usepackage{tgadventor} +\usepackage[T1]{fontenc} +\newfontfamily\sansfont{TeX Gyre Adventor} + + +%% Set Minion Pro macro \minion +% This command uses locally installed OTF/TTF Fonts +%\newcommand*{\minion}{\fontspec{Minion Pro}\selectfont} +%\newcommand*{\minionHead}{\fontspec{MinionPro-BoldIt}\selectfont} + +% These commands use free TeX fonts from CTAN that are nearly identical +%\usepackage{gentium} +%\usepackage[T1]{fontenc} +%\newfontfamily\minion{Gentium Book Basic} + +\usepackage{libertine} +\usepackage[T1]{fontenc} +\newfontfamily\primaryfont[Ligatures=TeX, Numbers=OldStyle]{Linux Libertine O} +\newfontfamily\titlefont[Scale=1.75, Ligatures=TeX]{Linux Libertine O} + +%\setmainfont +%\renewcommand{\sfdefault}{URW Gothic} +%\setmonofont + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%% METADATA and MACROS +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%% Set Title from Yaml Metadata +\title{$title$} + +%% Set subtitle if it exists in Yaml Metadata +$if(subtitle)$ +\newcommand{\subtitle}{$subtitle$} +$endif$ + +%% Set author from Yaml Metadata +\author{$for(author)$$author$$endfor$} + +%% Set editor from Yaml Metadata +\def\editor{$for(contributors)$$contributors.editor$$endfor$} + +%% Set cover artist from Yaml Metadata +\def\artist{$for(contributors)$$contributors.artist$$endfor$} + +%% Set designer from Yaml Metadata +\def\designer{$for(contributors)$$contributors.designer$$endfor$} + +%% Set publisher from Yaml Metadata +\def\publisher{$for(publisher)$$publisher$$endfor$} + +%% Set website from Yaml Metadata +\def\website{$for(website)$$website$$endfor$} + +%% Use the year instead of the full date +\date{$year$} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%% START THE DOCUMENT +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{document} + +%% Start with the frontmatter +% These pages don't count for document page numbering +\frontmatter + +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Create a titlepage +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%% +% No headers/footers +\pagestyle{empty} +% Center everything + \begin{center} + +% Add a vertical space + \vspace*{3cm} + +% Write the Book Title + \makeatletter \Huge \bfseries \titlefont \textbf{\textsc{\@title}} \par \makeatother + +% Add a vertical space + \vspace{1cm} + +% Write the subtitle +$if(subtitle)$ + \Large \primaryfont $subtitle$ \par +$endif$ + +% Add a vertical space + \vspace{4cm} + +% Write the author name + \Large \normalfont \sansfont \makeatletter \MakeUppercase\@author \makeatother \par + +% Stop centering everythign + \end{center} + +% End the page +\clearpage + +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Create a copyright page +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%% +% No headers/footers +\pagestyle{empty} + +% Center everything + \begin{center} + +% Use Sans font + \sansfont + +% Write the Book Titlecopyright page + \makeatletter \small \@title \par \makeatother + +% Write the CC logo, year, and author + Copyright \ccLogo\ \makeatletter \@date \ \@author \makeatother \par + Some rights reserved. \par + +% Add a vertical space + \vspace{0.3cm} + +% Write what country it was published in + Published in the United States by \par + +% Write the publisher name + \publisher \par + +% Write the website + \website \par + +% Add a vertical space + \vspace{0.3cm} + +% Write the specific license name + This book is distributed under a Creative Commons attribution-NonCommercial-Sharealike 4.0 License. \par + +% Add a vertical space + \vspace{0.3cm} + +% Write the Creative Commons Icons + \ccbyncsa + +% Stop centering everythign + \end{center} + +% Write license text + \scriptsize + \noindent \sansfont + That means you are free: + \begin{itemize} + \setlength{\itemsep}{0pt} + \setlength{\parskip}{0pt} + \setlength{\parsep}{0pt} + \item \textbf{To Share} -- copy and redistribute the material in any medium or format. + \item \textbf{To Adapt} -- remix, transform, and build upon the material. + \end{itemize} + The licensor cannot revoke these freedoms as long as you follow the license terms: \par + \begin{itemize} + \setlength{\itemsep}{0pt} + \setlength{\parskip}{0pt} + \setlength{\parsep}{0pt} + \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 + \item \textbf{NonCommercial} -- You may not use the material for commercial purposes. \par + \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 + \end{itemize} + \textbf No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. + +% Add a vertical space + \vspace{.3cm} + +% Start centering again + \begin{center} + +% Attribute the cover artist + $for(contributors)$$if(contributors.artist)$ Cover Artist: \artist \par$endif$$endfor$ + +% Attribute the editor + $for(contributors)$$if(contributors.editor)$ Editor: \editor \par$endif$$endfor$ + +% Attribute the designer (hey, that's me) + $for(contributors)$$if(contributors.designer)$ Design: \designer \par$endif$$endfor$ + +% Add a vertical space + \vspace{0.3cm} + +% If ISBNs are defined in Yaml front matter then write them here + $if(paperback-isbn)$Paperback ISBN: {$paperback-isbn$} \par $endif$ + $if(hardcover-isbn)$HardcoverISBN: {$hardcover-isbn$}\par $endif$ + $if(epub-isbn)$ePub ISBN: {$epub-isbn$} \par $endif$ + +% Stop centering + \end{center} + +% End the page +\clearpage + +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Create a dedication page +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%% +% No headers/footers +\pagestyle{empty} + +% Center everything + \begin{center} + +% Vertically center +\topskip0pt +\vspace*{\fill} + +% Write the Book Title + \normalfont\normalsize $dedication$ \par + +% Stop centering +\vspace*{\fill} + \end{center} + +% End the page +\clearpage + +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Create the chapters +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%% +% This styles the header/footer for normal 'chapter' pages +\makeatletter +\pagestyle{fancy} +%\renewcommand{\chaptermark}[1]{\markboth{#1}{}} % This removes the 'Chapter x' from the header +\renewcommand{\chaptermark}[1]{\markboth {\@chapapp\ \thechapter \hspace{1mm}-\hspace{1mm}{#1}}{}} + +\fancyfoot[C]{} % remove numbered footers +\fancyhead[RO,LE]{\primaryfont\bfseries \thepage} % add page numbers to the header +\fancyhead[LO]{\primaryfont\bfseries \textsc \leftmark} % add subtitle to header +\fancyhead[RE]{\primaryfont\bfseries \textsc \@title} +\renewcommand{\headrulewidth}{0.0pt} +\makeatother + +% This says to start the page numbering +\mainmatter + +% Write the body/chapters +\primaryfont \normalsize \flushbottom $body$ + +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Create the bio page +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%% +% add blank even page before backmatter starts +\newcommand*\cleartoleftpage{% + \clearpage + \ifodd\value{page}\hbox{}\thispagestyle{empty}\newpage\fi +} + +\cleartoleftpage + +% Label as backmatter +\backmatter + +% No headers/footers +\pagestyle{empty} + +% Add space before/after the page title +\titlespacing*{\section} +{0pt}%left +{150pt}%top +{25pt}%bottom + +% This designs the page title +\titleformat{\section}[display]{\bfseries\titlefont}{}{0.5mm}{\centering \Large} % Don't say 'chapter X' + +% Don't indent new paragraphs +\setlength{\parindent}{0mm} + +% Add space between paragraphs +\parskip = \baselineskip + +% Include the file(s) we specified via the pandoc command, in this case our bio.md +$include-after$ + +% End the document +\end{document} diff --git a/Pandoc/templates/cs-6x9-pdf.latex b/Pandoc/templates/cs-6x9-pdf.latex new file mode 100644 index 0000000..ce44c5e --- /dev/null +++ b/Pandoc/templates/cs-6x9-pdf.latex @@ -0,0 +1,537 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%% BASE DOCUMENT SETTINGS +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Set document class +\documentclass% +[crop=true,varwidth,border=0.50001bp,11pt] +{book} % Set document Class + +%% Set page size and margins +\usepackage{geometry} + \geometry{ + paperheight=228.6mm, %actual height measurement of the page + paperwidth=152.4mm, %actual width measurement of the page + total={108.65mm, 142.53mm}, % widht/height of the "text box"/text area on the page + top=30.0mm, % top margin + bottom=27.0mm, %bottom margin + inner=22.0mm, %inner/gutter margin + outer=19.0mm, %outer margin + } + +%% Set line spacing +% 1.0 = single space +% 1.3 = 1.5 space +% 1.6 = double space +\linespread{1.3} + +%% Set lineheight / distance between lines +%\setlength{\baselineskip}{16pt} + +%% Set no additional space between paragraphs +\setlength{\parskip}{0pt} + +%% Use this package to enable tables +\usepackage{longtable,booktabs} + +%% Hide the toprule +\renewcommand{\toprule}{} + +%% Hide the bottomrule +\renewcommand{\bottomrule}{} + +\setlength{\LTpost}{0pt} + +%% Set language and hyphenation rules +\usepackage[english]{babel} + +%% Set encoding +%\usepackage[utf8]{inputenc} + +%% Enable widow/orphan control +%\usepackage[all,defaultlines=3]{nowidow} +\widowpenalty=10000 +%\clubpenalty=10000 + +%% Prevent lines from spilling over +\setlength{\emergencystretch}{3em} +\providecommand{\tightlist}{\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} + +%%%%%%%%% PDF-X stuff, IF USING xelatex %%%%%%%%% +% Thanks to LSinev for most of this PDF X-1a stuff; +% https://gist.github.com/LSinev/74ea05423c9208d6677d + +%(mm size * 72)/25.4 = bp size +\usepackage{atbegshi} +\AtBeginShipout{% %A hook that is executed for every page (after first one) + \special{pdf: put @thispage + << + /TrimBox [0 0 360 576] %put here other numbers = size of page in bp + >> + } +} +\special{pdf: put @thispage + << + /TrimBox [0 0 360 576] %put here other numbers = size of page in bp + >> +} +\special{pdf:docinfo + << + /GTS_PDFXVersion (PDF/X-1:2001) + /GTS_PDFXConformance (PDF/X-1a:2001) + >> +} + +\special{pdf:put @catalog +<< + /PageMode /UseNone + /OutputIntents [ + << + /Info (none) + /Type /OutputIntent + /S /GTS_PDFX + /OutputConditionIdentifier (Custom) + /RegistryName (http://www.color.org/) + >> + ] +>> +}% + +\usepackage{datetime} % for \pdfdate command + +%% URL / Hyperlink style +\usepackage[bookmarks=true]{hyperref} + + +\hypersetup{pdfstartpage={}} + +\hypersetup{unicode=true, +$if(title-meta)$ + pdftitle={$title-meta$}, %set pdftitle metadata from Yaml front matter +$endif$ + pdfinfo={% Setting some more PDF/X stuff for xelatex + ModDate={D:\pdfdate},% PDF/X document should have a modification date + Trapped={False},% PDF/X document should have Trapped tag set + }, +$if(author-meta)$ + pdfauthor={$author-meta$}, %set pdfauthor metadata from Yaml front matter +$endif$ +$if(keywords)$ + pdfkeywords={$for(keywords)$$keywords$$sep$; $endfor$}, %set pdfkeywords metadata from Yaml front matter +$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}, %turn off the url border that normally gets added to urls in pdfs +$endif$ + breaklinks=true} + +\urlstyle{same} % don't use monospace font for urls + +%% Export PDF as PDF/X-1a for best Createspace results +%\usepackage[X-1a]{pdfx} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%% TITLE SETTINGS +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Needed for styling chapter title headings +\usepackage{titlesec} + +% Turn off subsection numbering for titles +\renewcommand{\thesection}{} + +%% Style the chapter title that appears on the first page of each chapter +\titlespacing*{\chapter} +{0pt}%left margin +{150pt}%top margin +{25pt}%bottom margin + +% This tells it to style the titleformat for chapters +\titleformat{\chapter}[display]{\bfseries\titlefont}{\Large Chapter \thechapter \normalfont}{0.5mm}{\small} + +%%%%%%%%%%%%%%%%%% +%% This part says to style the titles for "chapters" +% \titleformat{\chapter}[display] + +%% Use this font +%{\garamondL} + +%% This styles the "Chapter 1" part +%{\Large Chapter \thechapter \normalfont} + +%% This is the spacing between the "Chapter 1" and the actual chapter title +%{0.5ex} + +%% This is the size of the chapter title +%{\small}% + +% Add spacing for the chapter title that appears on the first page of each chapter +%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%% HEADERS AND FOOTERS +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Needed for headers and footers +\usepackage{fancyhdr} + +%% Prevent headers from appearing on empty pages +\usepackage{emptypage} + +%% Remove header/footer from the first page of every chapter +\fancypagestyle{plain}{ +\fancyhf{} %remove/clear header/footer content +\renewcommand{\headrulewidth}{0.0pt} %remove black line/"rule" from header +} + +%% Set the header height in: in, mm, cm, pt +\setlength{\headheight}{0.10in} + +%% Set the space between header and text +\setlength{\headsep}{.25in} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%% FONTS +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Use TrueType system fonts +\usepackage{fontspec} + +%% Used to set some things to all caps +\usepackage{textcase} + +%% Set Main Fonts +\setmainfont[ + Ligatures=TeX, + ItalicFont={Linux Libertine O:style=Italic}, + BoldFont={Linux Libertine O:style=Bold}, + BoldItalicFont={Linux Libertine O:style=Bold Italic}, +]{Linux Libertine O} + +%\setmainfont[ +% Ligatures=TeX, +% BoldFont={Aboriginal Serif Bold}, +% ItalicFont={Aboriginal Serif Italic}, +% BoldItalicFont={Aboriginal Serif Bold Italic}, +% SmallCapsFont={TeX Gyre Termes}, +% SmallCapsFeatures={Letters=SmallCaps}, +%]{Minion Pro} + +%% Make our quotes curly +\defaultfontfeatures{Mapping=tex-text} + +%% Provides Creative Commons Icons +\usepackage{ccicons} + +%% Set Adobe Garamond Pro Bold macro \garmondL +%\newcommand*{\garamondL}{\fontspec[Scale=2.0]{Adobe Garamond Pro Bold}\selectfont} +%\newcommand*{\garamond}{\fontspec{Adobe Garamond Pro}\selectfont} + +%% Set URW Gothic macro \goth +% This command uses locally installed OTF/TTF Fonts +%\newcommand*{\goth}{\fontspec{URW Gothic L}\selectfont} + +% These commands use free TeX fonts from CTAN that are nearly identical +\usepackage{tgadventor} +\usepackage[T1]{fontenc} +\newfontfamily\sansfont{TeX Gyre Adventor} + + +%% Set Minion Pro macro \minion +% This command uses locally installed OTF/TTF Fonts +%\newcommand*{\minion}{\fontspec{Minion Pro}\selectfont} +%\newcommand*{\minionHead}{\fontspec{MinionPro-BoldIt}\selectfont} + +% These commands use free TeX fonts from CTAN that are nearly identical +%\usepackage{gentium} +%\usepackage[T1]{fontenc} +%\newfontfamily\minion{Gentium Book Basic} + +\usepackage{libertine} +\usepackage[T1]{fontenc} +\newfontfamily\primaryfont[Ligatures=TeX, Numbers=OldStyle]{Linux Libertine O} +\newfontfamily\titlefont[Scale=1.75, Ligatures=TeX]{Linux Libertine O} + +%\setmainfont +%\renewcommand{\sfdefault}{URW Gothic} +%\setmonofont + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%% METADATA and MACROS +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%% Set Title from Yaml Metadata +\title{$title$} + +%% Set subtitle if it exists in Yaml Metadata +$if(subtitle)$ +\newcommand{\subtitle}{$subtitle$} +$endif$ + +%% Set author from Yaml Metadata +\author{$for(author)$$author$$endfor$} + +%% Set editor from Yaml Metadata +\def\editor{$for(contributors)$$contributors.editor$$endfor$} + +%% Set cover artist from Yaml Metadata +\def\artist{$for(contributors)$$contributors.artist$$endfor$} + +%% Set designer from Yaml Metadata +\def\designer{$for(contributors)$$contributors.designer$$endfor$} + +%% Set publisher from Yaml Metadata +\def\publisher{$for(publisher)$$publisher$$endfor$} + +%% Set website from Yaml Metadata +\def\website{$for(website)$$website$$endfor$} + +%% Use the year instead of the full date +\date{$year$} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%% START THE DOCUMENT +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{document} + +%% Start with the frontmatter +% These pages don't count for document page numbering +\frontmatter + +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Create a titlepage +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%% +% No headers/footers +\pagestyle{empty} +% Center everything + \begin{center} + +% Add a vertical space + \vspace*{3cm} + +% Write the Book Title + \makeatletter \Huge \bfseries \titlefont \textbf{\textsc{\@title}} \par \makeatother + +% Add a vertical space + \vspace{1cm} + +% Write the subtitle +$if(subtitle)$ + \Large \primaryfont $subtitle$ \par +$endif$ + +% Add a vertical space + \vspace{4cm} + +% Write the author name + \Large \normalfont \sansfont \makeatletter \MakeUppercase\@author \makeatother \par + +% Stop centering everythign + \end{center} + +% End the page +\clearpage + +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Create a copyright page +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%% +% No headers/footers +\pagestyle{empty} + +% Center everything + \begin{center} + +% Use Sans font + \sansfont + +% Write the Book Titlecopyright page + \makeatletter \small \@title \par \makeatother + +% Write the CC logo, year, and author + Copyright \ccLogo\ \makeatletter \@date \ \@author \makeatother \par + Some rights reserved. \par + +% Add a vertical space + \vspace{0.4cm} + +% Write what country it was published in + Published in the United States by \par + +% Write the publisher name + \publisher \par + +% Write the website + \website \par + +% Add a vertical space + \vspace{0.4cm} + +% Write the specific license name + This book is distributed under a Creative Commons Attribution-Sharealike 4.0 License. \par + +% Add a vertical space + \vspace{0.4cm} + +% Write the Creative Commons Icons + \ccbysa + +% Stop centering everythign + \end{center} + +% Write license text + \scriptsize + \noindent \sansfont + That means you are free: + \begin{itemize} + \setlength{\itemsep}{0pt} + \setlength{\parskip}{0pt} + \setlength{\parsep}{0pt} + \item \textbf{To Share} -- copy and redistribute the material in any medium or format. + \item \textbf{To Adapt} -- remix, transform, and build upon the material. + \end{itemize} + The licensor cannot revoke these freedoms as long as you follow the license terms: \par + \begin{itemize} + \setlength{\itemsep}{0pt} + \setlength{\parskip}{0pt} + \setlength{\parsep}{0pt} + \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 + % \item \textbf{NonCommercial} -- You may not use the material for commercial purposes. \par + \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 + \end{itemize} + \textbf No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. + +% Add a vertical space + \vspace{.5cm} + +% Start centering again + \begin{center} + +% Attribute the cover artist + $for(contributors)$$if(contributors.artist)$ Cover Artist: \artist \par$endif$$endfor$ + +% Attribute the editor + $for(contributors)$$if(contributors.editor)$ Editor: \editor \par$endif$$endfor$ + +% Attribute the designer (hey, that's me) + $for(contributors)$$if(contributors.designer)$ Design: \designer \par$endif$$endfor$ + +% Add a vertical space + \vspace{0.4cm} + +% If ISBNs are defined in Yaml front matter then write them here + $if(paperback-isbn)$Paperback ISBN: {$paperback-isbn$} \par $endif$ + $if(hardcover-isbn)$HardcoverISBN: {$hardcover-isbn$}\par $endif$ + $if(epub-isbn)$ePub ISBN: {$epub-isbn$} \par $endif$ + +% Stop centering + \end{center} + +% End the page +\clearpage + +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Create a dedication page +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%% +% No headers/footers +\pagestyle{empty} + +% Center everything + \begin{center} + +% Vertically center +\topskip0pt +\vspace*{\fill} + +% Write the Book Title + \normalfont\normalsize $dedication$ \par + +% Stop centering +\vspace*{\fill} + \end{center} + +% End the page +\clearpage + +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Create the chapters +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%% +% This styles the header/footer for normal 'chapter' pages +\makeatletter +\pagestyle{fancy} +%\renewcommand{\chaptermark}[1]{\markboth{#1}{}} % This removes the 'Chapter x' from the header +\renewcommand{\chaptermark}[1]{\markboth {\@chapapp\ \thechapter \hspace{1mm}-\hspace{1mm}{#1}}{}} + +\fancyfoot[C]{} % remove numbered footers +\fancyhead[RO,LE]{\primaryfont\bfseries \thepage} % add page numbers to the header +\fancyhead[LO]{\primaryfont\bfseries \textsc \leftmark} % add subtitle to header +\fancyhead[RE]{\primaryfont\bfseries \textsc \@title} +\renewcommand{\headrulewidth}{0.0pt} +\makeatother + +% This says to start the page numbering +\mainmatter + +% Write the body/chapters +\primaryfont \normalsize \flushbottom $body$ + +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Create the bio page +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%% +% add blank even page before backmatter starts +\newcommand*\cleartoleftpage{% + \clearpage + \ifodd\value{page}\hbox{}\thispagestyle{empty}\newpage\fi +} + +\cleartoleftpage + +% Label as backmatter +\backmatter + +% No headers/footers +\pagestyle{empty} + +% Add space before/after the page title +\titlespacing*{\section} +{0pt}%left +{150pt}%top +{25pt}%bottom + +% This designs the page title +\titleformat{\section}[display]{\bfseries\titlefont}{}{0.5mm}{\centering \Large} % Don't say 'chapter X' + +% Don't indent new paragraphs +\setlength{\parindent}{0mm} + +% Add space between paragraphs +\parskip = \baselineskip + +% Include the file(s) we specified via the pandoc command, in this case our bio.md +$include-after$ + +% End the document +\end{document} + diff --git a/Pandoc/templates/custom-epub.html b/Pandoc/templates/custom-epub.html new file mode 100644 index 0000000..d884687 --- /dev/null +++ b/Pandoc/templates/custom-epub.html @@ -0,0 +1,106 @@ + + + + + + + + $pagetitle$ + + + + + $if(titlepage)$ + $for(title)$ + $if(title.text)$ +

$title.text$

+ $else$ +

$title$

+ $endif$ + $endfor$ + + $if(subtitle)$ +

$subtitle$

+ $endif$ + + $for(year)$ +

© $year$

+ $endfor$ + + $for(author)$ +

$author$

+ $endfor$ + + $for(creator)$ +

$creator.text$

+ $endfor$ + + $if(publisher)$ +

$publisher$

+ $endif$ + + $for(book1)$ + $if(book1.title)$ +

Also Available

+

 

+ $endif$ + $endfor$ + + $for(book1)$ + $if(book1.title)$ +

$book1.title$

+ $endif$ + $endfor$ + + $for(book2)$ + $if(book2.title)$ +

$book2.title$

+ $endif$ + $endfor$ + + $for(book3)$ + $if(book3.title)$ +

$book3.title$

+ $endif$ + $endfor$ + + $for(book4)$ + $if(book4.title)$ +

$book4.title$

+ $endif$ + $endfor$ + + $for(book5)$ + $if(book5.title)$ +

$book5.title$

+ $endif$ + $endfor$ + + $for(magnet)$ + $if(magnet.link)$ +

Free Bonus

+ $else$ +

Free Bonus

+ $endif$ + $endfor$ + + $if(contributors)$ +
+ $for(contributors)$ + $if(contributors.designer)$ +
Book Design: $contributors.designer$
+ $endif$ + $if(contributors.artist)$ +
Cover Artist: $contributors.artist$
+ $endif$ + $if(contributors.editor)$ +
Editor: $contributors.editor$
+ $endif$ + $endfor$ +
+ $endif$ + $endif$ + + $body$ + + diff --git a/Pandoc/templates/pdf.latex b/Pandoc/templates/pdf.latex new file mode 100644 index 0000000..9b8f650 --- /dev/null +++ b/Pandoc/templates/pdf.latex @@ -0,0 +1,403 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%% Base Document Settings +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\documentclass% +[12pt] % Set default font size +{book} % Set document Class + +%% Set page size and margins +\usepackage{geometry} + \geometry{ + paperheight=203.2mm, %actual height measurement of the page + paperwidth=127mm, %actual width measurement of the page + total={90.54mm, 127mm}, % widht/height of the "text box"/text area on the page + top=22.352mm, % top margin + bottom=19.177mm, %bottom margin + inner=19.177mm, %inner/gutter margin + outer=19.177mm, %outer margin + } + +%% Set line spacing +% 1.0 = single space +% 1.3 = 1.5 space +% 1.6 = double space +\linespread{1.3} + +%% Set no additional space between paragraphs +\setlength{\parskip}{0pt} + +%% Use this package to enable tables +\usepackage{longtable,booktabs} + +%% Hide the toprule +\renewcommand{\toprule}{} + +%% Hide the bottomrule +\renewcommand{\bottomrule}{} + +\setlength{\LTpost}{0pt} + + +%% Set language and hyphenation rules +\usepackage[english]{babel} + +%% Set encoding +\usepackage[utf8]{inputenc} + +%% Enable widow/orphan control +%\usepackage[all,defaultlines=2]{nowidow} +\widowpenalty=10000 +\clubpenalty=10000 + +%% Prevent overfull lines +\setlength{\emergencystretch}{3em} +\providecommand{\tightlist}{\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%% Title Settings +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Needed for styling chapter title headings +\usepackage{titlesec} + +% Turn off subsection numbering for titles +\renewcommand{\thesection}{} + +%% Style the chapter title that appears on the first page of each chapter +\titlespacing*{\chapter} +{0pt}%left margin +{150pt}%top margin +{25pt}%bottom margin + +% This tells it to style the titleformat for chapters +\titleformat{\chapter}[display]{\bfseries\titlefont}{\Large Chapter \thechapter \normalfont}{0.5mm}{\small} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%% Headers & Footers +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Needed for headers and footers +\usepackage{fancyhdr} + +%% Prevent headers from appearing on empty pages +\usepackage{emptypage} + +%% Remove header/footer from the first page of every chapter +\fancypagestyle{plain}{ +\fancyhf{} %remove/clear header/footer content +\renewcommand{\headrulewidth}{0.0pt} %remove black line/"rule" from header +} + +%% Set the header height in: in, mm, cm, pt +\setlength{\headheight}{.35in} + +%% Set the space between header and text +\setlength{\headsep}{.25in} + +%% Set the header height in: in, mm, cm, pt +%\headheight=in + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%% Images +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Needed for images; used for cover +\usepackage{incgraph,tikz} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%% Fonts +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Use TrueType system fonts +\usepackage{fontspec} + +%% Set Main Fonts +\setmainfont[ + Ligatures=TeX, + ItalicFont={Linux Libertine O:style=Italic}, +]{Linux Libertine O} + +%\setmainfont[ +% Ligatures=TeX, +% BoldFont={Aboriginal Serif Bold}, +% ItalicFont={Aboriginal Serif Italic}, +% BoldItalicFont={Aboriginal Serif Bold Italic}, +% SmallCapsFont={TeX Gyre Termes}, +% SmallCapsFeatures={Letters=SmallCaps}, +%]{Minion Pro} + + +%% Make our quotes curly +\defaultfontfeatures{Mapping=tex-text} + +%% Provides Creative Commons Icons +\usepackage{ccicons} +\usepackage{tgadventor} +\usepackage[T1]{fontenc} +\newfontfamily\sansfont{TeX Gyre Adventor} + + +%% Set Minion Pro macro \primaryfont +% This command uses locally installed OTF/TTF Fonts +%\newcommand*{\primaryfont}{\fontspec{Minion Pro}\selectfont} +%\newcommand*{\primaryfontHead}{\fontspec{MinionPro-BoldIt}\selectfont} + +% These commands use free TeX fonts from CTAN that are nearly identical +%\usepackage{gentium} +%\usepackage[T1]{fontenc} +%\newfontfamily\primaryfont{Gentium Book Basic} + +\usepackage{libertine} +\usepackage[T1]{fontenc} +\newfontfamily\primaryfont[Ligatures=TeX, Numbers=OldStyle]{Linux Libertine O} +\newfontfamily\titlefont[Scale=1.75, Ligatures=TeX]{Linux Libertine O} + +%\setmainfont +%\setsansfont +%\setmonofont + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%% Metadata Settings +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%% Set Title from Yaml Metadata +\title{$title$} + +%% Set subtitle if it exists in Yaml Metadata +$if(subtitle)$ +\newcommand{\subtitle}{$subtitle$} +$endif$ + +%% Set author from Yaml Metadata +\author{$for(author)$$author$$endfor$} + +%% Set editor from Yaml Metadata +\def\editor{$for(contributors)$$contributors.editor$$endfor$} + +%% Set cover artist from Yaml Metadata +\def\artist{$for(contributors)$$contributors.artist$$endfor$} + +%% Set designer from Yaml Metadata +\def\designer{$for(contributors)$$contributors.designer$$endfor$} + +%% Set publisher from Yaml Metadata +\def\publisher{$for(publisher)$$publisher$$endfor$} + +%% Set website from Yaml Metadata +\def\website{$for(website)$$website$$endfor$} + +%% Use the year instead of the full date +\date{$year$} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%% Start the document +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{document} + +%% Start with the frontmatter +% These pages don't count for document page numbering +\frontmatter + +% TeX 'magic' required so we can use macros/variables with @ +\makeatletter + +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%% Create a cover page +%%%%%%%%%%%%%%%%%%%%%%%%%%% +% No headers or footers +\pagestyle{empty} + +% The image +\incgraph[documentpaper] +[height=\paperheight]{$cover-image$} % Fit to height + +%% Stretch image to fit page +% [width=\paperwidth,height=\paperheight]{$cover-image$} + +% End the page +\clearpage +%%%%%%%%%%%%%%%%%%%%%% +%% Create a titlepage +%%%%%%%%%%%%%%%%%%%%%% +% No headers/footers +\pagestyle{empty} +% Center everything + \begin{center} + +% Add a vertical space + \vspace*{3cm} + +% Write the Book Title + \makeatletter \Huge \bfseries \titlefont \textbf{\textsc{\@title}} \par \makeatother + +% Add a vertical space + \vspace{1cm} + +% Write the subtitle +$if(subtitle)$ + \Large \primaryfont $subtitle$ \par +$endif$ + +% Add a vertical space + \vspace{3cm} + +% Write the author name + \Large \normalfont \sansfont \makeatletter \MakeUppercase\@author \makeatother \par + +% Stop centering everythign + \end{center} + +% End the page +\clearpage + + +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Create a copyright page +%%%%%%%%%%%%%%%%%%%%%%%%%%% +% No headers/footers +\pagestyle{empty} + +% Center everything + \begin{center} + +% Use Sans font + \sansfont + +% Write the Book Titlecopyright page + \makeatletter \scriptsize \@title \par \makeatother + +% Write the CC logo, year, and author + \scriptsize Copyright \ccLogo\ \makeatletter \@date \ \@author \makeatother \par + \scriptsize Some rights reserved. \par + +% Add a vertical space + \vspace{0.3cm} + +% Write what country it was published in + \scriptsize Published in the United States by \par + +% Write the publisher name + \scriptsize \publisher \par + +% Write the website + \scriptsize \website \par + +% Add a vertical space + \vspace{0.3cm} + +% Write the specific license name + \scriptsize This book is distributed under a Creative Commons attribution-NonCommercial-Sharealike 4.0 License. \par + +% Add a vertical space + \vspace{0.3cm} + +% Write the Creative Commons Icons + \ccbyncsa + +% Stop centering everythign + \end{center} + +% Write license text + \scriptsize + \noindent \sansfont \linespread{1.0} + That means you are free: + \begin{itemize} + \setlength{\itemsep}{0pt} + \setlength{\parskip}{0pt} + \setlength{\parsep}{0pt} + \item \textbf{To Share} -- copy and redistribute the material in any medium or format. + \item \textbf{To Adapt} -- remix, transform, and build upon the material. + \end{itemize} + The licensor cannot revoke these freedoms as long as you follow the license terms: \par + \begin{itemize} + \setlength{\itemsep}{0pt} + \setlength{\parskip}{0pt} + \setlength{\parsep}{0pt} + \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 + \item \textbf{NonCommercial} -- You may not use the material for commercial purposes. \par + \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 + \end{itemize} + \textbf No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. + +% Add a vertical space + \vspace{.3cm} + +% Start centering again + \begin{center} + +% Attribute the cover artist + $for(contributors)$$if(contributors.artist)$ Cover Artist: \artist \par$endif$$endfor$ + +% Attribute the editor + $for(contributors)$$if(contributors.editor)$ Editor: \editor \par$endif$$endfor$ + +% Attribute the designer (hey, that's me) + $for(contributors)$$if(contributors.designer)$ Design: \designer \par$endif$$endfor$ + +% Add a vertical space + \vspace{0.3cm} + +% If ISBNs are defined in Yaml front matter then write them here + $if(paperback-isbn)$Paperback ISBN: {$paperback-isbn$} \par $endif$ + $if(hardcover-isbn)$HardcoverISBN: {$hardcover-isbn$}\par $endif$ + $if(epub-isbn)$ePub ISBN: {$epub-isbn$} \par $endif$ + +% Stop centering + \end{center} + +% End the page +\clearpage \normalsize + +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Create the chapters +%%%%%%%%%%%%%%%%%%%%%%%%%%% +% This styles the header/footer for normal 'chapter' pages +\pagestyle{fancy} +\renewcommand{\chaptermark}[1]{\markboth {\@chapapp\ \thechapter \hspace{1mm}-\hspace{1mm}{#1}}{}} + +\fancyfoot[C]{} % remove numbered footers +\fancyhead[RO,LE]{\primaryfont\bfseries \thepage} % add page numbers to the header +\fancyhead[LO]{\primaryfont\bfseries \textsc \leftmark} % add subtitle to header +\fancyhead[RE]{\primaryfont\bfseries \textsc \@title} +\renewcommand{\headrulewidth}{0.0pt} + +% This says to start the page numbering +\mainmatter + +% Write the body/chapters +\primaryfont $body$ + +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Create the bio page +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%% +% add blank even page before backmatter starts +\newcommand*\cleartoleftpage{% + \clearpage + \ifodd\value{page}\hbox{}\thispagestyle{empty}\newpage\fi +} + +\cleartoleftpage + +% Label as backmatter +\backmatter + +% No headers/footers +\pagestyle{empty} + +% Add space before/after the page title +\titlespacing*{\section} +{0pt}%left +{150pt}%top +{25pt}%bottom + +% This designs the page title +\titleformat{\section}[display]{\bfseries\titlefont}{}{0.5mm}{\centering \Large} % Don't say 'chapter X' + +% Don't indent new paragraphs +\setlength{\parindent}{0mm} + +% Add space between paragraphs +\parskip = \baselineskip + +% Include the file(s) we specified via the pandoc command, in this case our bio.md +$include-after$ +% End the document +\end{document} diff --git a/Pandoc/templates/smashwords-epub.html b/Pandoc/templates/smashwords-epub.html new file mode 100644 index 0000000..28821d5 --- /dev/null +++ b/Pandoc/templates/smashwords-epub.html @@ -0,0 +1,108 @@ + + + + + + + + $pagetitle$ + + + + + $if(titlepage)$ + $for(title)$ + $if(title.text)$ +

$title.text$

+ $else$ +

$title$

+ $endif$ + $endfor$ + + $if(subtitle)$ +

$subtitle$

+ $endif$ + + $for(year)$ +

© $year$

+ $endfor$ + + $for(author)$ +

$author$

+ $endfor$ + + $for(creator)$ +

$creator.text$

+ $endfor$ + + $if(publisher)$ +

$publisher$

+ $endif$ + +

Smashwords Edition

+ + $for(book1)$ + $if(book1.title)$ +

Also Available

+
+ $endif$ + $endfor$ + + $for(book1)$ + $if(book1.title)$ +

$book1.title$

+ $endif$ + $endfor$ + + $for(book2)$ + $if(book2.title)$ +

$book2.title$

+ $endif$ + $endfor$ + + $for(book3)$ + $if(book3.title)$ +

$book3.title$

+ $endif$ + $endfor$ + + $for(book4)$ + $if(book4.title)$ +

$book4.title$

+ $endif$ + $endfor$ + + $for(book5)$ + $if(book5.title)$ +

$book5.title$

+ $endif$ + $endfor$ + + $for(magnet)$ + $if(magnet.link)$ +

Free Bonus

+ $else$ +

Free Bonus

+ $endif$ + $endfor$ + + $if(contributors)$ +
+ $for(contributors)$ + $if(contributors.designer)$ +
Book Design: $contributors.designer$
+ $endif$ + $if(contributors.artist)$ +
Cover Artist: $contributors.artist$
+ $endif$ + $if(contributors.editor)$ +
Editor: $contributors.editor$
+ $endif$ + $endfor$ +
+ $endif$ + $endif$ + + $body$ + + diff --git a/appendixa.md b/appendixa.md index 75d11a1..153898f 100644 --- a/appendixa.md +++ b/appendixa.md @@ -1,4 +1,6 @@ -# Appendix A {-} +\appendix + +# My journey My journey as a programmer started when I was in elementary school. I became interested in computers after reading about them in the World Book Encyclopedia and hoped to work with them some day. What I didn't realize was that those encyclopedias were out-of-date and only showed the larger, more expensive mainframe and mini-computers of the 1960s and not the more modern microcomputers that were introduced in the late 1970s. When I realized that an Apple ][ was a microcomputer and that it was designed for the home market I began my quest to get a computer of my own (AKA: I started dropping not-so-subtle hints to my parents that I wanted a computer). I scoured magazines like Popular Computing and Byte Magazine looking for the right computer; from the Commodore VIC-20 and Sinclair ZX-80 to the Radio Shack TRS-80 Model III (Even the Rockwell AIM-65 or Heathkit H89 would have worked. I wasn't picky back then.) My dad took me to computer stores and I marveled at the variety of machines that were there (and likely made a few sales-people nervous as I poked and prodded the new and rather expensive machines). Finally my dad picked up an Atari 400 computer with tape drive, and I began learning BASIC programming in earnest. Around the same time my school opened a "computer lab" with three Commodore PET 4032 machines (complete with floppy disk drives), and I found myself spending every moment I could with those machines. In high school I took two programming courses, one in BASIC and the other in Pascal (which was my first exposure to procedural languages, and the basic concepts of computer science). In college I majored in Computer Science with a Bachelor of Science and did my best to keep up with all of the things that they tried to teach me. Unfortunately, I wasn't a great student (especially in mathematics). I struggled with and later dropped my compilers class, and felt like I was falling behind where other students succeeded. Most of our classes used Pascal, which I was becoming more familiar with, but there were a few classes that used COBOL, Ada, SNOBOL, C, and assembly language. I graduated with modest scores and returned home. diff --git a/epilogue.md b/epilogue.md index d9db6c7..ece4a31 100644 --- a/epilogue.md +++ b/epilogue.md @@ -1,4 +1,4 @@ -# Epilogue {-} +# Epilogue It's a cliché for an author to say the book they wrote is the one they wished they had read when they were confronted with the topics presented in the book. Perhaps it's a cliché because it's true: this book contains the advice that would have helped me when I started this journey. Too often I've wondered if I've measured up to whatever metrics I created to represent the ideal programmer. Many times I saw the success of my peers and wondered if I was defective as a programmer or deficient in my learning. What was I getting wrong that others were getting right? diff --git a/gratitude.md b/gratitude.md index 89f1c47..835c5d8 100644 --- a/gratitude.md +++ b/gratitude.md @@ -1,4 +1,4 @@ -# Gratitude {-} +# Gratitude This book would not exist without the folks who have accompanied me on my journey, both as instructors and as colleagues. My thanks and appreciation to all of my instructors in my formative years for giving me their best efforts to teach me programming in its various forms. I am indebted to all of my colleagues and programming friends over the years who shared their knowledge with me and trusted me enough to help them along the way. I am also blessed to have many communities that help sustain me, including the [Michigan!/usr/group][1], [PyOhio][2], [Coffee House Coders][3], and the [Ubuntu Michigan Loco][4]. Also to those who don't fit in these neat categories; know that if we have spent any time discussing programming or other matters that our discussions are deeply appreciated. diff --git a/metadata.xml b/metadata.xml index fe471d6..6b6c9f8 100644 --- a/metadata.xml +++ b/metadata.xml @@ -1,2 +1,2 @@ -Copyright 2018, Craig Maloney. Released under a CC-BY-SA International 4.0 License +Copyright 2019, Craig Maloney. Released under a CC-BY-SA International 4.0 License en-US diff --git a/metadata.yaml b/metadata.yaml index 90fe1e7..c13b150 100644 --- a/metadata.yaml +++ b/metadata.yaml @@ -1,5 +1,12 @@ --- title: 'The Mediocre Programmer' author: - - Craig Maloney +- Craig Maloney +contributors: + - artist: David Revoy + editor: Sharon Maloney +publisher: 'Craig Maloney' +website: 'http://themediocreprogrammer.com' tags: [developer, programmer, mediocre] +year: 2019 +--- diff --git a/title.txt b/title.txt index 8f7e82c..1bce45e 100644 --- a/title.txt +++ b/title.txt @@ -1,3 +1,3 @@ % The Mediocre Programmer % Written by Craig Maloney -% \textcopyright 2018 by Craig Maloney. \break Released under the CC-BY-SA International 4.0 license.\break Edited by Sharon Maloney. \break Cover artwork by David Revoy. +% \textcopyright 2018 by Craig Maloney. \par Released under the CC-BY-SA International 4.0 license.\par Edited by Sharon Maloney. \break Cover artwork by David Revoy.