Difference between revisions of "LaTeX Problem Set Template"

(No difference)

Revision as of 23:34, August 23, 2009

Here's a basic template that makes typesetting those problem sets in LaTeX a breeze. Comes with a "problem" environment with section dividers. Nothing fancy but it is not too difficult to customize.


Template Code

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%This is a science homework template. Modify the preamble to suit your needs. 
%The junk text is   there for you to immediately see how the headers/footers look at first 
%typesetting.


\documentclass[12pt]{article}


%AMS-TeX packages
\usepackage{amssymb,amsmath,amsthm} 
%geometry (sets margin) and other useful packages
\usepackage[margin=1.25in]{geometry}
\usepackage{graphicx,ctable,booktabs}


%
%Redefining sections as problems
%
\makeatletter
\newenvironment{problem}{\@startsection
       {section}
       {1}
       {-.2em}
       {-3.5ex plus -1ex minus -.2ex}
       {2.3ex plus .2ex}
       {\pagebreak[3]%forces pagebreak when space is small; use \eject for better results
       \large\bf\noindent{Problem }
       }
       }
       {%\vspace{1ex}\begin{center} \rule{0.3\linewidth}{.3pt}\end{center}}
       \begin{center}\large\bf \ldots\ldots\ldots\end{center}}
\makeatother


%
%Fancy-header package to modify header/page numbering 
%
\usepackage{fancyhdr}
\pagestyle{fancy}
%\addtolength{\headwidth}{\marginparsep} %these change header-rule width
%\addtolength{\headwidth}{\marginparwidth}
\lhead{Problem \thesection}
\chead{} 
\rhead{\thepage} 
\lfoot{\small\scshape course name} 
\cfoot{} 
\rfoot{\footnotesize PS \#} 
\renewcommand{\headrulewidth}{.3pt} 
\renewcommand{\footrulewidth}{.3pt}
\setlength\voffset{-0.25in}
\setlength\textheight{648pt}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%Contents of problem set
%    
\begin{document}
\title{Course Name: Problem Set/Homework \#}
\author{Author}
\date{date}
\maketitle
\thispagestyle{empty}

%Example problems

\begin{problem}{\it Gravity}
my problem set my problem set my problem set my problem set my problem set my problem set 
my problem set my problem set my problem set my problem set my problem set my problem set 
my problem set my problem set my problem set my problem set my problem set my problem set 
my problem set my problem set my problem set my problem set my problem set my problem set 
my problem set my problem set my problem set my problem set my problem set my problem set 
my problem set my problem set my problem set my problem set my problem set my problem set 
my problem set my problem set my problem set my problem set my problem set my problem set 
my problem set my problem set my problem set my problem set my problem set my problem set 
my problem set my problem set my problem set my problem set my problem set my problem set 
my problem set my problem set my problem set my problem set my problem set my problem set 
my problem set my problem set my problem set my problem set my problem set my problem set 
my problem set my problem set my problem set my problem set my problem set my problem set 
my problem set my problem set my problem set my problem set my problem set my problem set 

my problem set my problem set my problem set my problem set my problem set my problem set 
my problem set my problem set my problem set my problem set my problem set my problem set 
my problem set my problem set my problem set my problem set my problem set my problem set 
my problem set my problem set my problem set my problem set my problem set my problem set 
my problem set my problem set my problem set my problem set my problem set my problem set 
my problem set my problem set my problem set my problem set my problem set my problem set 
my problem set my problem set my problem set my problem set my problem set my problem set 
my problem set my problem set my problem set my problem set my problem set my problem set 
my problem set my problem set my problem set my problem set my problem set my problem set 
my problem set my problem set my problem set my problem set my problem set my problem set 
my problem set my problem set my problem set my problem set my problem set my problem set 
my problem set my problem set my problem set my problem set my problem set my problem set 
my problem set my problem set my problem set my problem set my problem set my problem set 
my problem set my problem set my problem set my problem set my problem set my problem set 
my problem set my problem set my problem set my problem set my problem set my problem set 

\end{problem}
\begin{problem}{}
\end{problem}
\end{document}