Skip to content

Instantly share code, notes, and snippets.

@wawando
Last active February 8, 2019 13:36
Show Gist options
  • Save wawando/4927952cbaabd2504a804bdac20809b1 to your computer and use it in GitHub Desktop.
Save wawando/4927952cbaabd2504a804bdac20809b1 to your computer and use it in GitHub Desktop.
\documentclass[12pt]{article}
\usepackage[margin=1in]{geometry}
\usepackage{amsmath,amsthm,amssymb,amsfonts}
\usepackage{enumitem}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{listings}
\usepackage{float}
\usepackage{caption}
\usepackage{hyperref}
\usepackage{subcaption}
\usepackage{accsupp}
% =======================================================================================
% Cover page definition
\def\coverpage{%
\begin{titlepage}
\begin{center}
\textbf{\large Document Title} \\
\vspace{2.5mm}
\textbf{\large Course Name} \\
\large Course Code \\
\large Quarter-Year \\
\vspace{50mm}
\large Author Name \\
\large Student ID \\
\end{center}
\end{titlepage}
}
% Custom command for giving a number to one equation in align* environment
\newcommand\numberthis{\addtocounter{equation}{1}\tag{\theequation}}
% Problem definition
\newenvironment{problem}[1]
{
\begin{trivlist}
\item[\hskip \labelsep {\bfseries Problem}\hskip \labelsep {\bfseries #1}]
\item
}
{\end{trivlist}}
% Solution definition
\newenvironment{solution}[1][]
{
\begin{trivlist}
\item[\hskip \labelsep {\bfseries Solution}\hskip \labelsep {\bfseries #1}]
\item
}
{\end{trivlist}}
% Allow readers to copy the code from a PDF viewer but without copying the line numbers.
\newcommand*{\noaccsupp}[1]{\BeginAccSupp{ActualText={}}#1\EndAccSupp{}}
% Shared syntax highlighting style for code snippets
\lstdefinestyle{shared}
{
numbers=left,
numbersep=1em,
numberstyle=\tiny\color{black}\noaccsupp,
frame=single,
framesep=\fboxsep,
framerule=\fboxrule,
rulecolor=\color{black},
xleftmargin=\dimexpr\fboxsep+\fboxrule\relax,
xrightmargin=\dimexpr\fboxsep+\fboxrule\relax,
breaklines=true,
tabsize=2,
columns=flexible,
showstringspaces=false,
}
% Style for Python
\lstdefinestyle{python}
{
style=shared,
language={Python},
backgroundcolor=\color{cyan!10},
basicstyle=\small\tt,
keywordstyle=\color{blue},
commentstyle=\color[rgb]{0.13,0.54,0.13},
}
% Environment for python code
\lstnewenvironment{python}
{\lstset{style=python}}
{}
% =======================================================================================
\begin{document}
\coverpage
\begin{problem}{1}
Statement of problem goes here
\end{problem}
\begin{solution}
Solution 1
\end{solution}
% Uncomment lines below to enable bibliography
% \pagebreak
% \bibliographystyle{ieeetr}
% \bibliography{report}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment