| 1 |
%% |
| 2 |
%% This is file `gamebooklib_test.tex', |
| 3 |
%% |
| 4 |
%% Copyright (C) 2021 by Robert J Lee |
| 5 |
%% |
| 6 |
%% This file may be distributed and/or modified under the |
| 7 |
%% conditions of the LaTeX Project Public License, either |
| 8 |
%% version 1.3 of this license or (at your option) any later |
| 9 |
%% version. The latest version of this license is in: |
| 10 |
%% |
| 11 |
%% http://www.latex-project.org/lppl.txt |
| 12 |
%% |
| 13 |
%% and version 1.3 or later is part of all distributions of |
| 14 |
%% LaTeX version 2005/12/01 or later. |
| 15 |
%% |
| 16 |
\documentclass{report} |
| 17 |
\usepackage[seed=123]{lcg} |
| 18 |
\usepackage[verbose,footnote]{gamebooklib} |
| 19 |
\usepackage{lipsum} |
| 20 |
\begin{document} |
| 21 |
|
| 22 |
\newcommand{\turnto}[1]{\ref{gentry:#1}\par} |
| 23 |
|
| 24 |
\section*{Example of Use} |
| 25 |
|
| 26 |
This document was used for testing during development of gamebooklib. |
| 27 |
Please see the \texttt{gamebooklib\_test.tex} file alongside the PDF |
| 28 |
to see how the package behaves. |
| 29 |
|
| 30 |
\tracingmacros=1 |
| 31 |
\begin{gentry}{codea} |
| 32 |
This is the first gentry! |
| 33 |
|
| 34 |
It actually contains two gentryraphs. |
| 35 |
|
| 36 |
Turn to \turnto{codeb} |
| 37 |
\end{gentry} |
| 38 |
|
| 39 |
\begin{gentry}{codea} |
| 40 |
This one is a duplicate! This creates a `'multiple defined'' labels Warning! |
| 41 |
\end{gentry} |
| 42 |
|
| 43 |
\begin{gentry}{codeb} |
| 44 |
This is the second gentry. |
| 45 |
|
| 46 |
Turn to \turnto{codec} |
| 47 |
|
| 48 |
Turn to \turnto{coded} |
| 49 |
\end{gentry} |
| 50 |
|
| 51 |
\begin{gentry}{codec}[You lose!] |
| 52 |
This is the third gentry. |
| 53 |
|
| 54 |
You can't escape from here. |
| 55 |
\end{gentry} |
| 56 |
|
| 57 |
\begin{gentry}[123]{coded}[You win!] |
| 58 |
This is the second and final gentryraph. |
| 59 |
|
| 60 |
To play again, turn to \turnto{codea} |
| 61 |
|
| 62 |
(Note that this is the wrong number due to the duplicate label) |
| 63 |
\end{gentry} |
| 64 |
|
| 65 |
\section*{Here is the result:} |
| 66 |
|
| 67 |
\thegentries |
| 68 |
\eject |
| 69 |
|
| 70 |
For my next trick, here are some longer and multi-page examples. |
| 71 |
|
| 72 |
Note the location of the footnotes in these entries. |
| 73 |
|
| 74 |
\begin{gentry}{restart}\noentryfoot |
| 75 |
This is the first gentryraph again. |
| 76 |
\lipsum[1]\footnote{First footnote, forced to page end} |
| 77 |
\end{gentry} |
| 78 |
|
| 79 |
\begin{gentry}{restart2} |
| 80 |
\lipsum[2-7]\footnote{This is just Lorum Ipsum\footnote{Nonsense |
| 81 |
pseudo-latin, with roughly English letter distribution, commonly |
| 82 |
used to compare fonts\footnotemark.\footnotetext{Here, it's just nonsense.}}} |
| 83 |
\end{gentry} |
| 84 |
|
| 85 |
\newcounter{foo} |
| 86 |
\newcounter{bar} |
| 87 |
\setcounter{foo}{3} |
| 88 |
\setcounter{bar}{3} |
| 89 |
\newcommand{\gentrytst}[2]{ |
| 90 |
\begin{gentry}{restart#1} |
| 91 |
\lipsum[#1]\footnote{This was gentry #1} |
| 92 |
\lipsum[#1-#2]\footnote{This was also gentry #1} |
| 93 |
\end{gentry} |
| 94 |
} |
| 95 |
\whiledo{\not{\value{foo}>10}}{ |
| 96 |
\stepcounter{foo} |
| 97 |
\stepcounter{bar} |
| 98 |
\stepcounter{bar} |
| 99 |
\edef\idx{\arabic{foo}} |
| 100 |
\edef\idxx{\arabic{bar}} |
| 101 |
\expandafter\gentrytst\expandafter{\idx}{\idxx} |
| 102 |
} |
| 103 |
|
| 104 |
\section*{Here is the result:} |
| 105 |
|
| 106 |
\thegentries |
| 107 |
\vfill |
| 108 |
|
| 109 |
\end{document} |