Skip to content

Instantly share code, notes, and snippets.

@mopa
Created March 24, 2018 18:11
Show Gist options
  • Save mopa/32438d07082895562633b6598b93051a to your computer and use it in GitHub Desktop.
Save mopa/32438d07082895562633b6598b93051a to your computer and use it in GitHub Desktop.
A Pandoc simple template for LaTeX output files
\documentclass[10pt,a4paper,twoside]{article}
%=====================================================
% FONTS
%=====================================================
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}
\usepackage{mathpazo}
\usepackage{microtype}
\usepackage{amsmath, amsthm, amssymb, bm, mathtools}
%=====================================================
% MARGINS
%=====================================================
\usepackage[%
left=2.5cm,%
right=2.5cm,%
top=2.5cm,%
bottom=2.5cm,%
letterpaper]{geometry}%
%=====================================================
% FANCYHDR
%=====================================================
\usepackage{fancyhdr}
\usepackage{tcolorbox}
\usepackage{color}
\definecolor{gray75}{RGB}{23,23,23}
\newtcbox{\boxpageRO}{%
arc=0pt,
outer arc=0pt,
colback=white,
colframe=gray75,
boxsep=0pt,
boxrule=0pt,
leftrule=1pt,
toprule=1pt,
bottomrule=0pt,
rightrule=0pt
}
\newtcbox{\boxpageLE}{%
arc=0pt,
outer arc=0pt,
colback=white,
colframe=gray75,
boxsep=0pt,
boxrule=0pt,
leftrule=0pt,
toprule=1pt,
bottomrule=0pt,
rightrule=1pt
}
\pagestyle{fancy}
\fancyhf{}
\fancyfoot[RO]{%
\boxpageRO{\textbf{\thepage}}}
\fancyfoot[LE]{%
\boxpageLE{\textbf{\thepage}}}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
%=====================================================
% INDENT
%=====================================================
$if(indent)$
$else$
\IfFileExists{parskip.sty}{%
\usepackage{parskip}
}{% else
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}
}
$endif$
%=====================================================
% HYPERREF
%=====================================================
$if(colorlinks)$
\usepackage{xcolor}
$endif$
\usepackage{hyperref}
\hypersetup{
$if(title-meta)$
pdftitle={$title-meta$},
$endif$
$if(author-meta)$
pdfauthor={$author-meta$},
$endif$
$if(keywords)$
pdfkeywords={$for(keywords)$$keywords$$sep$, $endfor$},
$endif$
$if(colorlinks)$
colorlinks=true,
linkcolor=$if(linkcolor)$$linkcolor$$else$Maroon$endif$,
citecolor=$if(citecolor)$$citecolor$$else$Blue$endif$,
urlcolor=$if(urlcolor)$$urlcolor$$else$Blue$endif$,
$else$
pdfborder={0 0 0},
$endif$
breaklinks=true}
\urlstyle{same} % don't use monospace font for urls
$if(verbatim-in-note)$
\VerbatimFootnotes % allows verbatim text in footnotes
$endif$
%=====================================================
% INSERT BEAUTY CODE
%=====================================================
$if(listings)$
\usepackage{listings}
\newcommand{\passthrough}[1]{#1}
$endif$
$if(lhs)$
\lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{}
$endif$
$if(highlighting-macros)$
$highlighting-macros$
$endif$
%=====================================================
% TABLES
%=====================================================
$if(tables)$
\usepackage{longtable,booktabs}
% Fix footnotes in tables (requires footnote package)
\IfFileExists{footnote.sty}{\usepackage{footnote}\makesavenoteenv{longtable}}{}
%%--- Rows space ---
\renewcommand{\arraystretch}{1.3}
%%--- Colums space ---
\setlength{\tabcolsep}{5pt}
$endif$
%=====================================================
% IMAGES
%=====================================================
$if(graphics)$
\usepackage{graphicx,grffile}
\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}
$endif$
%=====================================================
% OTHER OPTIONS
%=====================================================
$if(links-as-notes)$
% Make links footnotes instead of hotlinks:
\DeclareRobustCommand{\href}[2]{#2\footnote{\url{#1}}}
$endif$
$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}{0}
$endif$
$if(subparagraph)$
$else$
% Redefines (sub)paragraphs to behave more like sections
\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$
% set default figure placement to htbp
\makeatletter
\def\fps@figure{htbp}
\makeatother
%=====================================================
% BEGIN DOCUMENT
%=====================================================
\begin{document}
$body$
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment