Skip to content

Instantly share code, notes, and snippets.

@cscorley
Forked from jhwilson/jhwhw.cls
Created October 18, 2011 07:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save cscorley/1294796 to your computer and use it in GitHub Desktop.
Save cscorley/1294796 to your computer and use it in GitHub Desktop.
A modified JHW document class for Homework assignments
\documentclass{jhwhw}
\author{Christopher S. Corley}
\title{Class homework solutions}
\date{October 19, 2011}
\begin{document}
\problem{Some problem name}
blahblah
\solution
solution time!
\problem{}
blahblaheawrawer
\solution
\part
solution time!
\part
solution time!
\end{document}
%=====================================================================
% jhwhw.cls
% Provide jhwhw.cls class
%=====================================================================
%=====================================================================
% Identification
%=====================================================================
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{jhwhw}[2009/02/11 Justin Wilson's Homework Class]
\LoadClass[letterpaper, 12pt]{report}
%\RequirePackage{jhwmath} Personal style file I use.
\RequirePackage{fancyhdr}
\RequirePackage[top=1in,bottom=1in,left=1in,right=1in]{geometry}
\RequirePackage{graphicx}
\RequirePackage{empheq}
\RequirePackage{ifthen}
%\RequirePackage{jhwgraphics} Another personal style file I use.
%=====================================================================
% Commands
%=====================================================================
\setlength{\headheight}{15pt}
\lhead{\@author}\chead{\@title}\rhead{\@date}
\lfoot{}\cfoot{\thepage}\rfoot{}
\pagestyle{fancy}
\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]
\newcounter{SubSubProblemNum}[SubProblemNum]
\renewcommand{\theProblemNum}{\arabic{ProblemNum}}
\renewcommand{\theSubProblemNum}{\alph{SubProblemNum}}
\renewcommand{\theSubSubProblemNum}{\roman{SubSubProblemNum}}
\newcommand*{\anyproblem}[1]{\newpage\subsection*{#1}}
\newcommand*{\anyproblemnb}[1]{\subsection*{#1}}
\newcommand*{\problem}[1]{\stepcounter{ProblemNum} %
\anyproblem{Problem \theProblemNum. \; #1}}
\newcommand*{\problemnb}[1]{\stepcounter{ProblemNum} %
\anyproblemnb{Problem \theProblemNum. \; #1}}
\newcommand*{\soln}[1]{\subsubsection*{#1}}
\newcommand*{\solution}{\soln{Solution}}
\renewcommand*{\part}{\stepcounter{SubProblemNum} %
\soln{Part (\theSubProblemNum)}}
\newcommand*{\subpart}{\stepcounter{SubSubProblemNum} %
\soln{Subpart \theSubSubProblemNum. }}
\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}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment