Skip to content

Instantly share code, notes, and snippets.

@matth
Created January 21, 2011 14:00
Show Gist options
  • Save matth/789708 to your computer and use it in GitHub Desktop.
Save matth/789708 to your computer and use it in GitHub Desktop.
OU TMA Latex Example
\documentclass{ou-assignment}
\student{My Name}
\email{[email protected]}
\identifier{B1234567}
\course{M248}
\tma{1}
\tmapart{1}
\date{January 20, 2011}
\begin{document}
\titlepage
\question
This is a auto incrementing numbered question section e.g. "Question 1"
\subquestion
This is a auto incrementing numbered sub-question section e.g. "(a)"
\subsubquestion
This is a auto incrementing numbered sub-sub-question section e.g. "(i)"
\end{document}
\ProvidesClass{ou-assignment}
\LoadClass[12pt]{article}
% PDF Stuff
\usepackage[pdfborder={0 0 0}]{hyperref}
\usepackage{fancyhdr}
% spacing
\usepackage{setspace}
\onehalfspacing
% paragraphs
\setlength{\parindent}{0pt}
\setlength{\parskip}{1ex plus 0.5ex minus 0.2ex}
% margins
\usepackage[top=1in,bottom=1in,left=1in,right=1in]{geometry}
% Student, Course & Assignment
\makeatletter
\newcommand{\student}[1]{\def \@student {#1}}
\newcommand{\email}[1]{\def \@email {#1}}
\newcommand{\identifier}[1]{\def \@identifier {#1}}
\newcommand{\course}[1]{\def \@course {#1}}
\newcommand{\tma}[1]{\def \@tma {#1}}
\newcommand{\tmapart}[1]{\def \@tmapart {#1}}
% Student info
\newcommand{\studentinfo}{
\ifdefined \@email
\href{mailto:\@email}{\@student, \space \@identifier}
\else
\@student, \space \@identifier
\fi
}
% Student title
\newcommand{\tmatitle}{
TMA \@course \space \two@digits{\@tma}
\ifdefined \@tmapart
\space - Part \@tmapart
\fi
}
\makeatother
% Title Page
\renewcommand{\titlepage}{
\author{\studentinfo}
\title{\tmatitle}
\maketitle
\thispagestyle{empty}
}
% Headers
\pagestyle{fancyplain}
\fancyhf{}
\lhead{\fancyplain{}{\tmatitle}}
\rhead{\fancyplain{}{\studentinfo}}
\cfoot{\fancyplain{}{\thepage}}
% Question (section) headers
\newcounter{questioncounter}
\newcounter{subquestioncounter}[questioncounter]
\newcounter{subsubquestioncounter}[subquestioncounter]
\newcommand{\question}{
\addtocounter{questioncounter}{1}
\noindent{\large \textbf{Question \arabic{questioncounter}}}
}
\newcommand{\subquestion}{
\addtocounter{subquestioncounter}{1}
\noindent{\textbf{(\alph{subquestioncounter})}}
}
\newcommand{\subsubquestion}{
\addtocounter{subsubquestioncounter}{1}
\noindent{\textbf{(\roman{subsubquestioncounter})}}
}
@spdegabrielle
Copy link

remove \makeatletter '@' is a letter by default in class files.
remove \makeatother - probably won't cause an error - but there is risk.

http://tex.stackexchange.com/questions/62583/is-it-really-bad-to-use-makeatletter-and-makeatother-in-a-package-or-class-fil

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment