books/Template
Template
1
0

Initial Commit

This commit is contained in:
Arindy 2022-05-04 14:27:36 +02:00
commit ac0ad2a895
11 changed files with 285 additions and 0 deletions

15
.github/workflows/ci.yaml vendored Normal file
View File

@ -0,0 +1,15 @@
name: CI
on: [ push, pull_request ]
jobs:
build:
runs-on: ubuntu-latest
container:
image: git.arindy.de/arindy/latex-runner:1.0.0
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build
run: make build

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
template.iml
.idea
out/

54
Makefile Normal file
View File

@ -0,0 +1,54 @@
COMPILER := pdflatex
TEXINPUTS := ./styles/:$(TEXINPUTS)
COMPILER := TEXINPUTS=$(TEXINPUTS) $(COMPILER)
ifndef VERBOSE
PIPE := 1>/dev/null 2>/dev/null
INDENT := 2>&1 | sed 's/^/ /'
COMPILER := $(COMPILER) -interaction=nonstopmode
endif
check_error = \
if [ ! $(1) -eq 0 ]; then \
cat '../out/$(2).log' | \
perl -0777 -ne 'print m/\n! .*?\nl\.\d.*?\n.*?(?=\n)/gs' $(INDENT); \
exit 1; \
fi
createout = mkdir -p out && mkdir -p out/chapters
compile = cd src && ${COMPILER} -shell-escape -file-line-error -synctex=1 \
-output-format=pdf -output-directory=../out .formats/${1}.tex ${PIPE} || \
$(call check_error, $$?,$(1))
.PHONY: clean book
.PRECIOUS: %.pdf
.SECONDEXPANSION:
%.pdf: src/.formats/%.tex
@echo "Building $*.pdf"
@$(call createout)
@echo " Compiling $*.tex"
@$(call compile,$*)
%.odt: src/%.tex
@echo "Building $*.odt"
@echo " Compiling $*.tex"
@cd src && pandoc -f latex -t odt -o ../out/book.odt book.tex
%.epub: src/%.tex
@echo "Building $*.epub"
@echo " Compiling $*.tex"
@cd src && pandoc -f latex -o ../out/book.epub book.tex
%.clean:
@echo "cleaning"
@rm -rfd out/*.4ct out/*.4tc out/*.dvi out/*.idv out/*.tex out/*.tmp out/*.xref out/*.svg out/*.lg out/*.4og out/*.aux out/*.bbl out/*.blg out/*.log out/*.out out/*.synctex.gz out/**/*.png \
out/*.nav out/*.run.xml out/*.snm out/*.toc out/*.vrb out/*-blx.bib out/**/
clean:
@rm -rf out
book: oneside.pdf twosides.pdf ebook.pdf $$@.odt $$@.epub $$@.clean

4
src/.formats/ebook.tex Normal file
View File

@ -0,0 +1,4 @@
\documentclass[ebook,oneside]{memoir}
\usepackage[german]{babel}
\input{.formats/structure}
\input{book}

4
src/.formats/oneside.tex Normal file
View File

@ -0,0 +1,4 @@
\documentclass[oneside]{memoir}
\usepackage[german]{babel}
\input{.formats/structure}
\input{book}

171
src/.formats/structure.tex Normal file
View File

@ -0,0 +1,171 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% eBook
% Structural Definitions File
% Version 1.0 (29/12/14)
%
% Created by:
% Vel (vel@latextemplates.com)
%
% Modified by:
% Arindy
%
% This file has been downloaded from:
% http://www.LaTeXTemplates.com
%
% License:
% CC BY-NC-SA 3.0 (http://creativecommons.org/licenses/by-nc-sa/3.0/)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%----------------------------------------------------------------------------------------
% REQUIRED PACKAGES
%----------------------------------------------------------------------------------------
\usepackage[utf8]{inputenc} % Required for inputting international characters
\usepackage[T1]{fontenc} % Output font encoding for international characters
\usepackage[osf]{libertine} % Use the Libertine font
\usepackage{microtype} % Improves character and word spacing
\usepackage{color}
\usepackage{tikz} % Required for drawing custom shapes
\usepackage{wallpaper} % Required for setting background images (title page)
\usepackage[unicode=true,bookmarks=true,bookmarksnumbered=false,bookmarksopen=false,breaklinks=false,pdfborder={0 0 1},backref=section,colorlinks=false]{hyperref} % PDF meta-information specification
%----------------------------------------------------------------------------------------
% PAPER, MARGIN AND HEADER/FOOTER SIZES
%----------------------------------------------------------------------------------------
\setlrmarginsandblock{50pt}{50pt}{*} % Left/right margins
\setulmarginsandblock{50pt}{50pt}{*} % Top/bottom margins
\setheadfoot{14pt}{12pt} % Header/footer height
%----------------------------------------------------------------------------------------
% HEADER AND FOOTER FORMATS
%----------------------------------------------------------------------------------------
\newcommand{\currentchapter}{}\let\oldchapter\chapter\RenewDocumentCommand{\chapter}{sm}{ \IfBooleanTF{#1}{\oldchapter*{#2}}{\oldchapter{#2} }\renewcommand{\currentchapter}{#2}}
\makepagestyle{mio} % Define a new custom page style
\makeheadrule{mio}{\textwidth}{0.1mm} % Header rule height
\makeevenhead{mio}{\scriptsize{\theauthor\hskip.2cm\textemdash\hskip.2cm\itshape{\thetitle}}}{}{} % Header specification
\makeoddhead{mio}{\hfill\scriptsize{\itshape{\currentchapter}}}{}{} % Header specification
\makeoddfoot{mio}{}{\footnotesize {\thepage}}{} % Footer specification
\makeevenfoot{mio}{}{\footnotesize {\thepage}}{} % Footer specification
\makeoddfoot{plain}{}{\footnotesize {\thepage}}{} % Pages of chapters
\makeevenfoot{plain}{}{\footnotesize {\thepage}}{} % Pages of chapters
\pagestyle{mio} % Set the page style to the custom style defined above
%----------------------------------------------------------------------------------------
% PART FORMAT
%----------------------------------------------------------------------------------------
\renewcommand{\partnamefont}{\centering\sffamily\itshape\Huge} % Part name font specification
\renewcommand{\partnumfont}{\sffamily\Huge} % Part number font specification
\renewcommand{\parttitlefont}{\centering\sffamily\scshape} % Part title font specification
\renewcommand{\beforepartskip}{\null\vskip.618\textheight} % Whitespace above the part heading
%----------------------------------------------------------------------------------------
% CHAPTER FORMAT
%----------------------------------------------------------------------------------------
\makechapterstyle{Tufte}{ % Define a new chapter style
\renewcommand{\chapterheadstart}{\null \vskip3.5\onelineskip} % Whitespace before the chapter starts
\renewcommand{\printchaptername}{\large\itshape\chaptername} % "Chapter" text font specification
\renewcommand{\printchapternum}{\LARGE\thechapter \\} % Chapter number font specification
\renewcommand{\afterchapternum}{} % Space between the chapter number and text
\renewcommand{\printchaptertitle}[1]{ % Chapter title font specification
\raggedright
\itshape\Huge{##1}}
\renewcommand{\afterchaptertitle}{
\vskip3.5\onelineskip
}}
\chapterstyle{Tufte} % Set the chapter style to the custom style defined above
%----------------------------------------------------------------------------------------
% SECTION FORMAT
%----------------------------------------------------------------------------------------
\setsecheadstyle{\sethangfrom{\noindent ##1}\raggedright\sffamily\itshape\Large} % Section title font specification
\setbeforesecskip{-.6\onelineskip} % Whitespace before the section
\setaftersecskip{.3\onelineskip} % Whitespace after the section
%----------------------------------------------------------------------------------------
% SUBSECTION FORMAT
%----------------------------------------------------------------------------------------
\setsubsecheadstyle{\sethangfrom{\noindent ##1}\raggedright\sffamily\large\itshape} % Subsection title font specification
\setbeforesubsecskip{-.5\onelineskip} % Whitespace before the subsection
\setaftersubsecskip{.2\onelineskip} % Whitespace after the subsection
%----------------------------------------------------------------------------------------
% SUBSUBSECTION FORMAT
%----------------------------------------------------------------------------------------
\setsubsubsecheadstyle{\sethangfrom{\noindent ##1}\raggedright\sffamily\itshape} % Subsubsection title font specification
\setbeforesubsubsecskip{-.5\onelineskip} % Whitespace before the subsubsection
\setaftersubsubsecskip{.1\onelineskip} % Whitespace after the subsubsection
%----------------------------------------------------------------------------------------
% CAPTION FORMAT
%----------------------------------------------------------------------------------------
\captiontitlefont{\itshape\footnotesize} % Caption font specification
\captionnamefont{\footnotesize} % "Caption" text font specification
%----------------------------------------------------------------------------------------
% QUOTATION ENVIRONMENT FORMAT
%----------------------------------------------------------------------------------------
\renewenvironment{quotation}
{\par\leftskip=1em\vskip.5\onelineskip\em}
{\par\vskip.5\onelineskip}
%----------------------------------------------------------------------------------------
% QUOTE ENVIRONMENT FORMAT
%----------------------------------------------------------------------------------------
\renewenvironment{quote}
{\list{}{\em\leftmargin=1em}\item[]}{\endlist\relax}
%----------------------------------------------------------------------------------------
% MISCELLANEOUS DOCUMENT SPECIFICATIONS
%----------------------------------------------------------------------------------------
\setlength{\parindent}{1em} % Paragraph indentation
\midsloppy % Fewer overfull lines - used in the memoir class and allows a setting somewhere between \fussy and \sloppy
\checkandfixthelayout % Tell memoir to implement the above
\newcommand{\subtitle}[1]{
\newcommand{\thesubtitle}{#1}
}
\newcommand{\removetitlebox}{
\newcommand{\rtb}{}
}
\newcommand{\coverpage}[2][violet]{
\thispagestyle{empty}
\ifthenelse{\equal{#2}{}}{}{\ThisTileWallPaper{1\paperwidth}{1\paperheight}{#2}}
\ifthenelse{\isundefined{\rtb}}{
\begin{tikzpicture}[remember picture,overlay]
\node [rectangle, rounded corners, fill=white, opacity=0.75, anchor=south west, minimum width=13cm, minimum height=4.2cm] (box) at (-1.5,-6) (box){}; % White rectangle - "minimum width/height" adjust the width and height of the box; "(-0.5,-10)" adjusts the position on the page
\ifthenelse{\isundefined{\thesubtitle}}{}{
\node[anchor=west, #1, xshift=-6.2cm, yshift=-3.9cm, text width=12.9cm, font=\sffamily] at (box.north){
\thesubtitle
};
}
\node[anchor=west, #1, xshift=-6.2cm, yshift=-2.2cm, text width=12.9cm, font=\sffamily\bfseries\scshape\HUGE] at (box.north){\thetitle}; % "Text width" adjusts the wrapping width, "xshift/yshift" adjust the position relative to the white rectangle
\ifthenelse{\isundefined{\theauthor}}{}{
\node[anchor=west, #1, xshift=-6.2cm, yshift=-0.6cm, text width=12.9cm, font=\sffamily\bfseries\large] at (box.north){\theauthor}; % "Text width" adjusts the wrapping width, "xshift/yshift" adjust the position relative to the white rectangle
}
\end{tikzpicture}
}{
\begin{tikzpicture}[remember picture,overlay]
\end{tikzpicture}
}
\newpage % Make sure the following content is on a new page
}

View File

@ -0,0 +1,4 @@
\documentclass[]{memoir}
\usepackage[german]{babel}
\input{.formats/structure}
\input{book}

17
src/book.tex Executable file
View File

@ -0,0 +1,17 @@
\usepackage[ left = \glqq{}, right = \grqq{}, leftsub = \glq{}, rightsub = \grq{} ]{dirtytalk}
\author{Arindy}
\title{Template Book}
\subtitle{--- Work in Progress ---}
%\removetitlebox
%-------------------------------------------
\begin{document}
\coverpage[black]{graphics/cover.jpg}
\include{chapters/one}
\end{document}

13
src/chapters/one.tex Normal file
View File

@ -0,0 +1,13 @@
\chapter{one}\label{ch:one}
Zombie ipsum brains reversus ab cerebellum viral inferno, brein nam rick mend grimes malum cerveau cerebro.
De carne cerebro lumbering animata cervello corpora quaeritis.
Summus thalamus brains sit, morbo basal ganglia vel maleficia?
De braaaiiiins apocalypsi gorger omero prefrontal cortex undead survivor fornix dictum mauris.
Hi brains mindless mortuis limbic cortex soulless creaturas optic nerve, imo evil braaiinns stalking monstra hypothalamus adventus resi hippocampus dentevil vultus brain comedat cerebella pitiutary gland viventium.
Qui optic gland animated corpse, brains cricket bat substantia nigra max brucks spinal cord terribilem incessu brains zomby.
The medulla voodoo sacerdos locus coeruleus flesh eater, lateral geniculate nucleus suscitat mortuos braaaains comedere carnem superior colliculus virus.
Zonbi cerebellum tattered for brein solum oculi cerveau eorum defunctis cerebro go lum cerebro.
Nescio brains an Undead cervello zombies.
Sicut thalamus malus putrid brains voodoo horror.
Nigh basal ganglia tofth eliv ingdead.

BIN
src/graphics/cover.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
src/graphics/cover.jpg~ Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB