2025-02-09 21:42:31 +01:00

124 lines
2.9 KiB
Bash

MD_FILE="$1"
TEX_FILE="$2"
BUILD_DIR="$3"
TEMP_MD_FILE="$BUILD_DIR/$(basename "$MD_FILE")"
TEMP_TEX_FILE="$BUILD_DIR/$(basename "$MD_FILE" | sed -e 's|md$|latex|')"
mkdir -p "$(dirname "$TEMP_MD_FILE")"
title="$(grep '^# ' "$MD_FILE" | sed 's|^# ||')"
cat "$MD_FILE" | sed \
-e 's|\[toc\]|\\tableofcontents|' \
-e 's|^\[parent\].*$||' \
-e 's|^# .*$||' \
-e 's|^#||' \
>"$TEMP_MD_FILE"
CUR_DIR="$(pwd)"
cd "$BUILD_DIR"
pandoc --to=latex -o "$(basename "$TEMP_TEX_FILE")" "$(basename "$TEMP_MD_FILE")"
cd "$CUR_DIR"
cat >"$TEX_FILE" <<EOF
\documentclass[11pt]{article}
\usepackage[a4paper, portrait, includehead, includefoot, margin=1.5cm]{geometry}
% \usepackage[dutch]{babel}
\usepackage{pdfpages}
\usepackage{xcolor}
\usepackage{makecell}
\usepackage{tabularx}
\usepackage{adjustbox}
\usepackage{longtable}
\providecommand{\tightlist}{\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\usepackage{booktabs}
\usepackage{fontspec}
\usepackage{xunicode}
\usepackage{xltxtra}
\usepackage[sfdefault]{roboto}
\newfontfamily\fontUbuntu[]{Ubuntu}
% \usepackage[none]{ubuntu}
% \usepackage[style=ieee]{biblatex}
% \usepackage{csquotes}
% \addbibresource{bibliography.bib}
% header and footer
\usepackage{fancyhdr}
\renewcommand{\headrule}{}
\usepackage[nodayofweek]{datetime}
\definecolor{darkishyellow}{rgb}{177, 179, 173}
% for images
\usepackage{graphbox}
% add bookmarks with \hypertarget
% \usepackage{bookmark}
% \usepackage{hyperref}
% heading numberging
\setcounter{secnumdepth}{3}
\renewcommand\thesection{{\fontUbuntu\arabic{section}}}
\renewcommand\thesubsection{{\fontUbuntu\arabic{section}.\arabic{subsection}}}
\renewcommand\thesubsubsection{{\fontUbuntu\arabic{section}.\arabic{subsection}.\arabic{subsubsection}}}
\usepackage{sectsty}
\allsectionsfont{\fontUbuntu}
\setlength{\headheight}{14pt}
% no indent at paragraphs
\usepackage{parskip}
\usepackage{setspace}
\setstretch{1.1}
\let\tmpitem\itemize
\let\tmpenditem\enditemize
\renewenvironment{itemize}{\tmpitem\setlength\itemsep{-.4em}}{\tmpenditem}
\begin{document}
\raggedright
\pagecolor{darkishyellow}
\begin{titlepage}
\null\vfill
\begin{center}
{\Huge\fontUbuntu $title \par}
\vskip 3em
% \includegraphics{assets/eriks.50.png}
\vskip 3em
{\huge\fontUbuntu Formula Student \par}
\end{center}
\vskip 25em
{
\large
\lineskip .75em
\begin{tabular}{r l}
gemaakt door: & ... (...) \\\\
klas: & ... \\\\
vak code: & ELEPEE51 \\\\
ge\\"exporteerd op: & \today
\end{tabular}
}
\vfill\null
\end{titlepage}
\pagestyle{fancy}
\fancyhead{} % clear all header fields
\fancyhead[LO]{\color{gray}\fontUbuntu $title}
\fancyhead[RO]{\color{gray}\fontUbuntu Formula Student}
\fancyfoot{} % clear all footer fields
\fancyfoot[LO]{\color{gray}\fontUbuntu ...}
\fancyfoot[CO]{\color{gray}\fontUbuntu Hoogeschool Rotterdam}
\fancyfoot[RO]{\color{gray}\fontUbuntu pagina \thepage}
EOF
cat "$TEMP_TEX_FILE" >>"$TEX_FILE"
cat >>"$TEX_FILE" <<EOF
\end{document}
EOF