From b8670fbe179fb1a6fa2df93bc16fd0883a183371 Mon Sep 17 00:00:00 2001 From: coolneng Date: Sat, 11 May 2019 03:40:12 +0200 Subject: [PATCH] Modify pandoc assignment template --- pandoc/.pandoc/templates/assignment.latex | 189 +++++++++++++--------- vim/.vim/UltiSnips/markdown.snippets | 5 +- vim/.vimrc | 2 +- 3 files changed, 117 insertions(+), 79 deletions(-) diff --git a/pandoc/.pandoc/templates/assignment.latex b/pandoc/.pandoc/templates/assignment.latex index 5593451..c44d01b 100644 --- a/pandoc/.pandoc/templates/assignment.latex +++ b/pandoc/.pandoc/templates/assignment.latex @@ -1,91 +1,130 @@ -% !TEX TS-program = xelatex -% !TEX encoding = UTF-8 Unicode +\documentclass[12pt]{article} -% ----------------- -% START OF PREAMBLE -% ----------------- -\documentclass[12pt,a4paper]{scrartcl} - - -% Commands -\newcommand{\HRule}{\rule{\linewidth}{0.5mm}} - - -% Packages -\usepackage{fontspec} -\usepackage{eurosym} +\usepackage[T1]{fontenc} +\usepackage{amsmath} \usepackage{amssymb} -\usepackage{mathtools} -\usepackage{upquote} -\usepackage{microtype} -\usepackage{longtable,booktabs} +\usepackage[utf8]{inputenc} + +\usepackage{tikz} \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 -\DeclareOldFontCommand{\rm}{\normalfont\rmfamily}{\mathrm} -% Fancy headers and footers settings -\pagestyle{fancy} -\lhead{$left-header$} -\rhead{$right-header$} +\usepackage{longtable} +\usepackage{booktabs} +\providecommand{\tightlist}{% + \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} - -% Required for syntax highlighting -$highlighting-macros$ - - -% 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 +\usepackage[english]{babel} + +\usepackage{geometry} +\geometry{verbose,a4paper,tmargin=1.5cm,bmargin=1.5cm,lmargin=1.5cm,rmargin=1.5cm} + \setlength{\parindent}{0pt} -\setlength{\parskip}{1em plus 2pt minus 1pt} -\setlength{\emergencystretch}{3em} % prevent overfull lines +\setlength{\parskip}{6pt plus 2pt minus 1pt} + +\pagestyle{empty} + +$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$ - -% No section numbering +% 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 -\def\@seccntformat#1{% - \expandafter\ifx\csname c@#1\endcsname\c@section\else - \csname the#1\endcsname\quad - \fi} +\def\ScaleWidthIfNeeded{% + \ifdim\Gin@nat@width>\linewidth + \linewidth + \else + \Gin@nat@width + \fi +} +\def\ScaleHeightIfNeeded{% + \ifdim\Gin@nat@height>0.9\textheight + 0.9\textheight + \else + \Gin@nat@width + \fi +} \makeatother - -% ----------------- -% END OF PREAMBLE -% ----------------- +\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$ + + + \begin{document} -\begin{center} - \hfill \break% - $if(title)$\Huge{$title$}\\[0.5em]$endif$ - $if(authors)$\Large{$authors$}\\[2.5em]$endif$ -\end{center} +$if(title)$ +\textsc{$title$ \hfill {$for(author)$$author$$sep$\\$endfor$} \\ \hfill {$date$}} + +\rule{\linewidth}{0.4pt} +$endif$ + +$if(toc)$ +\tableofcontents + +$endif$ + + +$if(alignment)$ +\begin{$alignment$} +$endif$ + $body$ - + +%$if(alignment)$ +\end{$alignment$} +$endif$ + + \end{document} diff --git a/vim/.vim/UltiSnips/markdown.snippets b/vim/.vim/UltiSnips/markdown.snippets index d2bf817..4acc7da 100644 --- a/vim/.vim/UltiSnips/markdown.snippets +++ b/vim/.vim/UltiSnips/markdown.snippets @@ -35,9 +35,8 @@ endsnippet snippet ass "YAML metadata for assignment" --- title: $1 -authors: Amin Kasrou Aouam -left-header: -right-header: `date +%F` +author: Amin Kasrou Aouam +date: `date +%F` --- endsnippet diff --git a/vim/.vimrc b/vim/.vimrc index 078dd5d..18e23aa 100644 --- a/vim/.vimrc +++ b/vim/.vimrc @@ -38,7 +38,7 @@ let g:vim_markdown_math=1 "" Pandoc autocmd FileType markdown nnoremap :!pandoc %:p:S -o %:p:r:S.pdf --from markdown --template eisvogel --listings & autocmd FileType markdown nnoremap :!pandoc %:p:S -o %:p:r:S.pdf --from markdown --template handout & -autocmd FileType markdown nnoremap :!pandoc %:p:S -o %:p:r:S.pdf -t beamer -V theme:metropolis --listings & +autocmd FileType markdown nnoremap :!pandoc %:p:S -o %:p:r:S.pdf --from markdown --template assignment & autocmd FileType markdown nnoremap :!zathura %:p:r:S.pdf & autocmd FileType markdown nnoremap :!rm %:p:r:S.pdf & "" Snippets