Skip to content

Commit

Permalink
Added newpage option
Browse files Browse the repository at this point in the history
  • Loading branch information
jez committed Jan 18, 2015
1 parent 767c491 commit d593cd3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,15 @@ include the `anonymous` option in the `\documentclass` line:
\documentclass[11pt,anonymous]{homework}
```

### One question per page

If you'd like each question to begin on a new page, include the `newpage`
option:

```latex
\documentclass[11pt,newpage]{homework}
```

For truly anonymous submissions, make sure you remove all personally identifying
information from your preamble.

Expand Down
23 changes: 12 additions & 11 deletions homework.cls
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
% ----- Options ---------------------------------------------------------------
\newcommand\@opanon{0}
\DeclareOption{anonymous}{\renewcommand\@opanon{1}}
\newcommand\@opnewpage{0}
\DeclareOption{newpage}{\renewcommand\@opnewpage{1}}
\ProcessOptions

% ----- Packages --------------------------------------------------------------
Expand Down Expand Up @@ -59,6 +61,11 @@
% Numbered question
\providecommand{\question}{}
\renewcommand{\question}[0]{%
% Emit \newpage if option `newpage` is present
\ifthenelse{\equal{\@opnewpage}{1}}{%
\newpage
}{}

% Wrap in minipage so that we don't get a line break enywhere in between
\begin{minipage}{\linewidth}%
\stepcounter{questionCounter}%
Expand All @@ -78,6 +85,11 @@
% Named question, takes one argument
\WithSuffix\providecommand\question*{}
\WithSuffix\renewcommand\question*[1]{%
% Emit \newpage if option `newpage` is present
\ifthenelse{\equal{\@opnewpage}{1}}{%
\newpage
}{}

% Wrap in minipage so that we don't get a line break enywhere in between
\begin{minipage}{\linewidth}%
\addtocounter{questionCounter}{1}%
Expand Down Expand Up @@ -163,18 +175,7 @@
}%
{%
\renewcommand{\maketitle}[0]{%
% Don't set up header
%\setlength{\headheight}{15.2pt}
%\lhead{\hwclass{} \hwlecture\hwsection}%
%\chead{\hwname{} (\hwemail)}%
%\rhead{\hwtype{} \hwnum}%

% Don't setup hrule in header
%\renewcommand{\headrulewidth}{0pt}
%\headrule{}

% Make all pages plain
%\thispagestyle{plain}
\pagestyle{plain}

% Put header on it's own page
Expand Down

0 comments on commit d593cd3

Please sign in to comment.