blob: 6a9da91a65dd09da3276d7f8041d1795c8d48a9d [file] [log] [blame]
%%
%% This is file `qqz.sty'. It handles the latex portions of extracting
%% Quick Quizzes. Other pieces of the puzzle may be found
%% in the Makefile and the utilities directory.
%%
%% \QuickQuizChapter{chp:label} -- to introduce a chapter with quick quizzes.
%% \QuickQuiz{}
%% Question goes here.
%% \QuickQuizAnswer{
%% Answer goes here.
%% } \QuickQuizEnd
%% \QuickQuizAnswers -- to dump out all questions and answers in new section.
%%
%% Copyright (C) IBM Corporation, 2008
%%
%% Authors: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
\newcounter{quickquizctr}
\newcommand{\QuickQuizAnswerChapter}{\textbf{Unknown QuickQAC!!!}}
\newcommand{\QuickQuizChapter}[2]{
\chapter{#2}
\label{#1}
\setcounter{quickquizctr}{0}}
\newcommand{\QuickQuiz}[1]{
\refstepcounter{quickquizctr}
\textbf{Quick Quiz \thechapter.\thequickquizctr:}}
\newcommand{\QuickQuizAnswer}[1]{\rule{7pt}{7pt}}
\newcommand{\QuickQuizEnd}{}
% To create a command referencing the previously defined quick quiz:
% \edef\QQstatcnt{Quick Quiz \thechapter.\thequickquizctr}
% Invoke the command in braces to print the quick quiz's name:
% {\QQstatcnt}
% There is probably a better way to do this, but this does work.
\newcommand{\QuickQuizAnswers}{
\chapter{Answers to Quick Quizzes}
\label{chp:Answers to Quick Quizzes}
~ \\
\input{qqz}}
%% Internal interfaces generated by scripts.
\newcommand{\QuickQAC}[2]{
\renewcommand{\QuickQuizAnswerChapter}{\ref{#1}}
\setcounter{quickquizctr}{0}
\section{#2}}
\newcommand{\QuickQ}[1]{
\refstepcounter{quickquizctr} ~ \\ ~ \\
\textbf{Quick Quiz \QuickQuizAnswerChapter.\thequickquizctr:} #1 ~ \\ }
\newcommand{\QuickA}[1]{\rule{7pt}{7pt} \\ ~ \\ \textbf{Answer:} \\ }