I saw in another question about how to create a condition, of which the best practice recommended was \iftoggle
. I want to create a macro that will allow the creation of a teacher's note, a section with a definable look and feel which will conditionally compile away if I define that this is not the teacher's edition.
The error, it turns out, was that I didn't realize I had to usepackage in order to use the etoolbox. Here is the (now working) code. How can I define a border and a shading to embed in the teacher macro, and is there a better way of doing this?
\documentclass[11pt]{book} % Book class in 11 points
\parindent0pt \parskip10pt % make block paragraphs
\raggedright % do not right justify
\usepackage{etoolbox}
\title{\bf Document Title} % Supply information
\author{Author} % for the title page.
\date{\today} % Use current date.
\newtoggle{teacherFlag}
\toggletrue{teacherFlag}
\newcommand{\teacher}[1] {
\iftoggle{teacherFlag}{
{#1}
}{
}
}
% Note that book class by default is formatted to be printed back-to-back.
\begin{document} % End of preamble, start of text.
\frontmatter % only in book class (roman page #s)
\maketitle % Print title page.
\tableofcontents % Print table of contents
\mainmatter % only in book class (arabic page #s)
\part{A Part Heading} % Print a "part" heading
\chapter{A Main Heading} % Print a "chapter" heading
Most of this example applies to \texttt{article} and \texttt{book} classes
as well as to \texttt{report} class. In \texttt{article} class, however,
the default position for the title information is at the top of
the first text page rather than on a separate page. Also, it is
not usual to request a table of contents with \texttt{article} class.
\section{A Subheading} % Print a "section" heading
The following sectioning commands are available:
\begin{quote} % The following text will be
part \\ % set off and indented.
chapter \\ % \\ forces a new line
section \\
subsection \\
subsubsection \\
paragraph \\
subparagraph
\end{quote} % End of indented text
\teacher{foo}
But note that---unlike the \texttt{book} and \texttt{report} classes---the
\texttt{article} class does not have a ``chapter" command.
\end{document}