## Zostavovanie LaTeX dokumentov ináč a využitie dedičnosti pri tvorbe šablón / [**OSS Conf 2018**](http://ossconf.soit.sk)
### Me, Myself and $\LaTeX$ * I am not a regular $\LaTeX$ guy ;) * I am only ocasional $\LaTeX$ guy * template for diploma/bachelor thesis in 2016 * hard to maintain (by email only, once upon a time) * big plans... * almost gave up, when I took a closer look * the result: https://git.kpi.fei.tuke.sk/tuke/thesis.in.latex
## Latexmk * completely automates the process of compiling $\LaTeX$ document * similar to `make` utility * determines dependencies automatically * can run continuously with suitable previewer * `latexmk` is rerun whenever one of the source files is modified * preview is updated automatically
## Basic Usage ```bash $ latexmk file ``` * generates `.dvi` file by default
## Recommended Usage ```bash $ latexmk -pdf -bibtex -pvc -shell-escape file ``` * `-pdf` - by default `latexmk` generates _dvi_ * `-bibtex` - when bbl files are used, regenerates them automatically * `-pvc` - mnemonic of _"preview continuously"_ * `-sheel-escape`
## Cleanup ```bash $ latexmk -C ``` * clean up (remove) all regeneratable files generated by `latex` and `bibtex` or `biber` * with `.dvi`, `.ps` and `.pdf` files
## Don't Hack Core! Use inheritance instead :-*
## Class Diagram
## Defining New Document Class ```tex % name of the new document class \NeedsTeXFormat{LaTeX2e} \ProvidesClass{oss-conf}[2018/07/2 OSS Conf, v2018.1] % specify the base class \PassOptionsToClass{a4paper,12pt,twoside}{article} \LoadClass{article} ```
## Adding Dependencies ```tex % Dependencies \RequirePackage[utf8]{inputenc} \RequirePackage[T1]{fontenc} \RequirePackage{graphicx} \RequirePackage[ unicode, bookmarks=false ]{hyperref} \RequirePackage[ bibencoding=auto, style=numeric, sorting=none, %ydnt, isbn=true, backend=biber ]{biblatex} ```
## Header and Footer ```tex % Header and Footer \RequirePackage{fancyhdr} \pagestyle{fancy} \fancyfoot{} \fancyhead[LE,RO]{\thepage} \fancyhead[LO]{\nouppercase{\leftmark: \rightmark}} \fancyhead[RE]{\nouppercase{\konfera}} ```
## Own Commands ```tex \renewcommand{\title}[2]{ % \newcommand{\@title@en}{#1}% \newcommand{\@title@sk}{#2}% } \newcommand{\@keywords}{} \newcommand{\keywords}[2]{ % \newcommand{\@keywords@en}{#1}% \newcommand{\@keywords@sk}{#2}% } ```
## What to Keep in Main Document * babel - language can differ
## Translations * [**babel**](https://ctan.org/pkg/babel) - Multilingual support ```tex \usepackage[slovak,english]{babel} \addto\captionsslovak{ \def\keywordstname{Kľúčové slová} } \selectlanguage{slovak} \keywordsname{} ``` * [**translations**](https://ctan.org/pkg/translations) - I18n of $\LaTeX2ε$ packages ```tex \usepackage{translations} \DeclareTranslationFallback{keywords}{Keywords} \DeclareTranslation{slovak}{keywords}{Kľúčové slová} \GetTranslationFor{slovak}{keywords} \selectlanguage{english} \GetTranslation{keywords} ```
## Handling Bibliography * BibTex/BibLaTeX/Biber * iso-690 positive * http://www.ottobib.com/
## Dedicated to Pavel Stříž
## Questions?
![qr code](https://api.qrserver.com/v1/create-qr-code/?data=https://bit.ly/2yYoDrA&size=300x300) (**https://bit.ly/2yYoDrA**)