Skip to content

Commit

Permalink
feat: Merge changes from pandoc 3.5 LaTeX template
Browse files Browse the repository at this point in the history
  • Loading branch information
Wandmalfarbe committed Dec 29, 2024
1 parent 24a8c00 commit d6de198
Show file tree
Hide file tree
Showing 48 changed files with 1,275 additions and 1,175 deletions.
1,156 changes: 0 additions & 1,156 deletions eisvogel.tex

This file was deleted.

2 changes: 1 addition & 1 deletion examples/basic-example/build.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pandoc "document.md" -o "document.pdf" --from markdown --template "../../eisvogel.tex" --listings
pandoc "document.md" -o "document.pdf" --from markdown --template "../../template/eisvogel.latex" --listings
Binary file modified examples/basic-example/document.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion examples/beamer/build.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pandoc "document.md" -o "document.pdf" --from markdown --to beamer --template "../../eisvogel.tex" --listings
pandoc "document.md" -o "document.pdf" --from markdown --to beamer --template "../../template/default.beamer" --listings
Binary file modified examples/beamer/document.pdf
Binary file not shown.
Binary file modified examples/beamer/preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion examples/book/build.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pandoc "document.md" -o "document.pdf" --from markdown --template "../../eisvogel.tex" --listings --top-level-division="chapter"
pandoc "document.md" -o "document.pdf" --from markdown --template "../../template/eisvogel.latex" --listings --top-level-division="chapter"
Binary file modified examples/book/document.pdf
Binary file not shown.
Binary file modified examples/book/preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pandoc "document.md" -o "document.pdf" --from markdown --template "../../eisvogel.tex" --filter pandoc-latex-environment --listings
pandoc "document.md" -o "document.pdf" --from markdown --template "../../template/eisvogel.latex" --filter pandoc-latex-environment --listings
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pandoc "document.md" -o "document.pdf" --from markdown --template "../../eisvogel.tex" --filter pandoc-latex-environment --listings
pandoc "document.md" -o "document.pdf" --from markdown --template "../../template/eisvogel.latex" --filter pandoc-latex-environment --listings
Binary file not shown.
2 changes: 1 addition & 1 deletion examples/code-blocks-listings/build.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pandoc "document.md" -o "document.pdf" --from markdown --template "../../eisvogel.tex" --listings
pandoc "document.md" -o "document.pdf" --from markdown --template "../../template/eisvogel.latex" --listings
Binary file modified examples/code-blocks-listings/document.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion examples/code-blocks-without-listings/build.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pandoc "document.md" -o "document.pdf" --from markdown --template "../../eisvogel.tex" --highlight-style kate
pandoc "document.md" -o "document.pdf" --from markdown --template "../../template/eisvogel.latex" --highlight-style kate
Binary file modified examples/code-blocks-without-listings/document.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion examples/header-and-footer/build.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pandoc "document.md" -o "document.pdf" --from markdown --template "../../eisvogel.tex" --listings
pandoc "document.md" -o "document.pdf" --from markdown --template "../../template/eisvogel.latex" --listings
Binary file modified examples/header-and-footer/document.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion examples/images-and-tables/build.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pandoc "document.md" -o "document.pdf" --from markdown --template "../../eisvogel.tex" --listings
pandoc "document.md" -o "document.pdf" --from markdown --template "../../template/eisvogel.latex" --listings
Binary file modified examples/images-and-tables/document.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion examples/language-chinese/build.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# No lang option (-V lang=zh) here because Chinese is unsupported in polyglossia and babel.
pandoc "document.md" -o "document.pdf" --from markdown --template "../../eisvogel.tex" --listings --pdf-engine "xelatex" -V CJKmainfont="HiraginoSans-W4"
pandoc "document.md" -o "document.pdf" --from markdown --template "../../template/eisvogel.latex" --listings --pdf-engine "xelatex" -V CJKmainfont="HiraginoSans-W4"
2 changes: 1 addition & 1 deletion examples/language-german/build.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pandoc "document.md" -o "document.pdf" --from markdown --template "../../eisvogel.tex" --listings
pandoc "document.md" -o "document.pdf" --from markdown --template "../../template/eisvogel.latex" --listings
Binary file modified examples/language-german/document.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion examples/language-japanese/build.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# No lang option (-V lang=jp) here because Japanese unsupported in polyglossia.
pandoc "document.md" -o "document.pdf" --from markdown --template "../../eisvogel.tex" --listings --pdf-engine "xelatex" -V CJKmainfont="HiraginoSans-W4"
pandoc "document.md" -o "document.pdf" --from markdown --template "../../template/eisvogel.latex" --listings --pdf-engine "xelatex" -V CJKmainfont="HiraginoSans-W4"
2 changes: 1 addition & 1 deletion examples/page-background/build.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pandoc "document.md" -o "document.pdf" --from markdown --template "../../eisvogel.tex" --listings
pandoc "document.md" -o "document.pdf" --from markdown --template "../../template/eisvogel.latex" --listings
Binary file modified examples/page-background/document.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion examples/table-of-contents/build.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pandoc "document.md" -o "document.pdf" --from markdown --template "../../eisvogel.tex"
pandoc "document.md" -o "document.pdf" --from markdown --template "../../template/eisvogel.latex"
Binary file modified examples/table-of-contents/document.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion examples/title-page-background/build.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pandoc "document.md" -o "document.pdf" --from markdown --template "../../eisvogel.tex" --listings
pandoc "document.md" -o "document.pdf" --from markdown --template "../../template/eisvogel.latex" --listings
Binary file modified examples/title-page-background/document.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion examples/title-page-custom/build.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pandoc "document.md" -o "document.pdf" --from markdown --template "../../eisvogel.tex" --listings
pandoc "document.md" -o "document.pdf" --from markdown --template "../../template/eisvogel.latex" --listings
Binary file modified examples/title-page-custom/document.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion examples/title-page-default/build.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pandoc "document.md" -o "document.pdf" --from markdown --template "../../eisvogel.tex" --listings
pandoc "document.md" -o "document.pdf" --from markdown --template "../../template/eisvogel.latex" --listings
Binary file modified examples/title-page-default/document.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion examples/title-page-green/build.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pandoc "document.md" -o "document.pdf" --from markdown --template "../../eisvogel.tex" --listings
pandoc "document.md" -o "document.pdf" --from markdown --template "../../template/eisvogel.latex" --listings
Binary file modified examples/title-page-green/document.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion examples/title-page-logo/build.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pandoc "document.md" -o "document.pdf" --from markdown --template "../../eisvogel.tex" --listings
pandoc "document.md" -o "document.pdf" --from markdown --template "../../template/eisvogel.latex" --listings
Binary file modified examples/title-page-logo/document.pdf
Binary file not shown.
10 changes: 10 additions & 0 deletions template/after-header-includes.latex
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
\usepackage{bookmark}
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
\urlstyle{$if(urlstyle)$$urlstyle$$else$same$endif$}
$if(links-as-notes)$
% Make links footnotes instead of hotlinks:
\DeclareRobustCommand{\href}[2]{#2\footnote{\url{#1}}}
$endif$
$if(verbatim-in-note)$
\VerbatimFootnotes % allow verbatim text in footnotes
$endif$
307 changes: 307 additions & 0 deletions template/common.latex
Original file line number Diff line number Diff line change
@@ -0,0 +1,307 @@
$if(linestretch)$
\usepackage{setspace}
$else$
% Use setspace anyway because we change the default line spacing.
% The spacing is changed early to affect the titlepage and the TOC.
\usepackage{setspace}
\setstretch{1.2}
$endif$

$--
$-- paragraph formatting
$--
$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(beamer)$
$else$
$if(block-headings)$
% Make \paragraph and \subparagraph free-standing
\makeatletter
\ifx\paragraph\undefined\else
\let\oldparagraph\paragraph
\renewcommand{\paragraph}{
\@ifstar
\xxxParagraphStar
\xxxParagraphNoStar
}
\newcommand{\xxxParagraphStar}[1]{\oldparagraph*{#1}\mbox{}}
\newcommand{\xxxParagraphNoStar}[1]{\oldparagraph{#1}\mbox{}}
\fi
\ifx\subparagraph\undefined\else
\let\oldsubparagraph\subparagraph
\renewcommand{\subparagraph}{
\@ifstar
\xxxSubParagraphStar
\xxxSubParagraphNoStar
}
\newcommand{\xxxSubParagraphStar}[1]{\oldsubparagraph*{#1}\mbox{}}
\newcommand{\xxxSubParagraphNoStar}[1]{\oldsubparagraph{#1}\mbox{}}
\fi
\makeatother
$endif$
$endif$

$--
$-- verbatim in notes
$--
$if(verbatim-in-note)$
\usepackage{fancyvrb}
$endif$

$-- highlighting
$if(listings)$
\usepackage{listings}
\newcommand{\passthrough}[1]{#1}
\lstset{defaultdialect=[5.3]Lua}
\lstset{defaultdialect=[x86masm]Assembler}
$endif$
$if(listings-no-page-break)$
\usepackage{etoolbox}
\BeforeBeginEnvironment{lstlisting}{\par\noindent\begin{minipage}{\linewidth}}
\AfterEndEnvironment{lstlisting}{\end{minipage}\par\addvspace{\topskip}}
$endif$
$if(lhs)$
\lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{}
$endif$
$if(highlighting-macros)$
$highlighting-macros$

% Workaround/bugfix from jannick0.
% See https://github.com/jgm/pandoc/issues/4302#issuecomment-360669013)
% or https://github.com/Wandmalfarbe/pandoc-latex-template/issues/2
%
% Redefine the verbatim environment 'Highlighting' to break long lines (with
% the help of fvextra). Redefinition is necessary because it is unlikely that
% pandoc includes fvextra in the default template.
\usepackage{fvextra}
\DefineVerbatimEnvironment{Highlighting}{Verbatim}{breaklines,fontsize=$if(code-block-font-size)$$code-block-font-size$$else$\small$endif$,commandchars=\\\{\}}

$endif$

$--
$-- tables
$--
$if(tables)$
\usepackage{longtable,booktabs,array}
$if(multirow)$
\usepackage{multirow}
$endif$
\usepackage{calc} % for calculating minipage widths
$if(beamer)$
\usepackage{caption}
% Make caption package work with longtable
\makeatletter
\def\fnum@table{\tablename~\thetable}
\makeatother
$else$
% 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$
$endif$

$--
$-- graphics
$--
$if(graphics)$
\usepackage{graphicx}
\makeatletter
\newsavebox\pandoc@box
\newcommand*\pandocbounded[1]{% scales image to fit in text height/width
\sbox\pandoc@box{#1}%
\Gscale@div\@tempa{\textheight}{\dimexpr\ht\pandoc@box+\dp\pandoc@box\relax}%
\Gscale@div\@tempb{\linewidth}{\wd\pandoc@box}%
\ifdim\@tempb\p@<\@tempa\p@\let\@tempa\@tempb\fi% select the smaller of both
\ifdim\@tempa\p@<\p@\scalebox{\@tempa}{\usebox\pandoc@box}%
\else\usebox{\pandoc@box}%
\fi%
}
% Set default figure placement to htbp
% Make use of float-package and set default placement for figures to H.
% The option H means 'PUT IT HERE' (as opposed to the standard h option which means 'You may put it here if you like').
\usepackage{float}
\floatplacement{figure}{$if(float-placement-figure)$$float-placement-figure$$else$H$endif$}
\makeatother
$endif$
$if(svg)$
\usepackage{svg}
$endif$

$--
$-- strikeout/underline
$--
$if(strikeout)$
\ifLuaTeX
\usepackage{luacolor}
\usepackage[soul]{lua-ul}
\else
\usepackage{soul}
$if(beamer)$
\makeatletter
\let\HL\hl
\renewcommand\hl{% fix for beamer highlighting
\let\set@color\beamerorig@set@color
\let\reset@color\beamerorig@reset@color
\HL}
\makeatother
$endif$
$if(CJKmainfont)$
\ifXeTeX
% soul's \st doesn't work for CJK:
\usepackage{xeCJKfntef}
\renewcommand{\st}[1]{\sout{#1}}
\fi
$endif$
\fi
$endif$

$--
$-- CSL citations
$--
$if(csl-refs)$
% definitions for citeproc citations
\NewDocumentCommand\citeproctext{}{}
\NewDocumentCommand\citeproc{mm}{%
\begingroup\def\citeproctext{#2}\cite{#1}\endgroup}
\makeatletter
% allow citations to break across lines
\let\@cite@ofmt\@firstofone
% avoid brackets around text for \cite:
\def\@biblabel#1{}
\def\@cite#1#2{{#1\if@tempswa , #2\fi}}
\makeatother
\newlength{\cslhangindent}
\setlength{\cslhangindent}{1.5em}
\newlength{\csllabelwidth}
\setlength{\csllabelwidth}{3em}
\newenvironment{CSLReferences}[2] % #1 hanging-indent, #2 entry-spacing
{\begin{list}{}{%
\setlength{\itemindent}{0pt}
\setlength{\leftmargin}{0pt}
\setlength{\parsep}{0pt}
% turn on hanging indent if param 1 is 1
\ifodd #1
\setlength{\leftmargin}{\cslhangindent}
\setlength{\itemindent}{-1\cslhangindent}
\fi
% set entry spacing
\setlength{\itemsep}{#2\baselineskip}}}
{\end{list}}
\usepackage{calc}
\newcommand{\CSLBlock}[1]{\hfill\break\parbox[t]{\linewidth}{\strut\ignorespaces#1\strut}}
\newcommand{\CSLLeftMargin}[1]{\parbox[t]{\csllabelwidth}{\strut#1\strut}}
\newcommand{\CSLRightInline}[1]{\parbox[t]{\linewidth - \csllabelwidth}{\strut#1\strut}}
\newcommand{\CSLIndent}[1]{\hspace{\cslhangindent}#1}
$endif$

$--
$-- Babel language support
$--
$if(lang)$
\ifLuaTeX
\usepackage[bidi=basic]{babel}
\else
\usepackage[bidi=default]{babel}
\fi
$if(babel-lang)$
\babelprovide[main,import]{$babel-lang$}
$if(mainfont)$
\ifPDFTeX
\else
\babelfont{rm}[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$$if(mainfontfallback)$,RawFeature={fallback=mainfontfallback}$endif$]{$mainfont$}
\fi
$endif$
$endif$
$for(babel-otherlangs)$
\babelprovide[import]{$babel-otherlangs$}
$endfor$
$for(babelfonts/pairs)$
\babelfont[$babelfonts.key$]{rm}{$babelfonts.value$}
$endfor$
% get rid of language-specific shorthands (see #6817):
\let\LanguageShortHands\languageshorthands
\def\languageshorthands#1{}
$if(selnolig-langs)$
\ifLuaTeX
\usepackage[$for(selnolig-langs)$$it$$sep$,$endfor$]{selnolig} % disable illegal ligatures
\fi
$endif$
$endif$

$--
$-- pagestyle
$--
$if(pagestyle)$
\pagestyle{$pagestyle$}
$endif$

$--
$-- prevent overfull lines
$--
\setlength{\emergencystretch}{3em} % prevent overfull lines

$--
$-- tight lists
$--
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}

$--
$-- subfigure support
$--
$if(subfigure)$
\usepackage{subcaption}
$endif$

$--
$-- text direction support for pdftex
$--
$if(dir)$
\ifPDFTeX
\TeXXeTstate=1
\newcommand{\RL}[1]{\beginR #1\endR}
\newcommand{\LR}[1]{\beginL #1\endL}
\newenvironment{RTL}{\beginR}{\endR}
\newenvironment{LTR}{\beginL}{\endL}
\fi
$endif$

$--
$-- bibliography support support for natbib and biblatex
$--
$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(nocite-ids)$
\nocite{$for(nocite-ids)$$it$$sep$, $endfor$}
$endif$

$--
$-- csquotes
$--
$if(csquotes)$
\usepackage{csquotes}
$endif$
Loading

0 comments on commit d6de198

Please sign in to comment.