| 1 |
% \iffalse |
| 2 |
% |
| 3 |
%FlashCards LaTeX2e Class for Typesetting Double Sided Cards |
| 4 |
%Copyright (C) 2000 Alexander M. Budge <[email protected]> |
| 5 |
% |
| 6 |
%This program is free software; you can redistribute it and/or modify |
| 7 |
%it under the terms of the GNU General Public License as published by |
| 8 |
%the Free Software Foundation; either version 2 of the License, or |
| 9 |
%(at your option) any later version. |
| 10 |
% |
| 11 |
%This program is distributed in the hope that it will be useful, |
| 12 |
%but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
%MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
%GNU General Public License for more details. |
| 15 |
% |
| 16 |
%You should have received a copy of the GNU General Public License |
| 17 |
%along with this program (the file COPYING); if not, write to the |
| 18 |
%Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 19 |
% |
| 20 |
%<*driver> |
| 21 |
\def\filename{flashcards.dtx} |
| 22 |
\def\fileversion{1.0.2} |
| 23 |
\def\filedate{20 February 2022} |
| 24 |
\def\docdate{16 March 2000} |
| 25 |
%</driver> |
| 26 |
% |
| 27 |
%% \CharacterTable |
| 28 |
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z |
| 29 |
%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z |
| 30 |
%% Digits \0\1\2\3\4\5\6\7\8\9 |
| 31 |
%% Exclamation \! Double quote \" Hash (number) \# |
| 32 |
%% Dollar \$ Percent \% Ampersand \& |
| 33 |
%% Acute accent \' Left paren \( Right paren \) |
| 34 |
%% Asterisk \* Plus \+ Comma \, |
| 35 |
%% Minus \- Point \. Solidus \/ |
| 36 |
%% Colon \: Semicolon \; Less than \< |
| 37 |
%% Equals \= Greater than \> Question mark \? |
| 38 |
%% Commercial at \@ Left bracket \[ Backslash \\ |
| 39 |
%% Right bracket \] Circumflex \^ Underscore \_ |
| 40 |
%% Grave accent \` Left brace \{ Vertical bar \| |
| 41 |
%% Right brace \} Tilde \~} |
| 42 |
%% |
| 43 |
% |
| 44 |
%<flashcards|sample|avery5371|avery5388>\NeedsTeXFormat{LaTeX2e}[1996/12/01] |
| 45 |
%<flashcards>\ProvidesClass{flashcards}[2022/02/20 1.0.2 ([email protected])] |
| 46 |
%<sample>\ProvidesFile{samplecards.tex} |
| 47 |
%<avery5371>\ProvidesFile{avery5371.cfg} |
| 48 |
%<avery5388>\ProvidesFile{avery5388.cfg} |
| 49 |
%<flashcards>\RequirePackage{ifthen} |
| 50 |
%<flashcards>\LoadClass{article} |
| 51 |
% |
| 52 |
%<*driver> |
| 53 |
\documentclass{ltxdoc} |
| 54 |
\newcommand{\flashcards}{\textsc{FlashCards}} |
| 55 |
\begin{document} |
| 56 |
\title{\flashcards |
| 57 |
\thanks{Contains version \fileversion\ last revised \filedate}} |
| 58 |
\author{Alexander M. Budge \\ \texttt{<[email protected]>}} |
| 59 |
\date{\docdate} |
| 60 |
\maketitle |
| 61 |
\DocInput{\filename} |
| 62 |
\end{document} |
| 63 |
%</driver> |
| 64 |
% |
| 65 |
% \fi |
| 66 |
% |
| 67 |
% \MakeShortVerb{\|} |
| 68 |
% |
| 69 |
% \changes{v1.0.2}{20 February 2022}{Bug-fix Release.} |
| 70 |
% \changes{v1.0.1}{13 August 2010}{Bug-fix Release.} |
| 71 |
% \changes{v1.0.0}{16 March 2000}{Full Release.} |
| 72 |
% \changes{v0.1.1}{14 March 2000}{Second Pre-release.} |
| 73 |
% \changes{v0.1.0}{12 March 2000}{First Pre-release.} |
| 74 |
% |
| 75 |
% \tableofcontents |
| 76 |
% |
| 77 |
% \section{Introduction} |
| 78 |
% The \flashcards\ class provides for the typesetting of flash |
| 79 |
% cards in \LaTeXe. By flash card, I mean a two sided card which |
| 80 |
% has a prompt or a question on one side and the response or the |
| 81 |
% answer on the flip (back) side. Flash cards come in many sizes |
| 82 |
% depending on the nature of the information they contain. In |
| 83 |
% particular, I like using both $3 \times 5''$ (index cards) and |
| 84 |
% $2 \times 3\frac{1}{2}''$ (business cards) which are available |
| 85 |
% in perforated sheets suitable for printing or copying onto. |
| 86 |
% |
| 87 |
% In order to use this package effectively, you will need to |
| 88 |
% accurately configure |dvips| (or similar) for your printer. |
| 89 |
% \LaTeX\ provides a helpful |testpage.tex| for this purpose. |
| 90 |
% |
| 91 |
% |
| 92 |
% \section{Using FlashCards} |
| 93 |
% \flashcards\ utilizes the standard \LaTeXe\ class interface. Your |
| 94 |
% document should be begin with: |
| 95 |
% \begin{center} |
| 96 |
% |\documentclass[|\textit{options}|]{flashcards}| |
| 97 |
% \end{center} |
| 98 |
% |
| 99 |
% \subsection{Options} |
| 100 |
% \DescribeMacro{avery5371} |
| 101 |
% All documents should specify the paper type. I have provided |
| 102 |
% the two that I use, business cards (Avery 5371 as well as Avery |
| 103 |
% 5376, 5377, 5911, 8371, 8376, 8377, 8471 and 8373) and |
| 104 |
% \DescribeMacro{avery5388} |
| 105 |
% index cards (Avery 5388), but variants are easy to generate. Please |
| 106 |
% refer to Section \ref{sec:paperconfig} for the details of creating |
| 107 |
% your own configuration file for a particular type of paper. |
| 108 |
% |
| 109 |
% \DescribeMacro{fronts} |
| 110 |
% If desired, you can typeset just the |fronts| of the cards or just |
| 111 |
% the |backs| of the cards. Useful if your printer does not print |
| 112 |
% \DescribeMacro{backs} |
| 113 |
% two sides without your help, although |dvips| offers the same |
| 114 |
% functionality with odd/even switches (|-A| or |-B|, respectively). |
| 115 |
% |
| 116 |
% \DescribeMacro{grid} |
| 117 |
% Useful for getting everything lined up as well as for examining |
| 118 |
% the cards as you create them, the |grid| option will draw lines |
| 119 |
% where the perforation will be. |
| 120 |
% |
| 121 |
% \DescribeMacro{frame} |
| 122 |
% The |frame| option will frame the contents of the card with a thin |
| 123 |
% line. There will be a uniform margin (see below for how to set it) |
| 124 |
% between the edge of the card and the frame. |
| 125 |
% |
| 126 |
% \DescribeMacro{dvips} |
| 127 |
% If you are using landscape oriented paper, you may want to use the |
| 128 |
% |dvips| option to send the right specials to |dvips| so that it |
| 129 |
% knows about the orientation without have to tell it from the |
| 130 |
% command line. Warning: this option displaces my margins, if the |
| 131 |
% same happens to you, then you will want to avoid it or create a |
| 132 |
% special configuration for this case. There must be some |
| 133 |
% alternative configuration file somewhere that gets used when this |
| 134 |
% option is specified for the |geometry| package. |
| 135 |
% |
| 136 |
% \subsection{Environment} |
| 137 |
% \DescribeEnv{flashcard} |
| 138 |
% The \flashcards\ class provideds the environment |flashcard| |
| 139 |
% for specifying the contents of each flash card. The |flashcard| |
| 140 |
% environment has one required argument, which becomes the |
| 141 |
% contents of the front side of the card (the question or prompt). |
| 142 |
% The body of the environment then becomes the contents of the |
| 143 |
% back side of the card. For example, |
| 144 |
% \begin{verbatim} |
| 145 |
% \begin{flashcard}{Dense Subset} |
| 146 |
% A subset $S$ of a normed space $B$ is called \emph{dense} |
| 147 |
% in $B$ if {\rm cl} $S$ = $B$. |
| 148 |
% \end{flashcard} |
| 149 |
% \end{verbatim} |
| 150 |
% will produce the front-back pair: |
| 151 |
% \begin{center} |
| 152 |
% \fbox{\parbox[t][1in][c]{2in}{% |
| 153 |
% \footnotesize\vspace*{\fill}\par |
| 154 |
% \centerline{\textbf{Dense Subset}}\par\vspace*{\fill}}} |
| 155 |
% \fbox{\parbox[t][1in][c]{2in}{% |
| 156 |
% \footnotesize\vspace*{\fill}\par\begin{center}% |
| 157 |
% A subset $S$ of a normed space $B$ is called \emph{dense} |
| 158 |
% in $B$ if {\rm cl} $S$ = $B$.\end{center}\par\vspace*{\fill}}} |
| 159 |
% \end{center} |
| 160 |
% This is not the end of the story, however, there are several |
| 161 |
% styles to choose from and an optional argument to the |flashcard| |
| 162 |
% environment. These will be descibed next. |
| 163 |
% |
| 164 |
% \subsection{Styles} |
| 165 |
% By default, \flashcards\ uses the |plain| style for both the front |
| 166 |
% and back of the flash card. The |plain| style centers the contents |
| 167 |
% horizontally and vertically. The front contents are also set in |
| 168 |
% in large bold face, but this can be changed while setting the |
| 169 |
% style as described below. |
| 170 |
% |
| 171 |
% \DescribeMacro{\cardfrontstyle} |
| 172 |
% The style of the front of the card can be conveniently selected |
| 173 |
% with the |\cardfrontstyle{|\textit{style}|}| command, where |
| 174 |
% \textit{style} can be one of |empty|, |plain|, or |headings|. |
| 175 |
% The |plain| style has already been described. The |empty| |
| 176 |
% style does not center the contents horizontally nor vertically, |
| 177 |
% allowing for more generic usage. The |headings| style allows you to |
| 178 |
% set a running footer with |
| 179 |
% \DescribeMacro{\cardfrontfoot} |
| 180 |
% the |\cardfrontfoot{|\textit{text}|}| command, as well |
| 181 |
% as set a header for each card with an optional argument to |
| 182 |
% the |flashcard| environment. For example, |
| 183 |
% \begin{verbatim} |
| 184 |
% \cardfrontstyle{headings} |
| 185 |
% \cardfrontfoot{Functional Analysis} |
| 186 |
% \begin{flashcard}[Definition]{Dense Subset} |
| 187 |
% A subset $S$ of a normed space $B$ is called \emph{dense} |
| 188 |
% in $B$ if {\rm cl} $S$ = $B$. |
| 189 |
% \end{flashcard} |
| 190 |
% \end{verbatim} |
| 191 |
% will produce the front-back pair: |
| 192 |
% \begin{center} |
| 193 |
% \fbox{\parbox[t][1in][c]{2in}{% |
| 194 |
% \footnotesize\textsc{Definition}\par\vspace*{\fill}\par |
| 195 |
% \centerline{\textbf{Dense Subset}}\par\vspace*{\fill}\par |
| 196 |
% \hspace*{\fill}\textsc{Functional Analysis}}} |
| 197 |
% \fbox{\parbox[t][1in][c]{2in}{% |
| 198 |
% \footnotesize\vspace*{\fill}\par\begin{center}% |
| 199 |
% A subset $S$ of a normed space $B$ is called \emph{dense} |
| 200 |
% in $B$ if {\rm cl} $S$ = $B$.\end{center}\par\vspace*{\fill}}} |
| 201 |
% \end{center} |
| 202 |
% |
| 203 |
% You can also change the default formatting of the contents of the |
| 204 |
% front of the card by including the new formatting commands as an |
| 205 |
% optional argument to |\cardfrontstyle|. For example, to set the |
| 206 |
% overall style to be |plain| (thus centering the contents of the |
| 207 |
% front of the card), as well as set the contents in a large |
| 208 |
% slanted face, you could issue the command: |
| 209 |
% \begin{center} |
| 210 |
% |\cardfrontstyle[\LARGE\slshape]{plain}| |
| 211 |
% \end{center} |
| 212 |
% |
| 213 |
% \DescribeMacro{\cardbackstyle} |
| 214 |
% The style of the back of the card can be conveniently selected |
| 215 |
% with the |\cardbackstyle{|\textit{style}|}| command, where |
| 216 |
% \textit{style} can either be |empty| or |plain|. The |plain| style |
| 217 |
% has already been described. The |empty| style does not center the |
| 218 |
% contents horizontally nor vertically, allowing for more generic |
| 219 |
% usage. |
| 220 |
% |
| 221 |
% The default formatting can also be changed through an optional |
| 222 |
% argument in the same manner as for the front of the card. |
| 223 |
% |
| 224 |
% \subsubsection{Headings Styles} |
| 225 |
% \DescribeMacro{\cardfrontheadstyle} |
| 226 |
% The header and footer provided for the front of the card by the |
| 227 |
% |headings| style can be customized through two style commands. |
| 228 |
% \DescribeMacro{\cardfrontfootstyle} |
| 229 |
% The available styles for the header and footer are |left|, |
| 230 |
% |center| and |right|, which will place the contents of the |
| 231 |
% header or footer as advertized. By default the header will be |
| 232 |
% |left| justified and the footer will be |right| justified. |
| 233 |
% |
| 234 |
% Here as well, you can provide an optional argument to specify |
| 235 |
% the formatting of the header and footer, for example to have |
| 236 |
% the footer centered and set in a small italic face: |
| 237 |
% \begin{center} |
| 238 |
% |\cardfrontfootstyle[\small\itshape]{center}| |
| 239 |
% \end{center} |
| 240 |
% |
| 241 |
% \subsection{Lengths} |
| 242 |
% \flashcards\ has one length (in addition to the those discussed in |
| 243 |
% paper configuration below) which allows you to set the size of the |
| 244 |
% uniform margin around the contents of both the front and back of |
| 245 |
% the card. For example, to set that uniform margin at $1/4''$, you |
| 246 |
% can do the following: |
| 247 |
% \begin{center} |
| 248 |
% |\setlength{\cardmargin}{0.25in}| |
| 249 |
% \end{center} |
| 250 |
% |
| 251 |
% |
| 252 |
% \section{Sample Document} |
| 253 |
% |
| 254 |
% \begin{macrocode} |
| 255 |
%<*sample> |
| 256 |
\documentclass[avery5388,grid,frame]{flashcards} |
| 257 |
|
| 258 |
\cardfrontstyle[\large\slshape]{headings} |
| 259 |
\cardbackstyle{empty} |
| 260 |
|
| 261 |
\begin{document} |
| 262 |
|
| 263 |
\cardfrontfoot{Functional Analysis} |
| 264 |
|
| 265 |
|
| 266 |
\begin{flashcard}[Definition]{Norm on a Linear Space \\ Normed Space} |
| 267 |
|
| 268 |
A real-valued function $||x||$ defined on a linear space $X$, where |
| 269 |
$x \in X$, is said to be a \emph{norm on} $X$ if |
| 270 |
|
| 271 |
\smallskip |
| 272 |
|
| 273 |
\begin{description} |
| 274 |
\item [Positivity] $||x|| \geq 0$, |
| 275 |
\item [Triangle Inequality] $||x+y|| \leq ||x|| + ||y||$, |
| 276 |
\item [Homogeneity] $||\alpha x|| = |\alpha| \: ||x||$, |
| 277 |
$\alpha$ an arbitrary scalar, |
| 278 |
\item [Positive Definiteness] $||x|| = 0$ if and only if $x=0$, |
| 279 |
\end{description} |
| 280 |
|
| 281 |
\smallskip |
| 282 |
|
| 283 |
where $x$ and $y$ are arbitrary points in $X$. |
| 284 |
|
| 285 |
\medskip |
| 286 |
|
| 287 |
A linear/vector space with a norm is called a \emph{normed space}. |
| 288 |
\end{flashcard} |
| 289 |
|
| 290 |
|
| 291 |
\begin{flashcard}[Definition]{Inner Product} |
| 292 |
|
| 293 |
Let $X$ be a complex linear space. An \emph{inner product} on $X$ is |
| 294 |
a mapping that associates to each pair of vectors $x$, $y$ a scalar, |
| 295 |
denoted $(x,y)$, that satisfies the following properties: |
| 296 |
|
| 297 |
\medskip |
| 298 |
|
| 299 |
\begin{description} |
| 300 |
\item [Additivity] $(x+y,z) = (x,z) + (y,z)$, |
| 301 |
\item [Homogeneity] $(\alpha \: x, y) = \alpha (x,y)$, |
| 302 |
\item [Symmetry] $(x,y) = \overline{(y,x)}$, |
| 303 |
\item [Positive Definiteness] $(x,x) > 0$, when $x\neq0$. |
| 304 |
\end{description} |
| 305 |
\end{flashcard} |
| 306 |
|
| 307 |
|
| 308 |
\begin{flashcard}[Definition]{Linear Transformation/Operator} |
| 309 |
|
| 310 |
A transformation $L$ of (operator on) a linear space $X$ into a linear |
| 311 |
space $Y$, where $X$ and $Y$ have the same scalar field, is said to be |
| 312 |
a \emph{linear transformation (operator)} if |
| 313 |
|
| 314 |
\medskip |
| 315 |
|
| 316 |
\begin{enumerate} |
| 317 |
\item $L(\alpha x) = \alpha L(x), \forall x\in X$ and $\forall$ |
| 318 |
scalars $\alpha$, and |
| 319 |
\item $L(x_1 + x_2) = L(x_1) + L(x_2)$ for all $x_1,x_2 \in X$. |
| 320 |
\end{enumerate} |
| 321 |
|
| 322 |
\end{flashcard} |
| 323 |
|
| 324 |
|
| 325 |
\end{document} |
| 326 |
%</sample> |
| 327 |
% \end{macrocode} |
| 328 |
% |
| 329 |
% \section{Paper Configuration} |
| 330 |
% \label{sec:paperconfig} |
| 331 |
% |
| 332 |
% A separate configuration file specifies the details of each |
| 333 |
% paper type. You should be able to create a new configuration |
| 334 |
% file from the information the paper manufacturer provides |
| 335 |
% with the product. Again, in order for this to work properly, |
| 336 |
% you must accurately configure your printer. I recommend |
| 337 |
% using |testpage.tex| and reading the |dvips| (or similar) |
| 338 |
% documentation (|info dvips| on a typical \textsc{Linux} |
| 339 |
% installation). Also, on my setup I have experienced variation |
| 340 |
% between portrait and landscape oriented papers. |
| 341 |
% |
| 342 |
% There are seven parameters which must be set. The names should be |
| 343 |
% somewhat self explanatory. I recommend making a copy of one of the |
| 344 |
% existing configuration files and modifying the copy as |
| 345 |
% necessary. |
| 346 |
% |
| 347 |
% For example, a $5 \times 2$ business card stock that I have been |
| 348 |
% using has a $0.75''$ left and right margins and a $0.50''$ top margin |
| 349 |
% which offset an array of $2''$ high and $3.5''$ wide business cards |
| 350 |
% arranged in $5$ vertical rows and $2$ horizontal columns. I use |
| 351 |
% the following configuration file: |
| 352 |
% \begin{verbatim} |
| 353 |
% \newcommand{\cardpaper}{letterpaper} |
| 354 |
% \newcommand{\cardpapermode}{portrait} |
| 355 |
% \newcommand{\cardrows}{5} |
| 356 |
% \newcommand{\cardcolumns}{2} |
| 357 |
% \setlength{\cardheight}{2.0in} |
| 358 |
% \setlength{\cardwidth}{3.5in} |
| 359 |
% \setlength{\topoffset}{0.50in} |
| 360 |
% \setlength{\oddoffset}{0.75in} |
| 361 |
% \setlength{\evenoffset}{0.75in} |
| 362 |
% \end{verbatim} |
| 363 |
% All four commands must be defined and all five lengths must be |
| 364 |
% specified. If the array of cards is not centered left-to-right |
| 365 |
% on the paper, you should set |\oddoffset| to the left margin of |
| 366 |
% the front and |\evenoffset| to the right margin of the front. |
| 367 |
% |
| 368 |
% |
| 369 |
% \StopEventually{} |
| 370 |
% |
| 371 |
% \section{Class Source} |
| 372 |
% The \LaTeXe\ source code follows. The flash cards are built up |
| 373 |
% in an array of save boxes which are flushed at the end of each |
| 374 |
% page and at the end of the document. |
| 375 |
% |
| 376 |
% \subsection*{Declare Booleans and Set Defaults} |
| 377 |
% |
| 378 |
% \begin{macrocode} |
| 379 |
%<*flashcards> |
| 380 |
\newboolean{flashcards@dvips}\setboolean{flashcards@dvips}{false} |
| 381 |
\newboolean{flashcards@grid}\setboolean{flashcards@grid}{false} |
| 382 |
\newboolean{flashcards@frame}\setboolean{flashcards@frame}{false} |
| 383 |
\newboolean{flashcards@fronts}\setboolean{flashcards@fronts}{true} |
| 384 |
\newboolean{flashcards@backs}\setboolean{flashcards@backs}{true} |
| 385 |
% \end{macrocode} |
| 386 |
% |
| 387 |
% \subsection*{Declare Lengths} |
| 388 |
% |
| 389 |
% \begin{macrocode} |
| 390 |
\newlength{\cardheight} |
| 391 |
\newlength{\cardwidth} |
| 392 |
\newlength{\topoffset} |
| 393 |
\newlength{\oddoffset} |
| 394 |
\newlength{\evenoffset} |
| 395 |
\newlength{\oddevenshift} |
| 396 |
% |
| 397 |
\newlength{\cardmargin} |
| 398 |
\newlength{\cardinnerheight} |
| 399 |
\newlength{\cardinnerwidth} |
| 400 |
% \end{macrocode} |
| 401 |
% |
| 402 |
% \subsection*{Declare and Process Options} |
| 403 |
% |
| 404 |
% \begin{macrocode} |
| 405 |
\DeclareOption{dvips}{ |
| 406 |
\setboolean{flashcards@dvips}{true}} |
| 407 |
\DeclareOption{grid}{ |
| 408 |
\setboolean{flashcards@grid}{true}} |
| 409 |
\DeclareOption{frame}{ |
| 410 |
\setboolean{flashcards@frame}{true}} |
| 411 |
\DeclareOption{fronts}{ |
| 412 |
\setboolean{flashcards@backs}{false}} |
| 413 |
\DeclareOption{backs}{ |
| 414 |
\setboolean{flashcards@fronts}{false}} |
| 415 |
\DeclareOption*{ |
| 416 |
\InputIfFileExists{\CurrentOption.cfg}{}{ |
| 417 |
\typeout{Coudln't find \CurrentOption.cfg, using defualt.} |
| 418 |
\OptionNotUsed}} |
| 419 |
\ProcessOptions |
| 420 |
\pagestyle{empty} |
| 421 |
%<flashcards>\RequirePackage[\cardpaper]{geometry} |
| 422 |
% \end{macrocode} |
| 423 |
% |
| 424 |
% \subsection*{Setup Paper} |
| 425 |
% |
| 426 |
% \begin{macrocode} |
| 427 |
\setlength{\oddevenshift}{\oddoffset} |
| 428 |
\addtolength{\oddevenshift}{-\evenoffset} |
| 429 |
\addtolength{\oddoffset}{-\oddevenshift} |
| 430 |
\addtolength{\evenoffset}{\oddevenshift} |
| 431 |
\geometry{\cardpapermode, |
| 432 |
\cardpaper, |
| 433 |
top=\topoffset, |
| 434 |
left=\oddoffset, |
| 435 |
right=\evenoffset, |
| 436 |
bottom=0.0in, |
| 437 |
noheadfoot} |
| 438 |
\ifthenelse{\boolean{flashcards@dvips}}{\geometry{dvips}}{} |
| 439 |
% \end{macrocode} |
| 440 |
% |
| 441 |
% \subsection*{Create Row/Column Counters} |
| 442 |
% |
| 443 |
% \begin{macrocode} |
| 444 |
\newcounter{flashcards@row} |
| 445 |
\newcounter{flashcards@col}[flashcards@row] |
| 446 |
% \end{macrocode} |
| 447 |
% |
| 448 |
% \subsection*{Create Frame and Grid Commands} |
| 449 |
% |
| 450 |
% \begin{macrocode} |
| 451 |
\ifthenelse{\boolean{flashcards@grid}} |
| 452 |
{\newcommand{\flashcards@gridbox}[1]{% |
| 453 |
\setlength{\fboxsep}{0in}\fbox{#1}} |
| 454 |
\addtolength{\cardwidth}{-2\fboxrule} |
| 455 |
\addtolength{\cardheight}{-2\fboxrule}} |
| 456 |
{\newcommand{\flashcards@gridbox}[1]{#1}} |
| 457 |
% |
| 458 |
\ifthenelse{\boolean{flashcards@frame}} |
| 459 |
{\newcommand{\flashcards@beginframebox}{% |
| 460 |
\begin{tabular}{|@{\hspace*{\fboxsep}}c@{\hspace*{\fboxsep}}|}% |
| 461 |
\hline}% |
| 462 |
\newcommand{\flashcards@endframebox}{\\ \hline |
| 463 |
\end{tabular}}} |
| 464 |
{\newcommand{\flashcards@beginframebox}{}% |
| 465 |
\newcommand{\flashcards@endframebox}{}} |
| 466 |
% \end{macrocode} |
| 467 |
% |
| 468 |
% \subsection*{Create Save Boxes} |
| 469 |
% |
| 470 |
% \begin{macrocode} |
| 471 |
\whiledo{\value{flashcards@row} < \cardrows}{% |
| 472 |
\stepcounter{flashcards@row}% |
| 473 |
\whiledo{\value{flashcards@col} < \cardcolumns}{% |
| 474 |
\stepcounter{flashcards@col}% |
| 475 |
\expandafter\newsavebox |
| 476 |
\csname flashcardFrontR\roman{flashcards@row}% |
| 477 |
C\roman{flashcards@col}\endcsname% |
| 478 |
\global\expandafter\setbox% |
| 479 |
\csname flashcardFrontR\roman{flashcards@row}% |
| 480 |
C\roman{flashcards@col}\endcsname% |
| 481 |
\hbox{\flashcards@gridbox{% |
| 482 |
\parbox[t][\cardheight] |
| 483 |
[c]{\cardwidth}% |
| 484 |
{\rule{\cardwidth}{0pt}% |
| 485 |
\rule{0pt}{\cardheight}}}}% |
| 486 |
\expandafter\newsavebox |
| 487 |
\csname flashcardBackR\roman{flashcards@row}% |
| 488 |
C\roman{flashcards@col}\endcsname% |
| 489 |
\global\expandafter\setbox% |
| 490 |
\csname flashcardBackR\roman{flashcards@row}% |
| 491 |
C\roman{flashcards@col}\endcsname% |
| 492 |
\hbox{\flashcards@gridbox{% |
| 493 |
\parbox[t][\cardheight] |
| 494 |
[c]{\cardwidth}% |
| 495 |
{\rule{\cardwidth}{0pt}% |
| 496 |
\rule{0pt}{\cardheight}}}}% |
| 497 |
} |
| 498 |
} |
| 499 |
% \end{macrocode} |
| 500 |
% |
| 501 |
% \subsection*{Initialize Row/Column Counters} |
| 502 |
% |
| 503 |
% \begin{macrocode} |
| 504 |
\setcounter{flashcards@row}{1} |
| 505 |
\setcounter{flashcards@col}{1} |
| 506 |
% \end{macrocode} |
| 507 |
% |
| 508 |
% \subsection*{Internal Formatting Commands} |
| 509 |
% |
| 510 |
% \begin{macrocode} |
| 511 |
\newcommand{\flashcards@frontfoot}{} |
| 512 |
% |
| 513 |
\newcommand{\flashcards@ps@front@empty}[3]{\@gobble{#1}\@gobble{#2}% |
| 514 |
\flashcards@format@front#3} |
| 515 |
\newcommand{\flashcards@ps@front@plain}[3]{\@gobble{#1}\@gobble{#2}% |
| 516 |
\vspace*{\fill}\par% |
| 517 |
\begin{center}\flashcards@format@front#3\end{center}% |
| 518 |
\par\vspace*{\fill}} |
| 519 |
\newcommand{\flashcards@ps@front@headings}[3]{% |
| 520 |
{\flashcards@ps@front@head{\flashcards@format@front@head#2}}\par% |
| 521 |
\vspace*{\fill}\begin{center}\flashcards@format@front#3\end{center}% |
| 522 |
\vspace*{\fill}% |
| 523 |
{\flashcards@ps@front@foot{\flashcards@format@front@foot#1}\par% |
| 524 |
\vspace*{\fboxsep}}% |
| 525 |
} |
| 526 |
% |
| 527 |
\newcommand{\flashcards@ps@back@begin@empty}{\flashcards@format@back} |
| 528 |
\newcommand{\flashcards@ps@back@end@empty}{} |
| 529 |
\newcommand{\flashcards@ps@back@begin@plain} |
| 530 |
{\vspace*{\fill}\center\flashcards@format@back} |
| 531 |
\newcommand{\flashcards@ps@back@end@plain}{\vspace*{\fill}} |
| 532 |
% |
| 533 |
\newcommand{\flashcards@ps@front@head@left}[1]{#1} |
| 534 |
\newcommand{\flashcards@ps@front@head@right}[1]{\hspace*{\fill}#1} |
| 535 |
\newcommand{\flashcards@ps@front@head@center}[1]{\centerline{#1}} |
| 536 |
% |
| 537 |
\newcommand{\flashcards@ps@front@foot@left}[1]{#1} |
| 538 |
\newcommand{\flashcards@ps@front@foot@right}[1]{\hspace*{\fill}#1} |
| 539 |
\newcommand{\flashcards@ps@front@foot@center}[1]{\centerline{#1}} |
| 540 |
% |
| 541 |
\newcommand{\flashcards@ps@front} |
| 542 |
{\flashcards@ps@front@plain} |
| 543 |
\newcommand{\flashcards@ps@front@head} |
| 544 |
{\flashcards@ps@front@head@left} |
| 545 |
\newcommand{\flashcards@ps@front@foot} |
| 546 |
{\flashcards@ps@front@foot@right} |
| 547 |
\newcommand{\flashcards@ps@back@begin} |
| 548 |
{\flashcards@ps@back@begin@plain} |
| 549 |
\newcommand{\flashcards@ps@back@end} |
| 550 |
{\flashcards@ps@back@end@plain} |
| 551 |
% |
| 552 |
\newlength{\flashcards@savelineskip} |
| 553 |
\newcommand{\flashcards@lineskip@zero} |
| 554 |
{\setlength{\flashcards@savelineskip}{\lineskip}% |
| 555 |
\setlength{\lineskip}{0pt}} |
| 556 |
\newcommand{\flashcards@lineskip@restore} |
| 557 |
{\setlength{\lineskip}{\flashcards@savelineskip}} |
| 558 |
% |
| 559 |
\newcommand{\flashcards@format@front} |
| 560 |
{\large\bfseries} |
| 561 |
\newcommand{\flashcards@format@front@head} |
| 562 |
{\normalsize\scshape} |
| 563 |
\newcommand{\flashcards@format@front@foot} |
| 564 |
{\normalsize\scshape} |
| 565 |
\newcommand{\flashcards@format@back}{} |
| 566 |
% |
| 567 |
\setlength{\cardmargin}{0.035\cardwidth} |
| 568 |
% \end{macrocode} |
| 569 |
% |
| 570 |
% \subsection*{Internal Flushing Commands} |
| 571 |
% |
| 572 |
% \begin{macrocode} |
| 573 |
\newcommand{\flashcards@flush} |
| 574 |
{\flashcards@flushfronts\flashcards@flushbacks} |
| 575 |
% |
| 576 |
\ifthenelse{\boolean{flashcards@fronts}}{% |
| 577 |
\newcommand{\flashcards@flushfronts}{% |
| 578 |
\flashcards@lineskip@zero% |
| 579 |
\noindent\raggedright\par% |
| 580 |
\setcounter{flashcards@row}{0} |
| 581 |
\whiledo{\value{flashcards@row} < \cardrows}{% |
| 582 |
\stepcounter{flashcards@row}% |
| 583 |
\whiledo{\value{flashcards@col} < \cardcolumns}{% |
| 584 |
\stepcounter{flashcards@col}% |
| 585 |
\flashcards@gridbox{\usebox{% |
| 586 |
\csname flashcardFrontR\roman{flashcards@row}% |
| 587 |
C\roman{flashcards@col}\endcsname}}% |
| 588 |
\global\expandafter\setbox% |
| 589 |
\csname flashcardFrontR\roman{flashcards@row}% |
| 590 |
C\roman{flashcards@col}\endcsname% |
| 591 |
\hbox{\flashcards@gridbox{% |
| 592 |
\parbox[t][\cardheight] |
| 593 |
[c]{\cardwidth}% |
| 594 |
{\rule{\cardwidth}{0pt}% |
| 595 |
\rule{0pt}{\cardheight}}}}% |
| 596 |
} |
| 597 |
\noindent\raggedright\par% |
| 598 |
} |
| 599 |
\clearpage% |
| 600 |
\flashcards@lineskip@restore% |
| 601 |
\setcounter{flashcards@row}{1}% |
| 602 |
\setcounter{flashcards@col}{1}% |
| 603 |
} |
| 604 |
}{% |
| 605 |
\newcommand{\flashcards@flushfronts}{}% |
| 606 |
} |
| 607 |
% |
| 608 |
\ifthenelse{\boolean{flashcards@backs}}{% |
| 609 |
\newcommand{\flashcards@flushbacks}{% |
| 610 |
\flashcards@lineskip@zero% |
| 611 |
\noindent\raggedright\par% |
| 612 |
\setcounter{flashcards@row}{0} |
| 613 |
\whiledo{\value{flashcards@row} < \cardrows}{% |
| 614 |
\stepcounter{flashcards@row}% |
| 615 |
\setcounter{flashcards@col}{\cardcolumns} |
| 616 |
\whiledo{\value{flashcards@col} > 0}{% |
| 617 |
\flashcards@gridbox{\usebox{% |
| 618 |
\csname flashcardBackR\roman{flashcards@row}% |
| 619 |
C\roman{flashcards@col}\endcsname}}% |
| 620 |
\global\expandafter\setbox |
| 621 |
\csname flashcardBackR\roman{flashcards@row}% |
| 622 |
C\roman{flashcards@col}\endcsname% |
| 623 |
\hbox{\flashcards@gridbox{% |
| 624 |
\parbox[t][\cardheight] |
| 625 |
[c]{\cardwidth}% |
| 626 |
{\rule{\cardwidth}{0pt}% |
| 627 |
\rule{0pt}{\cardheight}}}}% |
| 628 |
\addtocounter{flashcards@col}{-1}% |
| 629 |
} |
| 630 |
\noindent\raggedright\par% |
| 631 |
} |
| 632 |
\clearpage% |
| 633 |
\flashcards@lineskip@restore% |
| 634 |
\setcounter{flashcards@row}{1}% |
| 635 |
\setcounter{flashcards@col}{1}% |
| 636 |
} |
| 637 |
}{% |
| 638 |
\newcommand{\flashcards@flushbacks}{}% |
| 639 |
} |
| 640 |
% |
| 641 |
\AtEndDocument{% |
| 642 |
\ifthenelse{\value{flashcards@row} = 1}{% |
| 643 |
\ifthenelse{\value{flashcards@col} = 1}{}{% |
| 644 |
\flashcards@flush}}{\flashcards@flush}% |
| 645 |
} |
| 646 |
% \end{macrocode} |
| 647 |
% |
| 648 |
% \subsection*{User Commands and Environments} |
| 649 |
% |
| 650 |
% \begin{macrocode} |
| 651 |
% |
| 652 |
\newcommand{\cardfrontstyle}[2][] |
| 653 |
{\renewcommand{\flashcards@ps@front} |
| 654 |
{\csname flashcards@ps@front@#2\endcsname} |
| 655 |
\ifthenelse{\equal{#1}{}}{}{% |
| 656 |
\renewcommand{\flashcards@format@front}{#1}}} |
| 657 |
% |
| 658 |
\newcommand{\cardbackstyle}[2][] |
| 659 |
{\renewcommand{\flashcards@ps@back@begin} |
| 660 |
{\csname flashcards@ps@back@begin@#2\endcsname} |
| 661 |
\renewcommand{\flashcards@ps@back@end} |
| 662 |
{\csname flashcards@ps@back@end@#2\endcsname} |
| 663 |
\ifthenelse{\equal{#1}{}}{}{% |
| 664 |
\renewcommand{\flashcards@format@back}{#1}}} |
| 665 |
% |
| 666 |
\newcommand{\cardfrontheadstyle}[2][] |
| 667 |
{\renewcommand{\flashcards@ps@front@head} |
| 668 |
{\csname flashcards@ps@front@head@#2\endcsname} |
| 669 |
\ifthenelse{\equal{#1}{}}{}{% |
| 670 |
\renewcommand{\flashcards@format@front@head}{#1}}} |
| 671 |
% |
| 672 |
\newcommand{\cardfrontfootstyle}[2][] |
| 673 |
{\renewcommand{\flashcards@ps@front@foot} |
| 674 |
{\csname flashcards@ps@front@foot@#2\endcsname} |
| 675 |
\ifthenelse{\equal{#1}{}}{}{% |
| 676 |
\renewcommand{\flashcards@format@front@foot}{#1}}} |
| 677 |
% |
| 678 |
\newcommand{\cardfrontfoot}[1] |
| 679 |
{\renewcommand{\flashcards@frontfoot}{#1}} |
| 680 |
% |
| 681 |
\newenvironment{flashcard}[2][]{% |
| 682 |
\setlength{\cardinnerwidth}{\cardwidth}% |
| 683 |
\addtolength{\cardinnerwidth}{-2\cardmargin}% |
| 684 |
\setlength{\cardinnerheight}{\cardheight}% |
| 685 |
\addtolength{\cardinnerheight}{-2\cardmargin}% |
| 686 |
\ifthenelse{\boolean{flashcards@fronts}}{% |
| 687 |
\global\expandafter\setbox% |
| 688 |
\csname flashcardFrontR\roman{flashcards@row}% |
| 689 |
C\roman{flashcards@col}\endcsname% |
| 690 |
\hbox{\begingroup\aftergroup}% |
| 691 |
\begin{minipage}[t][\cardheight] |
| 692 |
[c]{\cardwidth}% |
| 693 |
\begin{center}% |
| 694 |
\flashcards@beginframebox% |
| 695 |
\begin{minipage}[t][\cardinnerheight] |
| 696 |
[t]{\cardinnerwidth}% |
| 697 |
\flashcards@ps@front{\flashcards@frontfoot}{#1}{#2}% |
| 698 |
\end{minipage}% |
| 699 |
\flashcards@endframebox% |
| 700 |
\end{center}% |
| 701 |
\end{minipage}% |
| 702 |
\endgroup% |
| 703 |
}{\@gobble{#1}}% |
| 704 |
\global\expandafter\setbox% |
| 705 |
\csname flashcardBackR\roman{flashcards@row}% |
| 706 |
C\roman{flashcards@col}\endcsname% |
| 707 |
\hbox{\begingroup\aftergroup}% |
| 708 |
\begin{minipage}[t][\cardheight] |
| 709 |
[c]{\cardwidth}% |
| 710 |
\begin{center}% |
| 711 |
\flashcards@beginframebox% |
| 712 |
\begin{minipage}[t][\cardinnerheight] |
| 713 |
[t]{\cardinnerwidth}% |
| 714 |
\flashcards@ps@back@begin% |
| 715 |
}{% |
| 716 |
\flashcards@ps@back@end% |
| 717 |
\end{minipage}% |
| 718 |
\flashcards@endframebox% |
| 719 |
\end{center}% |
| 720 |
\end{minipage}% |
| 721 |
\endgroup% |
| 722 |
\stepcounter{flashcards@col}% |
| 723 |
\ifthenelse{\value{flashcards@col} > \cardcolumns}{% |
| 724 |
\stepcounter{flashcards@row}% |
| 725 |
\ifthenelse{\value{flashcards@row} > \cardrows}{% |
| 726 |
\flashcards@flush% |
| 727 |
}{% |
| 728 |
\setcounter{flashcards@col}{1}% |
| 729 |
}% |
| 730 |
}{}% |
| 731 |
} |
| 732 |
%</flashcards> |
| 733 |
% \end{macrocode} |
| 734 |
% |
| 735 |
% \section*{Paper Types} |
| 736 |
% A separate configuration file specifies the details of each |
| 737 |
% paper type. |
| 738 |
% |
| 739 |
% \subsection*{Avery5371 Business Cards} |
| 740 |
% The $5 \times 2$ business card stock I have been using. It goes |
| 741 |
% by many other names as well, depending on color and quantity. |
| 742 |
% |
| 743 |
% \begin{macrocode} |
| 744 |
%<*avery5371> |
| 745 |
\newcommand{\cardpapermode}{portrait} |
| 746 |
\newcommand{\cardpaper}{letterpaper} |
| 747 |
\newcommand{\cardrows}{5} |
| 748 |
\newcommand{\cardcolumns}{2} |
| 749 |
\setlength{\cardheight}{2.0in} |
| 750 |
\setlength{\cardwidth}{3.5in} |
| 751 |
\setlength{\topoffset}{0.50in} |
| 752 |
\setlength{\oddoffset}{0.75in} |
| 753 |
\setlength{\evenoffset}{0.75in} |
| 754 |
%</avery5371> |
| 755 |
% \end{macrocode} |
| 756 |
% |
| 757 |
% \subsection*{Avery5388 Index Cards} |
| 758 |
% Perforated index card stock. |
| 759 |
% |
| 760 |
% \begin{macrocode} |
| 761 |
%<*avery5388> |
| 762 |
\newcommand{\cardpapermode}{portrait} |
| 763 |
\newcommand{\cardpaper}{letterpaper} |
| 764 |
\newcommand{\cardrows}{3} |
| 765 |
\newcommand{\cardcolumns}{1} |
| 766 |
\setlength{\cardheight}{3.0in} |
| 767 |
\setlength{\cardwidth}{5.0in} |
| 768 |
\setlength{\topoffset}{1.0in} |
| 769 |
\setlength{\oddoffset}{1.75in} |
| 770 |
\setlength{\evenoffset}{1.75in} |
| 771 |
%</avery5388> |
| 772 |
% \end{macrocode} |
| 773 |
% |
| 774 |
|
| 775 |
\endinput |
| 776 |
|
| 777 |
% \Finale |