summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/he-she/he-she.sty
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/he-she/he-she.sty
Initial commit
Diffstat (limited to 'macros/latex/contrib/he-she/he-she.sty')
-rw-r--r--macros/latex/contrib/he-she/he-she.sty404
1 files changed, 404 insertions, 0 deletions
diff --git a/macros/latex/contrib/he-she/he-she.sty b/macros/latex/contrib/he-she/he-she.sty
new file mode 100644
index 0000000000..93100aa1f7
--- /dev/null
+++ b/macros/latex/contrib/he-she/he-she.sty
@@ -0,0 +1,404 @@
+% This package implements a version of semi-automatic pronoun switching for writing
+% gender-neutral (and possibly annoying) prose.
+% The basic code is due to Josef (no last name) and Martin Scharrer on
+% http://tex.stackexchange.com/questions/10787/
+%
+% Modified to handle anaphoric reference to the current gender plus
+% all three case forms in both uppercase and lowercase.
+% Includes an option to flag to turn off xspace, and a silly option for replacing
+% all pronouns with 'they/them/their'.
+%
+% Copyright 2011, 2013, 2016 by Alan Munn
+%
+% This package may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or any later version.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+% This package has the LPPL maintenance status `maintained'.
+%
+% The Current Maintainer of this package is Alan Munn.
+%
+% This package consists of the file he-she.sty and documentation files
+% he-she.tex and he-she.pdf
+%
+% Option noxspace
+%
+% xspace can cause problems if the macro is e.g. enclosed in other markup such
+% as \emph{}. The noxspace option turns off the xspace and forces users to
+% insert a following space using "\ " explicitly. Default is to enable xspace.
+%
+% With the default option, the \xspace can be suppressed with the \xspacefalse
+% command as needed.
+%
+% Option they
+%
+% When you get tired of of alternating genders, you can switch to
+% this option, which will replace all of the relevant pronouns with the third
+% person plural pronoun form ('they/them/their/theirs'). Note that for the nominative
+% this will cause your document to produce ungrammatical text, since there is
+% no way to fix the subject/verb agreement.
+%
+% As a result, this is probably not intended to be a robust alternative!
+% You have been warned! (And you will be if you use it too.)
+%
+% Version history
+% Version 1.0 2011/02/13 Initial release.
+% Version 1.1 2013/03/04 Added [para] option and reflexive forms.
+% Version 1.1b 2013/06/11 Fixed bug with [para] option (thanks to Enrico Gregorio)
+% Version 1.2 2016/05/25 Added \hishers, \hers and \hiss commands
+% (thanks to Mike Sabin for the feature request)
+% Version 1.3 2016/06/06 Added a \setgender command to make choosing the gender more user friendly.
+% Documentation rewritten to reflect this change. All internal macros have now been prefixed with HS@
+% User level access to the booleans is now through \setgender although the old booleans are emulated
+% for backwards compatibility.
+% (thanks to Sefarin James for the feature request)
+%
+\ProvidesPackage{he-she}[2016/06/06 Semi-automatic pronoun switching with anaphora v1.3]
+\RequirePackage{xspace}
+\newif\ifxspace\xspacetrue
+\newif\ifHS@they\HS@theyfalse
+\newif\ifHS@para
+\DeclareOption{noxspace}{\xspacefalse}
+\DeclareOption{they}{%
+ \HS@theytrue
+ \PackageWarning{he-she}{*** WARNING: Use of option `\CurrentOption` will screw up subject/verb agreement for most nominative pronouns. It is only present for for its comic value! USE AT YOUR OWN RISK! ***}
+}
+%
+\DeclareOption{para}{
+ \HS@paratrue
+ \PackageWarning{he-she}{*** WARNING: Use the `\CurrentOption` at your own risk. With this option you should use *only* the anaphoric versions of the pronouns in your text. ***}}
+%
+\DeclareOption*{%
+ \PackageWarning{he-she}{Unknown option `\CurrentOption`}%
+}
+\ProcessOptions
+% toggle for changing the gender
+\newif\ifHS@he\HS@hetrue
+
+% macro to get first character of a token
+\def\HS@getfirst#1{\HS@fstx#1\empty\empty}
+\def\HS@fstx#1#2\empty{%
+ \edef\HS@fst{#1}}
+
+% macros for comparison
+\def\HS@Masc{M}
+\def\HS@masc{m}
+\def\HS@Fem{F}
+\def\HS@fem{f}
+
+% command to set gender (takes Male/M Female/F etc. or lowercase version of each)
+% expands argument first to allow it to be a macro
+\newcommand\setgender[1]{%
+\edef\next{\noexpand\HS@setgender{#1}}\next}
+\newcommand\HS@setgender[1]{%
+\HS@getfirst{#1}
+\ifx\HS@fst\HS@Masc \global\HS@hefalse
+ \else
+ \ifx\HS@fst\HS@masc \global\HS@hefalse
+ \else
+ \ifx\HS@fst\HS@Fem \global\HS@hetrue
+ \else
+ \ifx\HS@fst\HS@fem \global\HS@hetrue
+ \else
+ \global\HS@hetrue
+ \PackageWarning{he-she}{Invalid value for gender. Using Masculine}
+ \fi
+ \fi
+ \fi
+ \fi
+}
+
+%
+%
+\ifHS@para%
+ \RequirePackage{everyhook}
+ \PushPreHook{par}{\makebox[0pt][0pt]{\xspacefalse\heshe}}
+\fi
+\ifHS@they
+% Implement the (somewhat useless) 'they' option
+%
+\newcommand*{\heshe}{they\ifxspace\xspace\fi}
+\newcommand*{\Heshe}{They\ifxspace\xspace\fi}
+\newcommand*{\himher}{them\ifxspace\xspace\fi}
+\newcommand*{\himherself}{themselves\ifxspace\xspace\fi}
+\newcommand*{\Himher}{Them\ifxspace\xspace\fi}
+\newcommand*{\Himherself}{Themselves\ifxspace\xspace\fi}
+\newcommand*{\hisher}{their\ifxspace\xspace\fi}
+\newcommand*{\hishers}{theirs\ifxspace\xspace\fi}
+\newcommand*{\Hisher}{Their\ifxspace\xspace\fi}
+\newcommand*{\Hishers}{Theirs\ifxspace\xspace\fi}
+\newcommand*{\he}{they\ifxspace\xspace\fi}
+\newcommand*{\He}{They\ifxspace\xspace\fi}
+\newcommand*{\him}{them\ifxspace\xspace\fi}
+\newcommand*{\himself}{themselves\ifxspace\xspace\fi}
+\newcommand*{\Him}{Them\ifxspace\xspace\fi}
+\newcommand*{\Himself}{Themselves\ifxspace\xspace\fi}
+\newcommand*{\his}{their\ifxspace\xspace\fi}
+\newcommand*{\hiss}{theirs\ifxspace\xspace\fi}
+\newcommand*{\His}{Their\ifxspace\xspace\fi}
+\newcommand*{\Hiss}{Theirs\ifxspace\xspace\fi}
+%
+\else
+%
+% Lowercase versions:
+%
+% Nominative lowercase switching form \heshe
+\newcommand*{\heshe}{%
+ \leavevmode
+ \ifHS@he
+ he%
+ \global\HS@hefalse%
+ \else
+ she%
+ \global\HS@hetrue%
+ \fi
+ \ifxspace\xspace\fi
+}
+%
+% Nominative lowercase anaphoric form \he
+\newcommand*\he{%
+ \leavevmode
+ \ifHS@he
+ she%
+ \else
+ he%
+ \fi
+ \ifxspace\xspace\fi
+}
+%
+% Accusative lowercase switching form \himher
+\newcommand*\himher{%
+ \leavevmode
+ \ifHS@he
+ him%
+ \global\HS@hefalse%
+ \else
+ her%
+ \global\HS@hetrue%
+ \fi
+ \ifxspace\xspace\fi
+}%
+% Lowercase switching reflexive form \himherself
+%
+\newcommand*\himherself{%
+ \leavevmode
+ \ifHS@he
+ herself%
+ \else
+ himself%
+ \fi
+ \ifxspace\xspace\fi
+}
+%
+% Accusative lowercase anaphoric form \him
+\newcommand*\him{%
+ \leavevmode
+ \ifHS@he
+ her%
+ \else
+ him%
+ \fi
+ \ifxspace\xspace\fi
+}
+% Lowercase anaphoric reflexive form \himself
+%
+\newcommand*\himself{%
+ \leavevmode
+ \ifHS@he
+ herself%
+ \else
+ himself%
+ \fi
+ \ifxspace\xspace\fi
+}
+%
+% Genitive lowercase switching form \hisher
+\newcommand*\hisher{%
+ \leavevmode
+ \ifHS@he
+ his%
+ \global\HS@hefalse%
+ \else
+ her%
+ \global\HS@hetrue%
+ \fi
+ \ifxspace\xspace\fi
+}
+%
+% Genitive lowercase anaphoric form \his
+\newcommand*\his{%
+ \leavevmode
+ \ifHS@he
+ her%
+ \else
+ his%
+ \fi
+ \ifxspace\xspace\fi
+}
+%
+% Genitive null NP form ('The car is his/hers')
+% Genitive lowercase switching form \hishers
+\newcommand*\hishers{%
+ \leavevmode
+ \ifHS@he
+ his%
+ \global\HS@hefalse%
+ \else
+ hers%
+ \global\HS@hetrue%
+ \fi
+ \ifxspace\xspace\fi
+}
+%
+% Genitive lowercase anaphoric form \hiss
+\newcommand*\hiss{%
+ \leavevmode
+ \ifHS@he
+ hers%
+ \else
+ his%
+ \fi
+ \ifxspace\xspace\fi
+}
+%
+% Uppercase versions:
+%
+% Nominative uppercase switching form \Heshe
+\newcommand*{\Heshe}{%
+ \leavevmode
+ \ifHS@he
+ He%
+ \global\HS@hefalse%
+ \else
+ She%
+ \global\HS@hetrue%
+ \fi
+ \ifxspace\xspace\fi
+}
+%
+% Nominative uppercase anaphoric form \He
+\newcommand*\He{%
+ \leavevmode
+ \ifHS@he
+ She%
+ \else
+ He%
+ \fi
+ \ifxspace\xspace\fi
+}
+%
+% Accusative uppercase switching form \Himher
+\newcommand*\Himher{%
+ \leavevmode
+ \ifHS@he
+ Him%
+ \global\HS@hefalse%
+ \else
+ Her%
+ \global\HS@hetrue%
+ \fi
+ \ifxspace\xspace\fi
+}%
+
+% Uppercase switching reflexive form \Himherself
+%
+\newcommand*\Himherself{%
+ \leavevmode
+ \ifHS@he
+ Herself%
+ \else
+ Himself%
+ \fi
+ \ifxspace\xspace\fi
+}
+%
+% Accusative uppercase anaphoric form \Him
+\newcommand*\Him{%
+ \leavevmode
+ \ifHS@he
+ Her%
+ \else
+ Him%
+ \fi
+ \ifxspace\xspace\fi
+}
+%
+% Uppercase anaphoric reflexive form \Himself
+%
+\newcommand*\Himself{%
+ \leavevmode
+ \ifHS@he
+ Herself%
+ \else
+ Himself%
+ \fi
+ \ifxspace\xspace\fi
+}
+%
+% Genitive uppercase switching form \Hisher
+\newcommand*\Hisher{%
+ \leavevmode
+ \ifHS@he
+ His%
+ \global\HS@hefalse%
+ \else
+ Her%
+ \global\HS@hetrue%
+ \fi
+ \ifxspace\xspace\fi
+}
+%
+% Genitive uppercase anaphoric form \His
+\newcommand*\His{%
+ \leavevmode
+ \ifHS@he
+ Her%
+ \else
+ His%
+ \fi
+ \ifxspace\xspace\fi
+}
+% Genitive null NP form ('The car is his/hers')
+% Genitive uppercase switching form \Hishers
+\newcommand*\Hishers{%
+ \leavevmode
+ \ifHS@he
+ His%
+ \global\HS@hefalse%
+ \else
+ Hers%
+ \global\HS@hetrue%
+ \fi
+ \ifxspace\xspace\fi
+}
+%
+% Genitive uppercase anaphoric form \Hiss
+\newcommand*\Hiss{%
+ \leavevmode
+ \ifHS@he
+ Hers%
+ \else
+ His%
+ \fi
+ \ifxspace\xspace\fi
+}
+\fi
+% Define synonyms
+\let\she\he
+\let\She\He
+\let\her\him
+\let\herself\himself
+\let\Her\Him
+\let\Herself\Himself
+\let\hir\his
+\let\Hir\His
+\let\hers\hiss
+\let\Hers\Hiss
+% These for backward compatibility to previous versions
+\newcommand*\hetrue{\setgender{F}}
+\newcommand*\hefalse{\setgender{M}}
+\endinput \ No newline at end of file