Skip to content

Instantly share code, notes, and snippets.

@anthonynorth
Last active September 10, 2019 10:56
Show Gist options
  • Save anthonynorth/62ae67241654d45cb0dcc6e65f2a4c94 to your computer and use it in GitHub Desktop.
Save anthonynorth/62ae67241654d45cb0dcc6e65f2a4c94 to your computer and use it in GitHub Desktop.
homework template
Display the source blob
Display the rendered blob
Raw
\documentclass[titlepage, 12pt]{article}
% layout
\setlength\parindent{0pt}
\usepackage[a4paper, margin=25mm, top=30mm, bottom=20mm, headheight=15pt]{geometry}
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage[shortlabels]{enumitem}
\linespread{1.1}
\makeatletter
\newcommand{\currentfontsize}{\fontsize{\f@size}{\f@baselineskip}\selectfont}
\makeatother
% header-footer
\lhead{\studentname}
\chead{\subject: \homeworktitle}
\rhead{\rightmark}
% code highlight
\usepackage{minted}
\usepackage{polyglossia}
\setmonofont{Consolas}[Scale=MatchLowercase]
\setminted[julia]{autogobble=true, breaklines=true, frame=lines, fontsize=\footnotesize}
\setmintedinline{fontsize=\currentfontsize}
% math
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{unicode-math}
% figures
\usepackage{graphicx}
\usepackage{float}
% tables
\usepackage{booktabs}
% problem section
\makeatletter
\let\@section\section
\renewcommand{\section}[1]{
\@section*{#1}
\markright{#1}
}
\makeatother
% title page
\title{
\vfill
\textmd{\textbf{\subject:\ \homeworktitle}}\\
\normalsize\vspace{6pt}\small{Due: \duedate}\\
\vspace{6pt}\large{\textit{\tutor:\ \class}}
\vfill
}
\author{
\LARGE{\studentname}\\
\Large{\studentnumber}
}
\date{}
\begin{document}
% homework configuration
\newcommand{\studentnumber}{xxxxxxxx}
\newcommand{\studentname}{Anthony North}
\newcommand{\subject}{MATH7502}
\newcommand{\homeworktitle}{Homework Assignment 2}
\newcommand{\tutor}{Chris Raymond}
\newcommand{\class}{Tuesday 4pm}
\newcommand{\duedate}{September 14, 2019}
% remove if title-page not required
\maketitle
\section{Problem 1}
\begin{enumerate}[(a)]
\item Some Julia code.
\inputminted{julia}{./julia/normal.jl}
\item A normal distribution
\begin{figure}[H]
\centering
\includegraphics[width=0.8\textwidth]{./figures/normal.pdf}
\caption{Normal distribution}
\end{figure}
\item A table
\begin{table}[H]
\centering
\begin{tabular}{c c c}
\toprule
$\alpha$ & $\beta$ & $\gamma$ \\
\midrule
0.388205 & 0.101040 & 0.765594 \\
0.487699 & 0.951481 & 0.519787 \\
0.019015 & 0.195708 & 0.815131 \\
0.640593 & 0.333247 & 0.363999 \\
0.817367 & 0.936854 & 0.519100 \\
0.833150 & 0.646262 & 0.268022 \\
0.170279 & 0.909456 & 0.934160 \\
\bottomrule
\end{tabular}
\caption{Random numbers}
\end{table}
\end{enumerate}
\section{Problem 2}
Show the euclidean norm.
\[
\|x\| = \sqrt{x_1^2 + x_2^2 + \dots + x_n^2}
\]
\section{Problem 3}
Cauchy–Schwarz inequality
\begin{proof}
\begin{align*}
\left\lvert \left\langle u, v \right\rangle \right\rvert^2 & \leq \left\langle u, u \right\rangle \cdot \left\langle v, v \right\rangle && \text{(it follows trivially)}
\end{align*}
\end{proof}
\end{document}
{
"latex-workshop.latex.recipes": [
{
"name": "latexmk 🔃",
"tools": ["latexmk"]
}
],
"latex-workshop.latex.tools": [
{
"name": "latexmk",
"command": "latexmk",
"args": [
"-pdflatex=lualatex",
"-shell-escape",
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-pdf",
"-outdir=%OUTDIR%",
"%DOC%"
],
"env": {}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment