From 6853f541261227cd0c93b345036474fa3b3141b7 Mon Sep 17 00:00:00 2001
From: Ekaitz Zarraga <ekaitz@elenq.tech>
Date: Thu, 5 Dec 2019 21:20:03 +0100
Subject: Clean templates:

    - Make listings force monochrome highlighting
    - Make 80-line code fit in width
    - Fix polyglossia language issues
---
 pandoc/templates/elenq-article.latex | 67 ++++++++++++++++++++++++++++++------
 1 file changed, 56 insertions(+), 11 deletions(-)

(limited to 'pandoc/templates/elenq-article.latex')

diff --git a/pandoc/templates/elenq-article.latex b/pandoc/templates/elenq-article.latex
index c6d88b4..fdeab1d 100644
--- a/pandoc/templates/elenq-article.latex
+++ b/pandoc/templates/elenq-article.latex
@@ -18,7 +18,9 @@
 %
 % Expects some metadata to be set:
 %
-%   lang: english | spanish | basque | ...
+%   polyglossia-lang:
+%       name: english | spanish | basque | ...
+%   lang: en-US | es-ES | ...
 %   title: The title of the document
 %   subtitle: The subtitle of the article
 %   author: Author's name
@@ -31,7 +33,10 @@
 %
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-\documentclass[a4paper,11pt]{$documentclass$}
+\documentclass[a4paper,11pt
+$if(lang)$
+  $babel-lang$,
+$endif$]{$documentclass$}
 \usepackage{tikz}
 \newcommand{\logo}[1]{
   \begin{tikzpicture}[y=0.80pt, x=0.80pt, yscale=-{#1}, xscale={#1}, inner sep=0pt, outer sep=0pt]
@@ -149,10 +154,13 @@
 \end{tikzpicture}
 }
 
-% Language control from Metadata
 $if(lang)$
-\usepackage{polyglossia}
-\setmainlanguage{$lang$}
+  % Load polyglossia as late as possible: uses bidi with RTL langages (e.g. Hebrew, Arabic)
+  \usepackage{polyglossia}
+  \setmainlanguage[$polyglossia-lang.options$]{$polyglossia-lang.name$}
+  $for(polyglossia-otherlangs)$
+    \setotherlanguage[$polyglossia-otherlangs.options$]{$polyglossia-otherlangs.name$}
+  $endfor$
 $endif$
 
 % No indent
@@ -166,9 +174,6 @@ $endif$
             headheight=30pt,
             includeheadfoot=true]{geometry}
 
-% Color
-\usepackage{xcolor}
-
 % Spacing
 \usepackage{setspace}
 
@@ -194,6 +199,9 @@ $endif$
 $if(author-meta)$
             pdfauthor={$author-meta$},
 $endif$
+$if(lang)$
+            pdflang={$lang$},
+$endif$
 $if(keywords)$
             pdfkeywords={$for(keywords)$$keywords$$sep$; $endfor$},
 $endif$
@@ -219,9 +227,46 @@ $if(verbatim-in-note)$
 $endif$
 
 % Syntax highlight
-$if(highlighting-macros)$
-$highlighting-macros$
-$endif$
+\usepackage{color}
+\usepackage{fancyvrb}
+\newcommand{\VerbBar}{|}
+\newcommand{\VERB}{\Verb[commandchars=\\\{\}]}
+\DefineVerbatimEnvironment{Highlighting}{Verbatim}{
+  commandchars=\\\{\},
+  fontsize=\footnotesize}
+\newenvironment{Shaded}{}{}
+\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}}
+
 
 % Multiple page tables if needed
 $if(tables)$
-- 
cgit v1.2.3

