public
Created

Homework documentclass LaTeX (draft)

  • Download Gist
mshw.cls
TeX
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
%=====================================================================
% mshw.cls
% Provide mshw.cls class
% Derived from jhwhw.cls
% https://gist.github.com/jhwilson/1278588
% http://tex.stackexchange.com/questions/31183/class-file-for-homework-assignments
%=====================================================================
 
%=====================================================================
% Identification
%=====================================================================
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{mshw}[2013/09/05 Miles Steele's Homework Class]
 
\LoadClass[letterpaper, 12pt]{article}
\RequirePackage{fancyhdr}
\RequirePackage[top=1in,bottom=1in,left=1in,right=1in]{geometry}
\RequirePackage{graphicx}
\RequirePackage{parskip}
\RequirePackage[fleqn]{amsmath}
\RequirePackage{amsfonts, amssymb}
\RequirePackage{multicol}
\RequirePackage{empheq}
\RequirePackage{ifthen}
 
 
%=====================================================================
% Commands
%=====================================================================
 
\setlength{\headheight}{28pt}
% \lhead{}\chead{\@title}\rhead{\@author\\\today}
\lhead{\@acadclass\\\@title}\chead{}\rhead{\@author\\\today}
\lfoot{}\cfoot{}\rfoot{\thepage}
\pagestyle{fancy}
 
\newcommand{\f}[0]{\frac}
\newcommand{\pmat}[1]{\begin{pmatrix}#1\end{pmatrix}}
 
% academic class variable
\newcommand\acadclass[1]{\def\@acadclass{#1}}
 
 
\ifx\pdfoutput\undefined %LaTeX
\RequirePackage[ps2pdf,bookmarks=true]{hyperref}
\hypersetup{ %
pdfauthor = {\@author},
pdftitle = {\@title},
pdfcreator = {LaTeX with hyperref package},
pdfproducer = {dvips + ps2pdf}
}
\else %PDFLaTeX
\RequirePackage[pdftex,bookmarks=true]{hyperref}
\hypersetup{ %
pdfauthor = {\@author},
pdftitle = {\@title},
pdfcreator = {LaTeX with hyperref package},
pdfproducer = {dvips + ps2pdf}
}
\pdfadjustspacing=1
\fi
 
% Set up counters for problems and subsections
 
\newcounter{ProblemNum}
\newcounter{SubProblemNum}[ProblemNum]
 
% \renewcommand{\theProblemNum}{\arabic{ProblemNum}}
% \renewcommand{\theSubProblemNum}{\alph{SubProblemNum}}
 
 
% \newcommand*{\anyproblem}[1]{\section*{#1}}
% \newcommand*{\problem}[1]{\stepcounter{ProblemNum} %
% \anyproblem{Problem \arabic{ProblemNum}. #1}}
 
\newcommand*{\problem}[2]{
\setcounter{ProblemNum}{#1}
\section*{Problem \arabic{ProblemNum}. #2}
}
 
\newcommand*{\subproblem}[1]{
\stepcounter{SubProblemNum}
\subsection*{Part \arabic{ProblemNum}-\alph{SubProblemNum}. #1}
}
 
% \newcommand*{\soln}[1]{\subsubsection*{#1}}
% \newcommand*{\solution}{\soln{Solution}}
% \renewcommand*{\part}{\stepcounter{SubProblemNum} %
% \soln{Part (\theSubProblemNum)}}
 
\renewcommand{\theenumi}{(\alph{enumi})}
\renewcommand{\labelenumi}{\theenumi}
\renewcommand{\theenumii}{\roman{enumii}}
 
% \def\problemmark{}
 
% % Typesetting problems
 
% % \newcommand*{\prob}[1]{\newpage \noindent \textbf{\Large #1}}
% % \newcommand*{\problem}[1]{\stepcounter{ProblemNum} \prob{Problem %
% % \theProblemNum.}}
% % \newcommand*{\soln}[1]{\\ \noindent \textbf{\Large #1}}
% % \newcommand*{\solution}{\soln{Solution}}
% % \renewcommand*{\part}{\\ \noindent \stepcounter{SubProblemNum} %
% % \textbf{\Large Part (\theSubProblemNum)}}
 
% \newcommand\problem{\@startsection{problem}{1}{\z@}%
% {-3.25ex \@plus -1ex \@minus -.2ex}%
% {1.5ex \@plus .2ex}%
% {\normalfont\large\bfseries}}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.