| 1 |
% \iffalse |
| 2 |
%<*docdriver> |
| 3 |
\documentclass{ltxdoc}[1996/01/11] |
| 4 |
\begin{filecontents}{eemeir.ins} |
| 5 |
% The eemeir package, version 1.1 |
| 6 |
\input docstrip.tex |
| 7 |
\preamble |
| 8 |
|
| 9 |
m This is the E-Em-Eir package |
| 10 |
o Copyright 2003-07 by Mogens Lemvig Hansen, |
| 11 |
g Please find my e-mail address in the left margin |
| 12 |
e |
| 13 |
n Run eemeir.dtx through LaTeX and read the documentation in eemeir.dvi |
| 14 |
s |
| 15 |
@ This work may be distributed and/or modified under the |
| 16 |
k conditions of the LaTeX Project Public License, either version 1.3 |
| 17 |
a of this license or (at your option) any later version. |
| 18 |
y The latest version of this license is in |
| 19 |
j http://www.latex-project.org/lppl.txt |
| 20 |
u and version 1.3 or later is part of all distributions of LaTeX |
| 21 |
. version 2003/12/01 or later. |
| 22 |
c |
| 23 |
o This work has the LPPL maintenance status 'maintained'. |
| 24 |
m |
| 25 |
The Current Maintainer of this work is Mogens Lemvig Hansen. |
| 26 |
|
| 27 |
This work consists of the files eemeir.dtx and eemeir.ins |
| 28 |
and the derived file eemeir.sty. |
| 29 |
|
| 30 |
\endpreamble |
| 31 |
% I think that \path:twoup.sty: should go into the directory |
| 32 |
% \path:tex/latex/misc:; however, \textsc{DocStrip} will not heed my advise |
| 33 |
% unless your configuration file, \path:docstrip.cfg:, allows it to. |
| 34 |
\usedir{tex/latex/misc} |
| 35 |
\generate{\file{eemeir.sty}{\from{eemeir.dtx}{package}}} |
| 36 |
\endbatchfile |
| 37 |
\end{filecontents} |
| 38 |
\usepackage{url,randtext} |
| 39 |
\usepackage[male]{eemeir} |
| 40 |
\InputIfFileExists{../myemail}{}{% |
| 41 |
\def\myemail{See top of .sty file for e-mail address}} |
| 42 |
\CodelineIndex%\EnableCrossrefs |
| 43 |
\makeatletter |
| 44 |
\newcommand{\nextlinelabel}[2][1]{\@bsphack |
| 45 |
\@tempcnta\c@CodelineNo |
| 46 |
\advance\@tempcnta#1\relax |
| 47 |
\def\@currentlabel{\the\@tempcnta}\label{#2}% |
| 48 |
\@esphack} |
| 49 |
\makeatother |
| 50 |
\DocInput{eemeir.dtx} |
| 51 |
\end{document} |
| 52 |
%</docdriver> |
| 53 |
% \fi |
| 54 |
% \CharacterTable |
| 55 |
% {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 |
| 56 |
% 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 |
| 57 |
% Digits \0\1\2\3\4\5\6\7\8\9 |
| 58 |
% Exclamation \! Double quote \" Hash (number) \# |
| 59 |
% Dollar \$ Percent \% Ampersand \& |
| 60 |
% Acute accent \' Left paren \( Right paren \) |
| 61 |
% Asterisk \* Plus \+ Comma \, |
| 62 |
% Minus \- Point \. Solidus \/ |
| 63 |
% Colon \: Semicolon \; Less than \< |
| 64 |
% Equals \= Greater than \> Question mark \? |
| 65 |
% Commercial at \@ Left bracket \[ Backslash \\ |
| 66 |
% Right bracket \] Circumflex \^ Underscore \_ |
| 67 |
% Grave accent \` Left brace \{ Vertical bar \| |
| 68 |
% Right brace \} Tilde \~} |
| 69 |
% |
| 70 |
% \CheckSum{163} |
| 71 |
% \GetFileInfo{eemeir.sty} \def\docdate{\filedate} |
| 72 |
% \iffalse |
| 73 |
%<package>\NeedsTeXFormat{LaTeX2e} |
| 74 |
%<package>\ProvidesPackage{eemeir}[2007/02/19 v1.1 E-Em-Eir package] |
| 75 |
% \fi |
| 76 |
% \title{The E--Em--Eir package^^A |
| 77 |
% \thanks{This file describes version \fileversion, \filedate.} |
| 78 |
% } |
| 79 |
% \author{\copyright\ Mogens Lemvig Hansen\\\myemail} |
| 80 |
% \date{\docdate} |
| 81 |
% |
| 82 |
% \MakeShortVerb{\"} |
| 83 |
% \setcounter{secnumdepth}{-99} |
| 84 |
% |
| 85 |
% \newenvironment{example} |
| 86 |
% {\begin{quote}\raggedright\ttfamily} |
| 87 |
% {\end{quote}} |
| 88 |
% \newenvironment{syntax} |
| 89 |
% {\begin{quote}} |
| 90 |
% {\end{quote}} |
| 91 |
% |
| 92 |
% \begin{document} |
| 93 |
% \maketitle |
| 94 |
% \begin{abstract} |
| 95 |
% The \textsf{E--Em--Eir} package facilitates writing documents that |
| 96 |
% must be produced in both a male and a female form by providing |
| 97 |
% natural and easily remembered commands (control sequences) to |
| 98 |
% type in place of gender specific words. |
| 99 |
% \end{abstract} |
| 100 |
% |
| 101 |
% |
| 102 |
% I had occasion to write a couple of documents that needed to be printed |
| 103 |
% in both a male and a female version. To accomplish that conveniently, |
| 104 |
% I developed this \textsf{E--Em--Eir} package which |
| 105 |
% provides four commands, |
| 106 |
% \DescribeMacro{\E} |
| 107 |
% \DescribeMacro{\Em} |
| 108 |
% \DescribeMacro{\Eir} |
| 109 |
% \DescribeMacro{\Eirs} |
| 110 |
% "\E", "\Em", "\Eir", and "\Eirs", |
| 111 |
% that expand to personal pronouns depending on gender as follows: |
| 112 |
% \begin{center} |
| 113 |
% \begin{tabular}{lcc} |
| 114 |
% & Male& Female\\[2pt] |
| 115 |
% "\E" & he & she\\ |
| 116 |
% "\Em" & him & her\\ |
| 117 |
% "\Eir" & his & her\\ |
| 118 |
% "\Eirs" & his & hers |
| 119 |
% \end{tabular} |
| 120 |
% \end{center} |
| 121 |
% Thus, |
| 122 |
% just as `I' is the first person singular pronoun, regardless of gender, so |
| 123 |
% "\E" stands the third person singular pronoun for both genders: |
| 124 |
% "\E" is the singular of `they'. Accordingly, "\Eir" and |
| 125 |
% "\Eirs" (pronounced to |
| 126 |
% rhyme with `their(s)') are the possessives, and "\Em" (rhyming with |
| 127 |
% `them') stands for either `him' or `her'.\footnote{I first encountered |
| 128 |
% the pronouns `E', `Em', and `Eir' in M.D.~Spivak's \emph{The Joy of \TeX} |
| 129 |
% and I have adapted the description of those pronouns from there.} |
| 130 |
% |
| 131 |
% For example, |
| 132 |
% \begin{example} |
| 133 |
% The user neglects reading the documentation at |
| 134 |
% "\Eir" peril |
| 135 |
% \end{example} |
| 136 |
% expands to ``The user neglects reading the documentation at his peril'' |
| 137 |
% or ``The user neglects reading the documentation at her peril'' |
| 138 |
% depending on gender. |
| 139 |
% Note that "\Eir" (and the other pronoun commands) automatically |
| 140 |
% add a space after the pronoun where appropriate.\footnote{Curtesy of |
| 141 |
% David Carlisle's \textsf{xspace} package |
| 142 |
% which is required by the \textsf{E--Em--Eir} |
| 143 |
% package and included in most distributions of \TeX.} |
| 144 |
% |
| 145 |
% \DescribeMacro{\swapgender} |
| 146 |
% You can change gender~(!) mid stream with the "\swapgender" command. |
| 147 |
% Thus |
| 148 |
% \begin{example} |
| 149 |
% "\E*" loves "\swapgender\Em" for "\Eir" body |
| 150 |
% \end{example} |
| 151 |
% expands to either ``She loves him for his body'' or ``He loves her for her body.'' |
| 152 |
% Note that the starred form of the pronoun commands yields a capitalized pronoun. |
| 153 |
% The "\swapgender" command is a \emph{declaration} like "\large": |
| 154 |
% its effect lasts until the end of the enclosing block (or until the |
| 155 |
% gender is explicitly changed again). |
| 156 |
% \DescribeEnv{swapgender} |
| 157 |
% Like the font size commands, you can also use an environment |
| 158 |
% form: |
| 159 |
% \begin{example} |
| 160 |
% "\E*" always praises "\begin{swapgender}" "\Eir" cooking; and |
| 161 |
% "\E" "\end{swapgender}" loves "\Em" for it. |
| 162 |
% \end{example} |
| 163 |
% expands to ``She always praises his cooking; and he loves her for it.'' |
| 164 |
% |
| 165 |
% \DescribeMacro{\newwordpair} |
| 166 |
% You can easily add more commands like "\E" and friends. For |
| 167 |
% example, |
| 168 |
% \begin{example} |
| 169 |
% "\newwordpair{\child}{son}{daughter}" |
| 170 |
% |
| 171 |
% You say your "\child's" name and |
| 172 |
% "\E" is marked with God's sign so that God knows |
| 173 |
% "\Em" as His own. Thus, the Sign of the Cross is a promise that God's |
| 174 |
% love can always find your "\child." |
| 175 |
% \end{example} |
| 176 |
% expands to ``You say your daughter's name and |
| 177 |
% she is marked with God's sign so that God knows |
| 178 |
% her as His own. Thus, the Sign of the Cross is a promise that God's |
| 179 |
% love can always find your daughter\@.''\ in the female case. |
| 180 |
% You could also write "grand\child" for grandson or |
| 181 |
% granddaughter, etc. |
| 182 |
% |
| 183 |
% Other extensions come to mind: |
| 184 |
% \begin{example} |
| 185 |
% "\newwordpair{\parent}{father}{mother}"\\ |
| 186 |
% "\newwordpair{\spouse}{husband}{wife}"\\ |
| 187 |
% "\newwordpair{\sibling}{brother}{sister}"\\ |
| 188 |
% "\newwordpair{\nogoodnameforthisone}{nephew}{niece}"\\ |
| 189 |
% "\newwordpair{\orforthis}{uncle}{aunt}"\\ |
| 190 |
% "\newwordpair{\Mx}{Mr}{Ms}" |
| 191 |
% \end{example} |
| 192 |
% Each command defined by "\newwordpair" adds a space after the |
| 193 |
% word where appropriate, and each has a starred form that capitalizes |
| 194 |
% the word. |
| 195 |
% \DescribeMacro{\renewwordpair} |
| 196 |
% There is also a "\renewwordpair" command if you should want to re-define |
| 197 |
% a command. |
| 198 |
% |
| 199 |
% \DescribeMacro{\ifmale} |
| 200 |
% The commands defined by "\newwordpair" are intended to supply a single |
| 201 |
% gender-specific word. |
| 202 |
% If a whole phrase needs to be different, you can use |
| 203 |
% the "\ifmale"--"\else"--"\fi" construct: |
| 204 |
% \begin{example} |
| 205 |
% \dots "\E" is expected to wear\verb*: \ifmale: smoking, |
| 206 |
% patent leather shoes, and top hat"\else" |
| 207 |
% full-length evening gown\verb*:\fi\ :for the gala. |
| 208 |
% \end{example} |
| 209 |
% This construct is provided by plain \TeX, so avoiding spurious spaces |
| 210 |
% is the user's responsibility. |
| 211 |
% If you find yourself using this construct often, you should have a look |
| 212 |
% at the \textsf{optional} package and\slash or the \textsf{version} package. |
| 213 |
% |
| 214 |
% You set the gender when you load the \textsf{E--Em--Eir} package with |
| 215 |
% "\usepackage" in the preamble: |
| 216 |
% \begin{syntax} |
| 217 |
% "\usepackage"\oarg{option}"{"\textsf{eemeir}"}" |
| 218 |
% \end{syntax} |
| 219 |
% The \meta{option} can be one of |
| 220 |
% "male", "female", or the default, "ask". |
| 221 |
% \DescribeMacro{\male} |
| 222 |
% \DescribeMacro{\female} |
| 223 |
% \DescribeMacro{\askforgender} |
| 224 |
% You can also set the gender (at any reasonable place in your document) with |
| 225 |
% one of the commands "\male", "\female", or "\askforgender"---and |
| 226 |
% don't forget "\swapgender". |
| 227 |
% |
| 228 |
% \DescribeMacro{\male[...]} |
| 229 |
% \DescribeMacro{\female[...]} |
| 230 |
% A document can of course refer to the gender of more than one |
| 231 |
% person. The \textsf{E--Em--Eir} package can therefore keep track of |
| 232 |
% more than one person: Define a new person by giving an optional |
| 233 |
% argument to "\male", "\female", or "\askforgender". |
| 234 |
% Then give the same optional argument to "\E" or any other command |
| 235 |
% defined by "\newwordpair" to use the gender of that person. |
| 236 |
% For example, |
| 237 |
% \begin{example} |
| 238 |
% "\female[pastor]" |
| 239 |
% |
| 240 |
% Let your "\child" face the pastor so "\E[pastor]" |
| 241 |
% can\dots |
| 242 |
% \end{example} |
| 243 |
% expands to ``Let your son face the pastor so she can\dots''\ if the |
| 244 |
% main gender is male and "\child" has been defined as above. |
| 245 |
% Once you have set the gender of a new person with, say, |
| 246 |
% "\female[pastor]", you can change the gender with |
| 247 |
% "\swapgender[pastor]" (or "\begin{swapgender}[pastor]"\dots) and |
| 248 |
% the "\ifmale" construct for this person becomes |
| 249 |
% "\ifmalepastor"--"\else"--"\fi". |
| 250 |
% |
| 251 |
% |
| 252 |
% \section{Summary} |
| 253 |
% \DescribeMacro{\newwordpair} |
| 254 |
% \DescribeMacro{\renewwordpair} |
| 255 |
% Define new commands or re-define old ones with |
| 256 |
% \begin{syntax} |
| 257 |
% "\newwordpair"\marg{cmd}\marg{male}\marg{female}\\ |
| 258 |
% "\renewwordpair"\marg{cmd}\marg{male}\marg{female} |
| 259 |
% \end{syntax} |
| 260 |
% Then \meta{cmd} is used like |
| 261 |
% \begin{syntax} |
| 262 |
% \meta{cmd}\oarg{person}\\ |
| 263 |
% \meta{cmd}"*"\oarg{person} |
| 264 |
% \end{syntax} |
| 265 |
% The un-starred version expands to \meta{male} or \meta{female} depending on |
| 266 |
% the current gender of \meta{person} or the main gender in the absence of the |
| 267 |
% optional argument. Similarly, the starred version expands to \meta{male} or |
| 268 |
% \meta{female} with the first letter capitalized.\footnote{If you |
| 269 |
% want more than just the first letter capitalized, enclose the |
| 270 |
% desired letters in braces: |
| 271 |
% If |
| 272 |
% \texttt{\bslash newwordpair\{\bslash |
| 273 |
% strange\}\{\{ab\}cd\}\{\{def\}gh\}}, |
| 274 |
% then \texttt{\bslash strange*} expands |
| 275 |
% to ``ABcd'' or ``DEFgh''.} |
| 276 |
% |
| 277 |
% \DescribeMacro{\male} |
| 278 |
% \DescribeMacro{\female} |
| 279 |
% \DescribeMacro{\askforgender} |
| 280 |
% You set the \meta{person} gender (or the main gender in the absence of the |
| 281 |
% optional argument) with one of the commands |
| 282 |
% \begin{syntax} |
| 283 |
% "\male"\oarg{person}\\ |
| 284 |
% "\female"\oarg{person}\\ |
| 285 |
% "\askforgender"\oarg{person} |
| 286 |
% \end{syntax} |
| 287 |
% You can also set the main gender with one of the options "male", |
| 288 |
% "female", or "ask" (the default) when you load the \textsf{E--Em--Eir} |
| 289 |
% package. |
| 290 |
% \DescribeMacro{\swapgender}\DescribeEnv{swapgender} |
| 291 |
% Once a gender has been set, you can change it with |
| 292 |
% \begin{syntax} |
| 293 |
% "\swapgender"\oarg{person} |
| 294 |
% \end{syntax} |
| 295 |
% or |
| 296 |
% \begin{syntax} |
| 297 |
% "\begin{swapgender}"\oarg{person} \dots "\end{swapgender}" |
| 298 |
% \end{syntax} |
| 299 |
% |
| 300 |
% \DescribeMacro{\ifmale[...]} |
| 301 |
% If you have longer passages that are gender specific, you can |
| 302 |
% enclose them in "\ifmale"\meta{person}--"\else"--"\fi" or |
| 303 |
% "\ifmale"--"\else"--"\fi" in case of the main gender. If you use |
| 304 |
% this construct often, either you have misunderstood the purpose of |
| 305 |
% the \textsf{E--Em--Eir} package or I should extend it with some suitable |
| 306 |
% environment for conditional inclusion of blocks of text. Let me |
| 307 |
% know\dots |
| 308 |
% |
| 309 |
% \section{Installation} |
| 310 |
% As you must have figured, you |
| 311 |
% generate the documentation for the \textsf{E--Em--Eir} package |
| 312 |
% by running the file \url:eemeir.dtx: through |
| 313 |
% \LaTeX---twice to resolve cross references.\footnote{If you want an index, |
| 314 |
% you must run MakeIndex |
| 315 |
% (\texttt{makeindex -s gind.ist eemeir}) between the two |
| 316 |
% \LaTeX{} runs.} |
| 317 |
% |
| 318 |
% To extract the \url{.sty} file from \url{eemeir.dtx}, |
| 319 |
% run \url:eemeir.ins: through \LaTeX. |
| 320 |
% You now have to decide what to do with several files. |
| 321 |
% \begin{itemize} |
| 322 |
% \item Move the file \url:eemeir.sty: to some |
| 323 |
% directory where \LaTeX\ can find it; the natural choice would be |
| 324 |
% \url:(local)texmf/tex/latex/misc:. |
| 325 |
% \item Move the documentation, \url:eemeir.dvi:, to |
| 326 |
% \url:(local)texmf/doc/latex/misc:. |
| 327 |
% \item You may discard the source files, \url:eemeir.dtx: and |
| 328 |
% \url:eemeir.ins:, or store them in |
| 329 |
% \url:(local)texmf/source/latex/misc:. |
| 330 |
% \end{itemize} |
| 331 |
% |
| 332 |
% \section{License}\label{sec:license} |
| 333 |
% This program may be distributed and/or modified under the |
| 334 |
% conditions of the \LaTeX\ Project Public License, either version 1.3 |
| 335 |
% of this license or (at your option) any later version. |
| 336 |
% The latest version of this license is in |
| 337 |
% \url;http://www.latex-project.org/lppl.txt; |
| 338 |
% and version 1.3 or later is part of all distributions of \LaTeX \ |
| 339 |
% version 2003/12/01 or later. |
| 340 |
% |
| 341 |
% This program consists of the files \url:eemeir.dtx: and |
| 342 |
% \url:eemeir.ins:. |
| 343 |
% |
| 344 |
% \StopEventually{ |
| 345 |
% \PrintIndex |
| 346 |
% } |
| 347 |
% |
| 348 |
% \section{Implementation} |
| 349 |
% \begin{macro}{\@eemeir} |
| 350 |
% \begin{macro}{\@eemeirM} |
| 351 |
% \begin{macro}{\@eemeirF} |
| 352 |
% We need a few control sequences for temporary storage. Define |
| 353 |
% them first with "\newcommand" to verify that they are not in use. |
| 354 |
% \begin{macrocode} |
| 355 |
%<*package> |
| 356 |
\newcommand{\@eemeir}{\relax} |
| 357 |
\newcommand{\@eemeirM}{\relax} |
| 358 |
\newcommand{\@eemeirF}{\relax} |
| 359 |
% \end{macrocode} |
| 360 |
% \end{macro}\end{macro}\end{macro} |
| 361 |
% Then declare the options. |
| 362 |
% \begin{macrocode} |
| 363 |
\DeclareOption{male} {\def\@eemeir{\male[]}} |
| 364 |
\DeclareOption{female}{\def\@eemeir{\female[]}} |
| 365 |
\DeclareOption{ask} {\def\@eemeir{\askforgender[]}} |
| 366 |
\ExecuteOptions{ask} |
| 367 |
% \end{macrocode} |
| 368 |
% No matter how many options are processed, in the end "\@eemeir" |
| 369 |
% will (obviously) contain only one of "\male[]", "\female[]", or |
| 370 |
% "\askforgender[]". On code line~\ref{ln:@eemeir} we'll call on |
| 371 |
% "\@eemeir" to set the main gender. |
| 372 |
% \begin{macrocode} |
| 373 |
\ProcessOptions |
| 374 |
\RequirePackage{xspace} |
| 375 |
% \end{macrocode} |
| 376 |
% \begin{macro}{\male} |
| 377 |
% We use "\@bsphack" and "\@esphack" to ensure that in things like |
| 378 |
% \verb*: \male[...] : only one of the spaces is typeset. |
| 379 |
% Below, "\ifmale#1" is "\ifmale" if the optional argument is |
| 380 |
% blank and "\ifmale"\meta{person} if the optional argument is |
| 381 |
% \meta{person}. |
| 382 |
% Thus, if "\ifmale#1" is undefined, we define a new person by |
| 383 |
% creating a new "\ifmale..." (and otherwise we "\relax"). |
| 384 |
% \begin{macrocode} |
| 385 |
\newcommand{\male}[1][]{% |
| 386 |
\@bsphack |
| 387 |
\@ifundefined{ifmale#1} |
| 388 |
{\expandafter\newif\csname ifmale#1\endcsname} |
| 389 |
{\relax}% |
| 390 |
% \end{macrocode} |
| 391 |
% Then set the switch to "true" by calling "\maletrue" or |
| 392 |
% "\male"\meta{person}"true" depending on the optional argument. |
| 393 |
% \begin{macrocode} |
| 394 |
\csname male#1true\endcsname |
| 395 |
\@esphack} |
| 396 |
% \end{macrocode} |
| 397 |
% \end{macro} |
| 398 |
% \begin{macro}{\female} |
| 399 |
% "\female" is similar; just set the switch with |
| 400 |
% "\male"\meta{person}"false". |
| 401 |
% \begin{macrocode} |
| 402 |
\newcommand{\female}[1][]{% |
| 403 |
\@bsphack |
| 404 |
\@ifundefined{ifmale#1} |
| 405 |
{\expandafter\newif\csname ifmale#1\endcsname} |
| 406 |
{\relax}% |
| 407 |
\csname male#1false\endcsname |
| 408 |
\@esphack} |
| 409 |
% \end{macrocode} |
| 410 |
% \end{macro} |
| 411 |
% \begin{macro}{\askforgender} |
| 412 |
% "\askforgender" begins just as "\male" and "\female". |
| 413 |
% \begin{macrocode} |
| 414 |
\newcommand{\askforgender}[1][]{% |
| 415 |
\@bsphack |
| 416 |
\@ifundefined{ifmale#1} |
| 417 |
{\expandafter\newif\csname ifmale#1\endcsname} |
| 418 |
{\relax}% |
| 419 |
% \end{macrocode} |
| 420 |
% Then use the temporary variable "\@eemeir" to help type out a |
| 421 |
% pretty message---and store the answer again in "\@eemeir". |
| 422 |
% \begin{macrocode} |
| 423 |
\def\@eemeir{#1}% |
| 424 |
\ifx\@eemeir\@empty\def\@eemeir{main}\fi |
| 425 |
\typein[\@eemeir]{Specify the \@eemeir\space gender:% |
| 426 |
\space\space male\space\space or\space\space female}% |
| 427 |
% \end{macrocode} |
| 428 |
% In order to provide a helpful error message if the user types |
| 429 |
% anything but ``male'' or ``female'', we must carefully compare the |
| 430 |
% answer against the legal ones; otherwise a call to |
| 431 |
% "\csname\@eemeir\endcsname[#1]" would have sufficed. |
| 432 |
% \begin{macrocode} |
| 433 |
\def\@eemeirM{male}% |
| 434 |
\def\@eemeirF{female}% |
| 435 |
\ifx\@eemeir\@eemeirM\male[#1]% |
| 436 |
\else\ifx\@eemeir\@eemeirF\female[#1]% |
| 437 |
\else\PackageError{eemeir} |
| 438 |
{I'll ignore that} |
| 439 |
{You should have typed either\space\space male\space\space |
| 440 |
or\space\space female}% |
| 441 |
\fi\fi |
| 442 |
\@esphack |
| 443 |
} |
| 444 |
% \end{macrocode} |
| 445 |
% \end{macro} |
| 446 |
% \begin{macro}{\swapgender} |
| 447 |
% \begin{environment}{swapgender} |
| 448 |
% "\newenvironment{swapgender}" defines the command "\swapgender" to |
| 449 |
% be called at the beginning of the environment (and another command |
| 450 |
% to call at the end). We therefore only have to worry about the |
| 451 |
% environment case. |
| 452 |
% Changing a gender that hasn't been set is meaningless, so |
| 453 |
% "swapgender" insists that "\ifmale#1" is defined. |
| 454 |
% \begin{macrocode} |
| 455 |
\newenvironment{swapgender}[1][]{% |
| 456 |
\@bsphack |
| 457 |
\@ifundefined{ifmale#1} |
| 458 |
{\PackageError{eemeir}{unknown gender: #1} |
| 459 |
{You must set the #1 gender with \string\male\space |
| 460 |
(or...) first.}} |
| 461 |
% \end{macrocode} |
| 462 |
% If it's defined, swap it. |
| 463 |
% \begin{macrocode} |
| 464 |
{\csname ifmale#1\endcsname\csname male#1false\endcsname |
| 465 |
\else\csname male#1true\endcsname\fi}% |
| 466 |
\@esphack} |
| 467 |
% \end{macrocode} |
| 468 |
% The "\end{swapgender}" only has to close the group (which is done |
| 469 |
% by \LaTeX\ automatically) and use the space hacks to ensure that |
| 470 |
% only one space is typeset in cases like \verb*: \end{swapgender} :. |
| 471 |
% \begin{macrocode} |
| 472 |
{\@bsphack\@Esphack} |
| 473 |
% \end{macrocode} |
| 474 |
% \end{environment}\end{macro} |
| 475 |
% \begin{macro}{\newwordpair} |
| 476 |
% \begin{macro}{\renewwordpair} |
| 477 |
% "\newwordpair" and "\renewwordpair" differ only in which command |
| 478 |
% they employ to make the definition. |
| 479 |
% \begin{macrocode} |
| 480 |
\newcommand{\newwordpair} {\@newwordpair\newcommand} |
| 481 |
\newcommand{\renewwordpair}{\@newwordpair\renewcommand} |
| 482 |
% \end{macrocode} |
| 483 |
% \begin{macro}{\@newwordpair} |
| 484 |
% The real work is done by "\@newwordpair": |
| 485 |
% This next line of code becomes |
| 486 |
% "\(re)newcommand"\marg{cmd}"{\@ifstar"\dots. |
| 487 |
% \begin{macrocode} |
| 488 |
\newcommand{\@newwordpair}[4]{% |
| 489 |
#1{#2}{\@ifstar |
| 490 |
% \end{macrocode} |
| 491 |
% The "\@ifstar" checks if \meta{cmd} is called with or without a |
| 492 |
% star and stores \meta{male} and \meta{female} in "\@eemeirM" and |
| 493 |
% "\@eemeirF", respectively. Then "\@eemeirword" is called to check |
| 494 |
% for optional arguments and finish the job. |
| 495 |
% \begin{macrocode} |
| 496 |
{\def\@eemeirM{\MakeUppercase#3}% |
| 497 |
\def\@eemeirF{\MakeUppercase#4}% |
| 498 |
\@eemeirword} |
| 499 |
{\def\@eemeirM{#3}% |
| 500 |
\def\@eemeirF{#4}% |
| 501 |
\@eemeirword}}% |
| 502 |
} |
| 503 |
% \end{macrocode} |
| 504 |
% \end{macro} |
| 505 |
% \begin{macro}{\@eemeirword} |
| 506 |
% As promised, "\@eemeirword" picks up the optional argument to |
| 507 |
% \meta{cmd}. If "\ifmale"\meta{person} is undefined, it's because |
| 508 |
% the user used \meta{cmd}\oarg{person} (something like "\E[pastor]") |
| 509 |
% before setting the gender of \meta{person} with "\male"\oarg{person} |
| 510 |
% or friends. Doing so is really naughty of the user, and maybe I'm |
| 511 |
% being too lenient letting Em get away with it by calling |
| 512 |
% "\askforgender"\oarg{person} for Em. |
| 513 |
% \begin{macrocode} |
| 514 |
\newcommand{\@eemeirword}[1][]{% |
| 515 |
\@ifundefined{ifmale#1} |
| 516 |
{\PackageWarning{eemeir} |
| 517 |
{You should set the #1 gender before using\MessageBreak it}% |
| 518 |
\askforgender[#1]} |
| 519 |
{\relax}% |
| 520 |
% \end{macrocode} |
| 521 |
% If "\ifmale"\meta{person} is true, set the word stored before in |
| 522 |
% "\@eemeirM"\@, otherwise use "\@eemeirF"\@. Then use "\xspace" from |
| 523 |
% the \textsf{xspace} package to insert a space if needed. |
| 524 |
% \begin{macrocode} |
| 525 |
\csname ifmale#1\endcsname\@eemeirM\else\@eemeirF\fi |
| 526 |
\xspace |
| 527 |
} |
| 528 |
% \end{macrocode} |
| 529 |
% \end{macro} |
| 530 |
% \end{macro}\end{macro} |
| 531 |
% \begin{macro}{\E} |
| 532 |
% \begin{macro}{\Em} |
| 533 |
% \begin{macro}{\Eir} |
| 534 |
% \begin{macro}{\Eirs} |
| 535 |
% Finally set up the commands that give this package its name |
| 536 |
% \begin{macrocode} |
| 537 |
\newwordpair{\E}{he}{she} |
| 538 |
\newwordpair{\Em}{him}{her} |
| 539 |
\newwordpair{\Eir}{his}{her} |
| 540 |
\newwordpair{\Eirs}{his}{hers} |
| 541 |
% \end{macrocode} |
| 542 |
% \end{macro}\end{macro}\end{macro}\end{macro} |
| 543 |
% and set the main gender according to |
| 544 |
% options.\nextlinelabel{ln:@eemeir} |
| 545 |
% \begin{macrocode} |
| 546 |
\@eemeir |
| 547 |
%</package> |
| 548 |
% \end{macrocode} |
| 549 |
% \Finale |