Modify pandoc assignment template

This commit is contained in:
coolneng 2019-05-11 03:40:12 +02:00
parent 2747366f4e
commit b8670fbe17
3 changed files with 117 additions and 79 deletions

View File

@ -1,91 +1,130 @@
% !TEX TS-program = xelatex \documentclass[12pt]{article}
% !TEX encoding = UTF-8 Unicode
% ----------------- \usepackage[T1]{fontenc}
% START OF PREAMBLE \usepackage{amsmath}
% -----------------
\documentclass[12pt,a4paper]{scrartcl}
% Commands
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
% Packages
\usepackage{fontspec}
\usepackage{eurosym}
\usepackage{amssymb} \usepackage{amssymb}
\usepackage{mathtools} \usepackage[utf8]{inputenc}
\usepackage{upquote}
\usepackage{microtype} \usepackage{tikz}
\usepackage{longtable,booktabs}
\usepackage{graphicx} \usepackage{graphicx}
\usepackage{grffile}
\usepackage[normalem]{ulem}
\usepackage{fancyhdr}
\usepackage[setpagesize=false,
unicode=false,
colorlinks=true,
urlcolor=blue,
linkcolor=black]{hyperref}
\usepackage[scaled=.95]{helvet}
\usepackage{courier}
% Required fix for fancyhdr \usepackage{longtable}
\DeclareOldFontCommand{\rm}{\normalfont\rmfamily}{\mathrm} \usepackage{booktabs}
% Fancy headers and footers settings \providecommand{\tightlist}{%
\pagestyle{fancy} \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\lhead{$left-header$}
\rhead{$right-header$}
\usepackage[english]{babel}
% Required for syntax highlighting \usepackage{geometry}
$highlighting-macros$ \geometry{verbose,a4paper,tmargin=1.5cm,bmargin=1.5cm,lmargin=1.5cm,rmargin=1.5cm}
% Don't let images overflow the page
% Can still explicit set width/height/options for an image
\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
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
% Make links footnotes instead of hotlinks
\renewcommand{\href}[2]{#2\footnote{\url{#1}}}
% Avoid problems with \sout in headers with hyperref:
\pdfstringdefDisableCommands{\renewcommand{\sout}{}}
% No paragraph indentation
% and set space between paragraphs
\setlength{\parindent}{0pt} \setlength{\parindent}{0pt}
\setlength{\parskip}{1em plus 2pt minus 1pt} \setlength{\parskip}{6pt plus 2pt minus 1pt}
\setlength{\emergencystretch}{3em} % prevent overfull lines
\pagestyle{empty}
% No section numbering $if(verbatim-in-note)$
\usepackage{fancyvrb}
$endif$
$if(fancy-enums)$
% -- Redefine labelwidth for lists; otherwise, the enumerate package will cause
% -- markers to extend beyond the left margin.
\makeatletter\AtBeginDocument{%
\renewcommand{\@listi}
{\setlength{\labelwidth}{4em}}
}\makeatother
\usepackage{enumerate}
$endif$
$if(tables)$
\usepackage{array}
% -- This is needed because raggedright in table elements redefines \\:
\newcommand{\PreserveBackslash}[1]{\let\temp=\\#1\let\\=\temp}
\let\PBS=\PreserveBackslash
$endif$
% Redefine \includegraphics so that, unless explicit options are
% given, the image width will not exceed the width or the height of the page.
% Images get their normal width if they fit onto the page, but
% are scaled down if they would overflow the margins.
\makeatletter \makeatletter
\def\@seccntformat#1{% \def\ScaleWidthIfNeeded{%
\expandafter\ifx\csname c@#1\endcsname\c@section\else \ifdim\Gin@nat@width>\linewidth
\csname the#1\endcsname\quad \linewidth
\fi} \else
\Gin@nat@width
\fi
}
\def\ScaleHeightIfNeeded{%
\ifdim\Gin@nat@height>0.9\textheight
0.9\textheight
\else
\Gin@nat@width
\fi
}
\makeatother \makeatother
\setkeys{Gin}{width=\ScaleWidthIfNeeded,height=\ScaleHeightIfNeeded,keepaspectratio}%
$if(subscript)$
\newcommand{\textsubscr}[1]{\ensuremath{_{\scriptsize\textrm{#1}}}}
$endif$
\usepackage[breaklinks=true]{hyperref}
\hypersetup{colorlinks,%
citecolor=blue,%
filecolor=blue,%
linkcolor=blue,%
urlcolor=blue}
$if(url)$
\usepackage{url}
$endif$
$if(numbersections)$
$else$
\setcounter{secnumdepth}{0}
$endif$
$if(verbatim-in-note)$
\VerbatimFootnotes % -- allows verbatim text in footnotes
$endif$
$for(header-includes)$
$header-includes$
$endfor$
% -----------------
% END OF PREAMBLE
% -----------------
\begin{document} \begin{document}
\begin{center}
\hfill \break% $if(title)$
$if(title)$\Huge{$title$}\\[0.5em]$endif$ \textsc{$title$ \hfill {$for(author)$$author$$sep$\\$endfor$} \\ \hfill {$date$}}
$if(authors)$\Large{$authors$}\\[2.5em]$endif$
\end{center} \rule{\linewidth}{0.4pt}
$endif$
$if(toc)$
\tableofcontents
$endif$
$if(alignment)$
\begin{$alignment$}
$endif$
$body$ $body$
%$if(alignment)$
\end{$alignment$}
$endif$
\end{document} \end{document}

View File

@ -35,9 +35,8 @@ endsnippet
snippet ass "YAML metadata for assignment" snippet ass "YAML metadata for assignment"
--- ---
title: $1 title: $1
authors: Amin Kasrou Aouam author: Amin Kasrou Aouam
left-header: date: `date +%F`
right-header: `date +%F`
--- ---
endsnippet endsnippet

View File

@ -38,7 +38,7 @@ let g:vim_markdown_math=1
"" Pandoc "" Pandoc
autocmd FileType markdown nnoremap <silent> <F3> :<c-u>!pandoc %:p:S -o %:p:r:S.pdf --from markdown --template eisvogel --listings &<cr> autocmd FileType markdown nnoremap <silent> <F3> :<c-u>!pandoc %:p:S -o %:p:r:S.pdf --from markdown --template eisvogel --listings &<cr>
autocmd FileType markdown nnoremap <silent> <F4> :<c-u>!pandoc %:p:S -o %:p:r:S.pdf --from markdown --template handout &<cr> autocmd FileType markdown nnoremap <silent> <F4> :<c-u>!pandoc %:p:S -o %:p:r:S.pdf --from markdown --template handout &<cr>
autocmd FileType markdown nnoremap <silent> <F5> :<c-u>!pandoc %:p:S -o %:p:r:S.pdf -t beamer -V theme:metropolis --listings &<cr> autocmd FileType markdown nnoremap <silent> <F5> :<c-u>!pandoc %:p:S -o %:p:r:S.pdf --from markdown --template assignment &<cr>
autocmd FileType markdown nnoremap <silent> <F6> :<c-u>!zathura %:p:r:S.pdf &<cr> autocmd FileType markdown nnoremap <silent> <F6> :<c-u>!zathura %:p:r:S.pdf &<cr>
autocmd FileType markdown nnoremap <silent> <F7> :<c-u>!rm %:p:r:S.pdf &<cr> autocmd FileType markdown nnoremap <silent> <F7> :<c-u>!rm %:p:r:S.pdf &<cr>
"" Snippets "" Snippets