From 5ef1683eea487464119a6851616d919679a8f9c9 Mon Sep 17 00:00:00 2001 From: norangebit Date: Fri, 25 Sep 2020 11:47:54 +0200 Subject: [PATCH] LaTeKiSS 1.1 - No more need of manual compiling - Based on default pandoc template - Added more options for acronyms - Support to pandoc-citeproc for the bibliography - Remove unused bookmarks --- latekiss.tex | 476 ++++++++++++++++++++++++++++++++++----------------- 1 file changed, 317 insertions(+), 159 deletions(-) diff --git a/latekiss.tex b/latekiss.tex index e64cc88..877cd7a 100644 --- a/latekiss.tex +++ b/latekiss.tex @@ -1,4 +1,28 @@ +% Options for packages loaded elsewhere +\PassOptionsToPackage{unicode$for(hyperrefoptions)$,$hyperrefoptions$$endfor$}{hyperref} +\PassOptionsToPackage{hyphens}{url} +$if(colorlinks)$ +\PassOptionsToPackage{dvipsnames,svgnames*,x11names*}{xcolor} +$endif$ +$if(dir)$ +$if(latex-dir-rtl)$ +\PassOptionsToPackage{RTLdocument}{bidi} +$endif$ +$endif$ +$if(CJKmainfont)$ +\PassOptionsToPackage{space}{xeCJK} +$endif$ +% \documentclass[ +$if(fontsize)$ + $fontsize$, +$endif$ +$if(lang)$ + $babel-lang$, +$endif$ +$if(papersize)$ + $papersize$paper, +$endif$ $if(twoside)$ twoside, $endif$ @@ -13,52 +37,264 @@ headinclude, footinclude, cleardoublepage=empty, abstract=on, -$if(paper)$ -paper=$paper$, -$endif$ -$if(fontsize)$ -fontsize=$fontsize$ -$endif$ -BCOR=5mm -]{scrreprt} +BCOR=5mm, +dvipsnames, +$for(classoption)$ + $classoption$$sep$, +$endfor$ +]{scrreport} -$if(draf)$ -\newcommand{\myVersion}{$draf$} +$if(fontfamily)$ +\usepackage[$for(fontfamilyoptions)$$fontfamilyoptions$$sep$,$endfor$]{$fontfamily$} +$else$ +\usepackage{lmodern} $endif$ - -%******************************************************* -\usepackage[T1]{fontenc} -\usepackage[utf8]{inputenc} +$if(linestretch)$ +\usepackage{setspace} +$endif$ +\usepackage{amssymb,amsmath} +\usepackage{ifxetex,ifluatex} +\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex + \usepackage[$if(fontenc)$$fontenc$$else$T1$endif$]{fontenc} + \usepackage[utf8]{inputenc} + \usepackage{textcomp} % provide euro and other symbols +\else % if luatex or xetex +$if(mathspec)$ + \ifxetex + \usepackage{mathspec} + \else + \usepackage{unicode-math} + \fi +$else$ + \usepackage{unicode-math} +$endif$ + \defaultfontfeatures{Scale=MatchLowercase} + \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1} +$if(mainfont)$ + \setmainfont[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$]{$mainfont$} +$endif$ +$if(sansfont)$ + \setsansfont[$for(sansfontoptions)$$sansfontoptions$$sep$,$endfor$]{$sansfont$} +$endif$ +$if(monofont)$ + \setmonofont[$for(monofontoptions)$$monofontoptions$$sep$,$endfor$]{$monofont$} +$endif$ +$for(fontfamilies)$ + \newfontfamily{$fontfamilies.name$}[$for(fontfamilies.options)$$fontfamilies.options$$sep$,$endfor$]{$fontfamilies.font$} +$endfor$ +$if(mathfont)$ +$if(mathspec)$ + \ifxetex + \setmathfont(Digits,Latin,Greek)[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$} + \else + \setmathfont[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$} + \fi +$else$ + \setmathfont[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$} +$endif$ +$endif$ +$if(CJKmainfont)$ + \ifxetex + \usepackage{xeCJK} + \setCJKmainfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmainfont$} + \fi +$endif$ +$if(luatexjapresetoptions)$ + \ifluatex + \usepackage[$for(luatexjapresetoptions)$$luatexjapresetoptions$$sep$,$endfor$]{luatexja-preset} + \fi +$endif$ +$if(CJKmainfont)$ + \ifluatex + \usepackage[$for(luatexjafontspecoptions)$$luatexjafontspecoptions$$sep$,$endfor$]{luatexja-fontspec} + \setmainjfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmainfont$} + \fi +$endif$ +\fi +% Use upquote if available, for straight quotes in verbatim environments +\IfFileExists{upquote.sty}{\usepackage{upquote}}{} +\IfFileExists{microtype.sty}{% use microtype if available + \usepackage[$for(microtypeoptions)$$microtypeoptions$$sep$,$endfor$]{microtype} + \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts +}{} +$if(indent)$ +$else$ +\makeatletter +\@ifundefined{KOMAClassName}{% if non-KOMA class + \IfFileExists{parskip.sty}{% + \usepackage{parskip} + }{% else + \setlength{\parindent}{0pt} + \setlength{\parskip}{6pt plus 2pt minus 1pt}} +}{% if KOMA class + \KOMAoptions{parskip=half}} +\makeatother +$endif$ +$if(verbatim-in-note)$ +\usepackage{fancyvrb} +$endif$ +\usepackage{xcolor} +\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available +\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}} +\hypersetup{ +$if(title-meta)$ + pdftitle={$title-meta$}, +$endif$ +$if(author-meta)$ + pdfauthor={$author-meta$}, +$endif$ +$if(lang)$ + pdflang={$lang$}, +$endif$ +$if(subject)$ + pdfsubject={$subject$}, +$endif$ +$if(keywords)$ + pdfkeywords={$for(keywords)$$keywords$$sep$, $endfor$}, +$endif$ +$if(colorlinks)$ + colorlinks=true, + linkcolor=$if(linkcolor)$$linkcolor$$else$CTlink$endif$, + filecolor=$if(filecolor)$$filecolor$$else$Black$endif$, + citecolor=$if(citecolor)$$citecolor$$else$CTcitation$endif$, + urlcolor=$if(urlcolor)$$urlcolor$$else$CTurl$endif$, +$else$ + hidelinks, +$endif$ + pdfcreator={LaTeX via pandoc, ClassicThesis and LaTeKiSS}} +\urlstyle{same} % disable monospaced font for URLs +$if(verbatim-in-note)$ +\VerbatimFootnotes % allow verbatim text in footnotes +$endif$ +$if(geometry)$ +\usepackage[$for(geometry)$$geometry$$sep$,$endfor$]{geometry} +$endif$ +$if(listings)$ +\usepackage{listings} +\newcommand{\passthrough}[1]{#1} +\lstset{defaultdialect=[5.3]Lua} +\lstset{defaultdialect=[x86masm]Assembler} +$endif$ +$if(lhs)$ +\lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{} +$endif$ +$if(highlighting-macros)$ +$highlighting-macros$ +$endif$ +$if(tables)$ +\usepackage{longtable,booktabs} +% Correct order of tables after \paragraph or \subparagraph +\usepackage{etoolbox} +\makeatletter +\patchcmd\longtable{\par}{\if@noskipsec\mbox{}\fi\par}{}{} +\makeatother +% Allow footnotes in longtable head/foot +\IfFileExists{footnotehyper.sty}{\usepackage{footnotehyper}}{\usepackage{footnote}} +\makesavenoteenv{longtable} +$endif$ +$if(graphics)$ \usepackage{graphicx} -$if(babel)$ -\usepackage[$babel$]{babel} +\makeatletter +\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi} +\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi} +\makeatother +% Scale images if necessary, so that they will not overflow the page +% margins by default, and it is still possible to overwrite the defaults +% using explicit options in \includegraphics[width, height, ...]{} +\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio} +% Set default figure placement to htbp +\makeatletter +\def\fps@figure{htbp} +\makeatother $endif$ -$if(acronym)$ -\usepackage[$if(onlyused)$printonlyused, $endif$smaller]{acronym} +$if(links-as-notes)$ +% Make links footnotes instead of hotlinks: +\DeclareRobustCommand{\href}[2]{#2\footnote{\url{#1}}} $endif$ - -$if(bibliography)$ -\PassOptionsToPackage{% - %backend=biber,bibencoding=utf8, %instead of bibtex - backend=bibtex8,bibencoding=ascii,% - language=auto,% - style=numeric-comp,% - %style=authoryear-comp, % Author 1999, 2010 - %bibstyle=authoryear,dashed=false, % dashed: substitute rep. author with --- - sorting=nyt, % name, year, title - maxbibnames=10, % default: 3, et al. - %backref=true,% - natbib=true % natbib compatibility mode (\citep and \citet still work) -}{biblatex} -\usepackage{biblatex} - +$if(strikeout)$ +\usepackage[normalem]{ulem} +% Avoid problems with \sout in headers with hyperref +\pdfstringdefDisableCommands{\renewcommand{\sout}{}} +$endif$ +\setlength{\emergencystretch}{3em} % prevent overfull lines +\providecommand{\tightlist}{% + \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} +$if(numbersections)$ +\setcounter{secnumdepth}{$if(secnumdepth)$$secnumdepth$$else$5$endif$} +$else$ +\setcounter{secnumdepth}{-\maxdimen} % remove section numbering +$endif$ +$if(block-headings)$ +% Make \paragraph and \subparagraph free-standing +\ifx\paragraph\undefined\else + \let\oldparagraph\paragraph + \renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}} +\fi +\ifx\subparagraph\undefined\else + \let\oldsubparagraph\subparagraph + \renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}} +\fi +$endif$ +$if(pagestyle)$ +\pagestyle{$pagestyle$} +$endif$ +$for(header-includes)$ +$header-includes$ +$endfor$ +$if(lang)$ +\ifxetex + % Load polyglossia as late as possible: uses bidi with RTL langages (e.g. Hebrew, Arabic) + \usepackage{polyglossia} + \setmainlanguage[$for(polyglossia-lang.options)$$polyglossia-lang.options$$sep$,$endfor$]{$polyglossia-lang.name$} +$for(polyglossia-otherlangs)$ + \setotherlanguage[$for(polyglossia-otherlangs.options)$$polyglossia-otherlangs.options$$sep$,$endfor$]{$polyglossia-otherlangs.name$} +$endfor$ +\else + \usepackage[shorthands=off,$for(babel-otherlangs)$$babel-otherlangs$,$endfor$main=$babel-lang$]{babel} +$if(babel-newcommands)$ + $babel-newcommands$ +$endif$ +\fi +$endif$ +\ifluatex + \usepackage{selnolig} % disable illegal ligatures +\fi +$if(dir)$ +\ifxetex + % Load bidi as late as possible as it modifies e.g. graphicx + \usepackage{bidi} +\fi +\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex + \TeXXeTstate=1 + \newcommand{\RL}[1]{\beginR #1\endR} + \newcommand{\LR}[1]{\beginL #1\endL} + \newenvironment{RTL}{\beginR}{\endR} + \newenvironment{LTR}{\beginL}{\endL} +\fi +$endif$ +$if(natbib)$ +\usepackage[$natbiboptions$]{natbib} +\bibliographystyle{$if(biblio-style)$$biblio-style$$else$plainnat$endif$} +$endif$ +$if(biblatex)$ +\usepackage[$if(biblio-style)$style=$biblio-style$,$endif$$for(biblatexoptions)$$biblatexoptions$$sep$,$endfor$]{biblatex} +$for(bibliography)$ \addbibresource{$bibliography$} +$endfor$ +$endif$ +$if(csl-refs)$ +\newlength{\cslhangindent} +\setlength{\cslhangindent}{1.5em} +\newenvironment{cslreferences}% + {$if(csl-hanging-indent)$\setlength{\parindent}{0pt}% + \everypar{\setlength{\hangindent}{\cslhangindent}}\ignorespaces$endif$}% + {\par} $endif$ \PassOptionsToPackage{ - $if(draf)$ + $if(draf)$ drafting=true, - $endif$ + $endif$ $if(toc-aligned)$ tocaligned=$toc-aligned$, $endif$ @@ -83,110 +319,29 @@ $endif$ }{classicthesis} \usepackage{classicthesis} -\usepackage{hyperref} -\hypersetup{ - colorlinks=true, $if(hidelinks)$hidelinks$endif$, linktocpage=true, pdfstartpage=3, pdfstartview=FitV, - urlcolor=CTurl, linkcolor=CTlink, citecolor=CTcitation, - breaklinks=true, pageanchor=true, - pdfpagemode=UseNone, - plainpages=false, bookmarksnumbered, bookmarksopen=true, bookmarksopenlevel=1, - hypertexnames=true, pdfhighlight=/O, - $if(title)$ - pdftitle={$title$}, - $endif$ - $if(author)$ - pdfauthor={$author$}, - $endif$ - $if(subject)$ - pdfsubject={$subject$}, - $endif$ - pdfkeywords={$for(keywords)$$keywords$, $endfor$}, - pdfcreator={pandoc}, - pdfproducer={LaTeX with hyperref, latekiss and classicthesis} -} +\usepackage{graphicx} -\usepackage{longtable} - -% pandoc compatibility -\providecommand{\tightlist}{% - \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} - -\newcommand{\passthrough}[1]{#1} - -% pandoc highlight -\usepackage{color} -\usepackage{fancyvrb} -\newcommand{\VerbBar}{|} -\newcommand{\VERB}{\Verb[commandchars=\\\{\}]} -\DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}} -% Add ',fontsize=\small' for more characters per line -\newenvironment{Shaded}{}{} -$if(monochrome)$ -\newcommand{\AlertTok}[1]{\textbf{#1}} -\newcommand{\AnnotationTok}[1]{\textit{#1}} -\newcommand{\AttributeTok}[1]{#1} -\newcommand{\BaseNTok}[1]{#1} -\newcommand{\BuiltInTok}[1]{#1} -\newcommand{\CharTok}[1]{#1} -\newcommand{\CommentTok}[1]{\textit{#1}} -\newcommand{\CommentVarTok}[1]{\textit{#1}} -\newcommand{\ConstantTok}[1]{#1} -\newcommand{\ControlFlowTok}[1]{\textbf{#1}} -\newcommand{\DataTypeTok}[1]{\underline{#1}} -\newcommand{\DecValTok}[1]{#1} -\newcommand{\DocumentationTok}[1]{\textit{#1}} -\newcommand{\ErrorTok}[1]{\textbf{#1}} -\newcommand{\ExtensionTok}[1]{#1} -\newcommand{\FloatTok}[1]{#1} -\newcommand{\FunctionTok}[1]{#1} -\newcommand{\ImportTok}[1]{#1} -\newcommand{\InformationTok}[1]{\textit{#1}} -\newcommand{\KeywordTok}[1]{\textbf{#1}} -\newcommand{\NormalTok}[1]{#1} -\newcommand{\OperatorTok}[1]{#1} -\newcommand{\OtherTok}[1]{#1} -\newcommand{\PreprocessorTok}[1]{\textbf{#1}} -\newcommand{\RegionMarkerTok}[1]{#1} -\newcommand{\SpecialCharTok}[1]{#1} -\newcommand{\SpecialStringTok}[1]{#1} -\newcommand{\StringTok}[1]{#1} -\newcommand{\VariableTok}[1]{#1} -\newcommand{\VerbatimStringTok}[1]{#1} -\newcommand{\WarningTok}[1]{\textit{#1}} -$else$ -\newcommand{\AlertTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{#1}}} -\newcommand{\AnnotationTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{#1}}}} -\newcommand{\AttributeTok}[1]{\textcolor[rgb]{0.49,0.56,0.16}{#1}} -\newcommand{\BaseNTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{#1}} -\newcommand{\BuiltInTok}[1]{#1} -\newcommand{\CharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{#1}} -\newcommand{\CommentTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textit{#1}}} -\newcommand{\CommentVarTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{#1}}}} -\newcommand{\ConstantTok}[1]{\textcolor[rgb]{0.53,0.00,0.00}{#1}} -\newcommand{\ControlFlowTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{#1}}} -\newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.56,0.13,0.00}{#1}} -\newcommand{\DecValTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{#1}} -\newcommand{\DocumentationTok}[1]{\textcolor[rgb]{0.73,0.13,0.13}{\textit{#1}}} -\newcommand{\ErrorTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{#1}}} -\newcommand{\ExtensionTok}[1]{#1} -\newcommand{\FloatTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{#1}} -\newcommand{\FunctionTok}[1]{\textcolor[rgb]{0.02,0.16,0.49}{#1}} -\newcommand{\ImportTok}[1]{#1} -\newcommand{\InformationTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{#1}}}} -\newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{#1}}} -\newcommand{\NormalTok}[1]{#1} -\newcommand{\OperatorTok}[1]{\textcolor[rgb]{0.40,0.40,0.40}{#1}} -\newcommand{\OtherTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{#1}} -\newcommand{\PreprocessorTok}[1]{\textcolor[rgb]{0.74,0.48,0.00}{#1}} -\newcommand{\RegionMarkerTok}[1]{#1} -\newcommand{\SpecialCharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{#1}} -\newcommand{\SpecialStringTok}[1]{\textcolor[rgb]{0.73,0.40,0.53}{#1}} -\newcommand{\StringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{#1}} -\newcommand{\VariableTok}[1]{\textcolor[rgb]{0.10,0.09,0.49}{#1}} -\newcommand{\VerbatimStringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{#1}} -\newcommand{\WarningTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{#1}}}} +$if(acronym)$ +\PassOptionsToPackage{ +$if(ac-onlyused)$ +printonlyused, +$endif$ +$if(ac-smaller)$ +smaller, +$endif$ +$if(ac-footnote)$ +footnote, +$endif$ +$if(ac-nohyperlinks)$ +nohyperlinks, +$endif$ +$if(ac-withpage)$ +withpage, +$endif$ +}{acronym} + +\usepackage{acronym} $endif$ -%******************************************************* \begin{document} \pagenumbering{roman} @@ -200,7 +355,6 @@ $else$ \begin{addmargin}[-2.5cm]{-2cm} $endif$ \pagestyle{plain} -\pdfbookmark[1]{Il mio titolo}{titlepage} \begin{center} \Large @@ -268,9 +422,6 @@ $if(dedication)$ \cleardoublepage \thispagestyle{empty} \phantomsection -$if(dedication-title)$ -\pdfbookmark[1]{$dedication-title$}{$dedication-title$} -$endif$ \vspace*{3cm} \begin{flushright} \textit{$dedication$} @@ -296,10 +447,8 @@ $endif$ % Abstract $if(abstract)$ $if(abstract-title)$ -\pdfbookmark[1]{$abstract-title$}{$abstract-title$} \chapter*{$abstract-title$} $else$ -\pdfbookmark[1]{Abstract}{Abstract} \chapter*{Abstract} $endif$ %\begin{center} @@ -317,7 +466,6 @@ $if(toc-depth)$ \setcounter{tocdepth}{$toc-depth$} $endif$ \tableofcontents -\pdfbookmark[1]{\contentsname}{tableofcontents} $endif$ $if(lof)$ @@ -325,7 +473,6 @@ $if(lof-title)$ \renewcommand*\listfigurename{$lof-title$} $endif$ \listoffigures -\pdfbookmark[1]{\listfigurename}{lof} $endif$ $if(lot)$ @@ -333,24 +480,22 @@ $if(lot-title)$ \renewcommand*\listtablename{$lot-title$} $endif$ \listoftables -\pdfbookmark[1]{\listtablename}{lot} $endif$ $if(acronym)$ -$if(acronym-title)$ -\pdfbookmark[1]{$acronym-title$}{$acronym-title$} -\markboth{\spacedlowsmallcaps{$acronym-title$}}{\spacedlowsmallcaps{$acronym-title$}} -\chapter*{$acronym-title$} +\phantomsection +$if(ac-title)$ +\chapter*{$ac-title$} $else$ -\pdfbookmark[1]{Acronyms}{acronyms} -\markboth{\spacedlowsmallcaps{Acronyms}}{\spacedlowsmallcaps{Acronyms}} \chapter*{Acronyms} $endif$ -\begin{acronym}[UMLX] +\begin{NoHyper} +\begin{acronym}[TDMA] $for(acronym)$ -\acro{$acronym.name$}{$acronym.description$} +\acro{$acronym.short$}{$acronym.long$} $endfor$ \end{acronym} +\end{NoHyper} \cleardoublepage $endif$ %******************************************************* @@ -362,6 +507,23 @@ $endif$ $body$ +$if(natbib)$ +$if(bibliography)$ +$if(biblio-title)$ +$if(has-chapters)$ +\renewcommand\bibname{$biblio-title$} +$else$ +\renewcommand\refname{$biblio-title$} +$endif$ +$endif$ + \bibliography{$for(bibliography)$$bibliography$$sep$,$endfor$} + +$endif$ +$endif$ +$if(biblatex)$ +\printbibliography$if(biblio-title)$[title=$biblio-title$]$endif$ +$endif$ + $if(acknowledgments)$ $if(acknowledgments-title)$ \chapter*{$acknowledgments-title$} @@ -371,8 +533,4 @@ $endif$ $acknowledgments$ $endif$ -$if(bibliography)$ -\printbibliography[heading=bibintoc] -$endif$ - \end{document}