Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding pandoc template #4

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added pandoc-template/article.pdf
Binary file not shown.
28 changes: 28 additions & 0 deletions pandoc-template/article.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
title: "This is a test"
author: "Joshua F. Allen"
date: "`r format(Sys.time(), '%F')`"
format:
#docx:
#reference-doc: reference.docx
pdf:
template: template.tex
toc: false
bibliography: ref/ref.bib
fontsize: 12pt
mainfont: Lato
link-citations: yes
linkcolor: dark-maroon
urlcolor: dark-maroon
indent: true
geometry: margin=2cm
reference-section-title: References
---
# Section
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum @angristMostlyHarmlessEconometrics2009.

# Empirical Section

## Identification Strategy

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum [@acemogluColonialOriginsComparative2001]
360 changes: 360 additions & 0 deletions pandoc-template/template.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,360 @@
\documentclass[a4paper]{article}

% Margins ----------------------------------------------------------------------

\usepackage[margin=1.25in]{geometry}

% AMS --------------------------------------------------------------------------

\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amsthm}
\usepackage{setspace}



% Line Spacing -----------------------------------------------------------------

\renewcommand{\baselinestretch}{1.5}


% Font -------------------------------------------------------------------------
\usepackage[T1]{fontenc}
\usepackage[default]{lato}


%\usepackage{cochineal}
%\usepackage[T1]{fontenc}

% Small adjustments to text kerning
\usepackage{microtype}

% Remove annoying over-full box warnings
\vfuzz2pt
\hfuzz2pt


% Tikz support -----------------------------------------------------------------

\usepackage{tikz}
\usetikzlibrary{patterns}


% Color Palette ----------------------------------------------------------------

\usepackage{xcolor}

% https://www.materialpalette.com/colors
\definecolor{dark-maroon}{HTML}{5D0F0D}
\definecolor{navyblue}{HTML}{0A3044}

% https://www.viget.com/articles/color-contrast/
\definecolor{purple}{HTML}{5601A4}
\definecolor{navy}{HTML}{0D3D56}
\definecolor{ruby}{HTML}{9a2515}
\definecolor{alice}{HTML}{107895}
\definecolor{daisy}{HTML}{EBC944}
\definecolor{coral}{HTML}{F26D21}
\definecolor{kelly}{HTML}{829356}
\definecolor{cranberry}{HTML}{E64173}
\definecolor{jet}{HTML}{131516}
\definecolor{asher}{HTML}{555F61}
\definecolor{slate}{HTML}{314F4F}


% Hyperlinks -------------------------------------------------------------------

\usepackage{hyperref}
\hypersetup{
colorlinks= true,
citecolor= dark-maroon,
linkcolor= dark-maroon,
filecolor= dark-maroon,
urlcolor= dark-maroon,
}


% Citations --------------------------------------------------------------------

% note, natbib provides better hyperlinking
\usepackage{natbib}
\bibliographystyle{apsr}
\bibpunct{(}{)}{;}{a}{}{;}

% Epigraphs
% Epigraphs
$if(epigraph)$
\usepackage{epigraph}
\renewcommand{\epigraphsize}{\footnotesize}
\setlength{\epigraphrule}{0pt}
$endif$


% Define Theorems --------------------------------------------------------------

% Put proper spacing after Theorem #.
\newtheoremstyle{spacing}
{}% Space above, empty = `usual value'
{}% Space below
{}% Body font
{}% Indent amount (empty = no indent, \parindent = para indent)
{\bfseries\color{navyblue}}% Thm head font
{.}% Punctuation after thm head
{2.5mm}% Space after thm head: \newline = linebreak
{}% Thm head spec

% note, theorem is the name that goes in \begin{} and Theorem is the name displayed as Theorem 1
\theoremstyle{spacing}
\newtheorem{theorem}{Theorem}
\newtheorem{proposition}{Proposition}
\newtheorem{assumption}{Assumption}
\newtheorem{example}{Example}


% Custom Math Definitions ------------------------------------------------------

\newcommand{\expec}[1]{\mathbb{E}\left[#1\right]}%
\newcommand{\condexpec}[2]{\mathbb{E}\left[#1 \ \vert \ #2\right]}%
\newcommand{\prob}[1]{\mathbb{P}\left[#1\right]}%
\newcommand{\var}[1]{\mathrm{Var}\left[#1\right]}%
\newcommand{\cov}[1]{\mathrm{Cov}\left[#1\right]}%
\newcommand{\one}{\mathbf{1}}


% Titlepage --------------------------------------------------------------------

% \maketitle
\usepackage{titling}
\usepackage{setspace}

% title
\pretitle{\begin{spacing}{1}\begin{flushleft}\huge}
\posttitle{\end{flushleft}\end{spacing}\vspace{-5mm}}

% author, note don't use \and
\preauthor{\begin{flushleft}\large}
\postauthor{\end{flushleft}\vspace{-7.5mm}}

% date
\predate{\begin{flushleft}\scshape\color{asher}}
\postdate{\end{flushleft}\vspace{-5mm}}

% Abstract
\renewenvironment{abstract}
{\noindent\rule{\linewidth}{.5pt}\noindent}
{\noindent\rule{\linewidth}{.5pt}}

% alternative abstract
% \renewenvironment{abstract}
% {
% \centerline {\large \bfseries \scshape \color{navyblue} Abstract}
% \begin{quote}
% }
% {\end{quote}}

%% Pandoc stuff

% Pandoc tightlists
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}

$if(highlighting-macros)$
$highlighting-macros$
$endif$

\newlength{\cslhangindent}
\setlength{\cslhangindent}{1.5em}
\newenvironment{CSLReferences}%
{\setlength{\parindent}{0pt}%
\everypar{\setlength{\hangindent}{\cslhangindent}}\ignorespaces}%
{\par}

% Section and Subsection Styling -----------------------------------------------

\usepackage[explicit]{titlesec}

\titleformat{\section}
{\Large \bf \color{navyblue}}
{\thesection \,---}
{0.25em}
{#1}

\titleformat{\subsection}
{\fontsize{11}{10}\it}
{\thesubsection.}
{1em}
{#1}


% Footnote ---------------------------------------------------------------------
\usepackage[bottom, flushmargin]{footmisc}
\renewcommand*{\footnotelayout}{\footnotesize}





% Enumerate/Itemize ------------------------------------------------------------

\usepackage{enumitem}
\setitemize{labelindent=0.5em,labelsep=0.25cm,leftmargin=*}
\setenumerate{labelindent=0.5em,labelsep=0.25cm,leftmargin=*}


% Table and Figure labelling ---------------------------------------------------

\usepackage{caption}

\DeclareCaptionLabelSeparator{threedash}{\,---\,}
\DeclareCaptionFont{navyblue}{\color{navyblue}}
\DeclareCaptionFont{jet}{\color{jet}}
\captionsetup[table]{format=plain, labelsep=threedash, font={navyblue, bf}}
\captionsetup[figure]{format=plain, labelsep=threedash, font={navyblue, bf}}

% Alternative: Left align captions
% \captionsetup[table]{labelfont=it, textfont={navyblue, bf}, labelsep=newline, justification=raggedright, singlelinecheck=off}
% \captionsetup[figure]{labelfont=it, textfont={navyblue, bf}, labelsep=newline, justification=raggedright, singlelinecheck=off}

% multifigure with \caption
% \begin{subfigure}\caption{} \end{subfigure}
\usepackage{subcaption}
\captionsetup[subfigure]{format=plain, font={jet, footnotesize, bf}}


% Tables -----------------------------------------------------------------------

% Fix \input with tables
% \input fails when \\ is at end of external .tex file

% --------
% TABLES
% --------
\usepackage{booktabs}
\usepackage{longtable}
\usepackage{pbox} % For multi-line table cells

% Things that kableExtra needs
\usepackage{array}
\usepackage{multirow}
\usepackage{wrapfig}
\usepackage{float}
\floatplacement{figure}{H}
\usepackage{colortbl}
\usepackage{tabu}
\usepackage{threeparttable}
\usepackage{threeparttablex}
\usepackage[normalem]{ulem}
\usepackage{makecell}

% Make table text slightly smaller, but not captions
\usepackage[font=normalsize]{caption}
\AtBeginEnvironment{longtable}{\footnotesize}
\AtBeginEnvironment{tabular}{\footnotesize}

% Remove left margin in lists inside longtables
% https://tex.stackexchange.com/a/378190/11851
\AtBeginEnvironment{longtable}{\setlist[itemize]{nosep, wide=0pt, leftmargin=*, before=\vspace*{-\baselineskip}, after=\vspace*{-\baselineskip}}}


% ----------
% GRAPHICS
% ----------
\usepackage{graphicx}
\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}
\usepackage{pdflscape}

% For landscape, fix page number location
\usepackage{fancyhdr}
\fancypagestyle{lscaped}{%
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\textnormal
\fancyfoot{%
\tikz[remember picture,overlay]
\node[outer sep=2.5cm,above,rotate=90] at (current page.east) {\thepage};
}
}




$if(title)$
\title{ \LARGE\textbf{$title$}}
$endif$


\author{$for(author)$$author$$if(thanks)$\thanks{$thanks$} $endif$ $sep$\\$endfor$}

$if(date)$
\date{$date$}
$endif$

$for(header-includes)$
$header-includes$
$endfor$

\begin{document}

$if(title)$
\maketitle
$endif$

$if(epigraph)$
$for(epigraph)$
$if(epigraph.source)$
\epigraph{$epigraph.text$}{---$epigraph.source$}
$else$
\epigraph{$epigraph.text$}
$endif$
$endfor$
$endif$
$if(toc)$
{
\setcounter{tocdepth}{$toc-depth$}
\tableofcontents
}
$endif$

$if(abstract)$

\begin{abstract}

\noindent $abstract$

\end{abstract}

$endif$

\doublespacing

$body$

$if(natbib)$
$if(biblio-files)$
$if(biblio-title)$
$if(book-class)$
\renewcommand\bibname{Bibliography}
$else$
\renewcommand\refname{References}
$endif$
$endif$
\bibliography{$biblio-files$}

$endif$
$endif$
$if(biblatex)$
\printbibliography$if(biblio-title)$[title=References]$endif$

$endif$
$for(include-after)$
$include-after$

$endfor$
\end{document}