Skip to content

Instantly share code, notes, and snippets.

<#
.SYNOPSIS
Splits a PDF file containing multiple exams along ranges specified in a CSV file, to be used with Moodle.
.DESCRIPTION
Given a CSV file named "exams.csv" with the following content:
Name;ID;Start;End
John Doe;1234;1;2
Jane Doe;5678;3;4
%%% Dark magic
\makeatletter
\def\font@loop#1{% define a loop
\ifx\relax#1% if we get to \relax, do nothing
\else% otherwise...
% define \cA=\mathcal{A}, etc
\expandafter\def\csname c#1\endcsname{\mathcal{#1}}
% define \sA=\mathsf{A}, etc
\expandafter\def\csname s#1\endcsname{\mathsf{#1}}
% define \bA=\mathbf{A}, etc
@nidrissi
nidrissi / letter.tex
Last active September 5, 2021 02:15
LaTeX letter template. See https://idrissi.eu/post/letter/ for more information.
\documentclass[foldmarks=false, backaddress=false, fromemail, fromlogo, fromrule]{scrlttr2}
\usepackage{polyglossia}
\setmainlanguage{english}
\usepackage[babel]{microtype}
\usepackage{unicode-math}
% Fonts can be customized here.
\setmainfont{TeX Gyre Pagella}
\setmathfont{TeX Gyre Pagella Math}[Scale=MatchLowercase]