1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
%; whizzy chapter
\documentclass{article}
\usepackage {main}
% \input {macros.tex}
\newenvironment{drawer}[1]{\subsection{#1}}{}
\title {Advanced example}
\begin{document}
\maketitle
\begin{abstract}
This self-demonstrating example illustrate advanced uses of {WhizzyTeX}
customization. To see the demo, run WhizzyTeX on this file and move the
cursor in and out environments. You may also do so by \emph{clicking}
on subsection headers.
\end{abstract}
%% \section{Don't remember why this is there}
%% Edit macros.tex to change this: \macroreloaded
\section{Drawers}
This illustrates how to use the cursor position to change the behavior of
environments. This document should compiled with plain latex, so
customization is defined in local file \verb"whizzy.sty" that it
automatically loaded by WhizzyTeX.
\begin{drawer}{Changing the behavior inside environments}
To modify the behavior when the cursor is inside an environment, it
sufficies to use the command \verb"\WhizzyInsideEnvironment"
in place of \verb"\renewenvironment".
\begin{itemize}
\item This is the simplest example.
\item The old behavior become is used when the cursor is outside, and bound
to \verb"\out@itemize" and \verb"\endout@itemize".
\end{itemize}
The environments can be embedded as show here with \verb"itemize" inside
\verb"drawer".
The example \verb"drawer" shows how to modify the environment outside,
rather than inside:
\begin{enumerate}
\item pick the old definition;
\item redefine the behavoir outside;
\item define the new behavior inside to be the previous behavior outside.
\end{enumerate}
\end{drawer}
\begin{drawer}{Special environments}
This example uses the \verb"exercise" environment for proofs.
The behavior inside is to flip a boolean that make postpone the proof to an
appendix. In this case the end of the environment command is replaced
by \verb"endnow-proof", hence,
\verb"\whizzy@envlimit@waux" which is otherwise added automatically by
\verb"\WhizzyInsideEnvironment", must be called explicitly here.
\begin{theorem}
All theorems are true.
\end{theorem}
\begin{proof}{}
Otherwise, they would not be called theorems.
\end{proof}
\begin{lemma}
This is a lemma.
\end{lemma}
\begin{proof}{}
The proof is similar.
\end{proof}
\end{drawer}
\begin{exercise}
This is an exercise.
\begin{answer}
And its solution.
Which should be appear in appendix, unless the cursor is here.
\end{answer}
\end{exercise}
\inputanswers{Proofs and exercises}
\end{document}
|