# Alternate he / she in text

This question led to a new package:
he-she

I have seen a book that instead of using the masculine pronoun (he, his, etc.) alternates the gender ('he' then 'she' then next time 'he' again).

Is there a way to do this with LaTeX - to use a placeholder that alternates between two predefined words?

(I'm looking for a pointer as to where to start.)

EDIT: There is a useful discussion in the comments to Martin's answer for how to relax the strict he/she alternate (which can be confusing if applied too strictly).

• I fully support the use of singular they instead. It avoids the problems with the gendered words; it's used in actual speech; it's the clearest option; and it's attested as far back as 1300, having been used by such notable authors as Chaucer and Shakespeare. Prescriptivism can go hang :-) – Antal Spector-Zabusky Feb 12 '11 at 4:59
• If you (unlike me) don't like Antal's suggestion, here's another one: Just use "she". This is also a lot clearer than switching. – Hendrik Vogt Feb 12 '11 at 7:50
• Just use he for every odd and she for every even chapter (or vice versa). It's the most simplest, least intrusive method which still is 100% "political correct". – Martin Scharrer Feb 12 '11 at 22:33
• Based on the discussion below, I've now implemented my solution as a package: he-she. – Alan Munn Feb 15 '11 at 13:19
• @Alan thanks for this - Also I have never put latex code into a package, your package provides a great example for me as to how to go about it. – Tom Feb 16 '11 at 9:57

Following up on the discussion about how to get this to work in practice, here's a modification to Josef's solution which allows one to use anaphoric pronouns linked to the current state. Pronominal anaphora is quite complicated, so even this solution would only work for a limited set of cases, but it would still be a bit of an improvement.

Update: I've implemented this solution as the he-she package.

The problem arises in sentences like the following:

1. If someone thinks \heshe is sick, he should go to the doctor.

(As Norman notes, it's perfectly colloquiual English to use 'they' for these sorts of pronouns, but since that's not up for debate here, we'll soldier on :-) )

In sentence (1) we need the pronoun in the main clause to match in gender with the pronoun in the 'if'-clause. If we use the \heshe macro we won't know what the gender is, however, since it will change depending on how many times it has previously been used.

So we really need two macros: one for the switch, and one for anaphoric reference to the current gender state. I've implemented this simply by creating one extra macro within Josef's solution (of course the same idea works for Martin's as well.)

    \documentclass{article}
\usepackage{xspace}
\newif\ifhe\hetrue
\newcommand*\heshe%
{%
\ifhe%
he%
\global\hefalse%
\else%
she%
\global\hetrue%
\fi%
\xspace
}%
\newcommand*\he%
{\ifhe%
she
\else%
he%
\fi
\xspace
}
\begin{document}

If someone thinks \heshe is sick \he should go to a doctor immediately.
When \he goes to the the doctor, \heshe can figure out the problem.
\end{document}


This is a more linguistically useful version than restricting the scope of the change to a single sentence, since in the second sentence of the source example, there are two instances of a pronoun: the first is anaphoric to the previous sentence (and so should match in gender, but the second can be assigned a new gender.)

• The \xspace must be the last command in the macros. It looks ahead (using \@ifnextchar, i.e. \futurelet) to see if it has to produce a space or not. Here it only sees \global, \else or \fi. – Martin Scharrer Feb 12 '11 at 22:30
• @Martin Thanks. I had just copied Josef's code. (Ironically, there are no places in which the nominative pronoun woul be followed by punctuation anyway except in the very prescriptive (and linguistically crazy) "John is taller than he."). – Alan Munn Feb 12 '11 at 22:53
• Ironic indeed. In that case it a normal \space should do it. – Martin Scharrer Feb 12 '11 at 22:56
• Hmm..what about "He, being taller than her, was able to reach the cookie jar." – emacsomancer Feb 13 '11 at 14:21
• @BeSlayed I knew claiming 'no places' would come back to bite me. :-) Since the \xspace does no real harm, it's fine to leave it in. (It does, however, pose other problems: for example \emph{\heshe}, will yield ' he , ' which is undesirable.) – Alan Munn Feb 13 '11 at 14:45

You can do this by defining an if-switch which toggles every time it is used:

\newif\iffemale
\usepackage{xspace}

\newcommand*\heorshe{%
\iffemale
she
\global\femalefalse% next one is male
\else
he
\global\femaletrue% next one is female
\fi
\xspace
}

% Capitalized version:
\newcommand*\Heorshe{%
\iffemale
She
\global\femalefalse
\else
He
\global\femaletrue
\fi
\xspace
}


edits: Added missing \global and \xspace.

• Haha latex is cool! Thank you Martin, just testing it now, I thought it would be a lot more complicated - I need to look up that \newif command. I have never seen that before. Thanks! – Tom Feb 10 '11 at 20:19
• I was going to add a similar answer but using counters instead of booleans. Yours is much clear. – fabikw Feb 10 '11 at 20:21
• That is not enough because you will need pronouns, posessive pronouns and all kind of other elements that depend on a gender. And they have to be aligned within once sentence. Therefore you have to switch at the end of a sentence and not at every use. I think it would be cool to have an \either{this/that} macro that picks either the first or the second choice and reverses that choice at the end of a sentence. This way you need just one macro (or maybe a second for the switching) and don't specialized macros for every case. – Christian Lindig Feb 10 '11 at 20:23
• @Leo My idea is that you write a sentence like this: \either{He/She} left the house and went to \either{his/her} car. To make any sense, I believe you have to consistently pick the first or the second choice within the sentence. However, in the next sentence you might pick the other choice (again, consistently). But might have misunderstood the intention of the question and @Tom wants to switch choices really at every possible occasion. That would lead to very difficult to read text. I'd design \either in a way that the switch is toggled at every \par. – Christian Lindig Feb 10 '11 at 20:46
• Thinking about it, I realize that it is probably better to use a star to mean "change the gender". I.e. \He did \his job so well that \he* got what \he* expected would give "She did her job so well that he got what she expected"... ok, that sounds odd, but it is because I needed to pu enough * in a short space. – Bruno Le Floch Feb 11 '11 at 0:42

I tried hard but Martin was faster ;-)

\documentclass{scrartcl}
\usepackage[english]{babel}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{xspace}
\newif\ifhe\hetrue
\newcommand*\heshe%
{%
\ifhe%
he%
\global\hefalse%
\else%
she%
\global\hetrue%
\fi%
\xspace
}%
\begin{document}
First \heshe is a man, but then \heshe turns into a woman. And back again: \heshe
\end{document}

• Ok, but you remembered to add \xspace. :-) – Martin Scharrer Feb 10 '11 at 20:39
• You need to add \global like in my code. Otherwise the gender will be local inside environments. – Martin Scharrer Feb 10 '11 at 21:11
• Yep, you are right. I will edit my answer. – Josef Feb 10 '11 at 22:53
• Wouldn't it be more sensible to put the \xspace at the end of the macro (before }) instead of inside each branch of the if? – Paŭlo Ebermann Feb 11 '11 at 19:21
• @Paŭlo: Not just more sensible. The \xspace macro looks ahead to decide whether to add a space or not. All what it sees here is \global (or \he... in the original version). It must be at the very end in order to work. See my answer. – Martin Scharrer Feb 11 '11 at 21:09

It's not an answer to your question, really, as much as a clever evasion, but The Joy of TeX deals with it by inventing new epicene pronouns, which I at least think counts as stylish (if perhaps not to be too eagerly imitated).

Thus E, Em, and Eir instead of he/she, him/her, and other abominations.

Just so I'm not being completely irrelevant, an alternative technique to the fine existing answers:

\documentclass{article}
\usepackage{xspace}
\def\heshei{he\xspace
\global\let\heshe\hesheii
}
\def\hesheii{she\xspace
\global\let\heshe\heshei
}

\begin{document}
Orlando: first \heshe is a woman, then \heshe is a man, and then \heshe is back
again.
\end{document}


Nothing wrong with 'they' as a suitable pronoun.

• I've tried this. It's difficult to deal with capital letters. – Leo Liu Feb 12 '11 at 6:42

Here several years later with an alternative proposal. Doing this automatically presents some tricky corner cases. Take this gender-neutral Alice-and-Bob example:

Alice asked Bob to move Bob’s car out of Alice’s driveway. Bob told Alice that the driveway was as much Bob’s as Alice’s, so Alice could go love herself.

If you replaced all the names with pronouns, you would get:

She asked him to move his car out of her driveway. He told her that the driveway was as much his as hers, so she could go love herself.

Three things we immediately notice:

• There are five cases for the personal pronouns in this English paragraph: subject, object, possessive, absolute possessive, and reflexive.
• Any of them can appear in uppercase or lowercase.
• The pronouns do not always alternate. There are two characters, distinguished by gender.

The existing he-she package can handle anaphoric pronouns for one person, but if you try to mix \him and \her (or \his and \hir or \hiss and \hers), they will all be the same gender until the next paragraph. The only way to write about two example characters with different genders is to constantly flip the gender toggle, which is difficult to read and error-prone.

The logic gets even more complex if we need to, for example, remember the arbitrary gender of a character later. (Think back to our poor student in Section 1. She ....)

And introducing even a few words from any language with gram­mat­i­cal gender complicates things a lot. (Fiancé/Fiancée, for example.)

The most useful thing you can do with this—which, with respect to singular they or Spivak pronouns, you can’t do as fluently with them—is that you have a made-up example with two people, who use different pronouns. Then you don’t have to keep using their names or circumlocutions like “the former” or ”the second one.” In that use case, there are only two people to keep track of. Luckily, there are two permutations of he/she, her/his, and so on. So, you could define commands \heshe, \shehe, \HerHis, \HisHer, etc. Adding a star would then swap the current character’s gender. The genders of commands will remain consistent (if \SheHe expands to She, \hisher will expand to his, and so on) until the next starred command swaps them all.

So, the source code for that example would look like:

\SheHe* asked \himher to move \hisher car out of
\herhis driveway. \HeShe told \herhim that the
driveway was as much \hishers as \hershis, so
\shehe could go love \herhimself.


This could be built from a more general command that selects based on the last character’s gender, which would also be useful in and of itself:

\gendered{fiancé}{fiancée}


### A “Simple” implementation

\documentclass{article}
\usepackage{libertine} % For example.

%% Simple pronoun alternation:

\usepackage{xspace, suffix}
\makeatletter

\newif\ifpronouns@feminine
\pronouns@femininefalse

\newcommand{\gendered}[2]{%
\ifpronouns@feminine%
{#2}%
\else {#1}%
\fi}

\WithSuffix\newcommand\gendered*[2]{%
\ifpronouns@feminine%
\pronouns@femininefalse%
\else%
\pronouns@femininetrue%
\fi%
\gendered{#1}{#2}}

%% This could really be automated to generate the eight forms of each pair of
%% pronouns, along the capital/lowercase, same/other and starred/unstarred
%% axes.
\newcommand\HeShe{\gendered{He}{She}\xspace}
\WithSuffix\newcommand\HeShe*{\gendered*{He}{She}\xspace}
\newcommand\heshe{\gendered{he}{she}\xspace}
\WithSuffix\newcommand\heshe*{\gendered*{he}{she}\xspace}
\newcommand\SheHe{\gendered{She}{He}\xspace}
\WithSuffix\newcommand\SheHe*{\gendered*{She}{He}\xspace}
\newcommand\shehe{\gendered{she}{he}\xspace}
\WithSuffix\newcommand\shehe*{\gendered*{she}{he}\xspace}

\newcommand\HimHer{\gendered{Him}{Her}\xspace}
\WithSuffix\newcommand\HimHer*{\gendered*{Him}{Her}\xspace}
\newcommand\himher{\gendered{him}{her}\xspace}
\WithSuffix\newcommand\himher*{\gendered*{him}{her}\xspace}
\newcommand\HerHim{\gendered{Her}{Him}\xspace}
\WithSuffix\newcommand\HerHim*{\gendered*{Her}{Him}\xspace}
\newcommand\herhim{\gendered{her}{him}\xspace}
\WithSuffix\newcommand\herhim*{\gendered*{her}{him}\xspace}

\newcommand\HisHer{\gendered{His}{Her}\xspace}
\WithSuffix\newcommand\HisHer*{\gendered*{His}{Her}\xspace}
\newcommand\hisher{\gendered{his}{her}\xspace}
\WithSuffix\newcommand\hisher*{\gendered*{his}{her}\xspace}
\newcommand\HerHis{\gendered{Her}{His}\xspace}
\WithSuffix\newcommand\HerHis*{\gendered*{Her}{His}\xspace}
\newcommand\herhis{\gendered{her}{his}\xspace}
\WithSuffix\newcommand\herhis*{\gendered*{her}{his}\xspace}

\newcommand\HisHers{\gendered{His}{Hers}\xspace}
\WithSuffix\newcommand\HisHers*{\gendered*{His}{Hers}\xspace}
\newcommand\hishers{\gendered{his}{hers}\xspace}
\WithSuffix\newcommand\hishers*{\gendered*{his}{hers}\xspace}
\newcommand\HersHis{\gendered{Hers}{His}\xspace}
\WithSuffix\newcommand\HersHis*{\gendered*{Hers}{His}\xspace}
\newcommand\hershis{\gendered{hers}{his}\xspace}
\WithSuffix\newcommand\hershis*{\gendered*{hers}{his}\xspace}

\newcommand\HimHerself{\gendered{Himself}{Herself}\xspace}
\WithSuffix\newcommand\HimHerself*{\gendered*{Himself}{Herself}\xspace}
\newcommand\himherself{\gendered{himself}{herself}\xspace}
\WithSuffix\newcommand\himherself*{\gendered*{himself}{herself}\xspace}
\newcommand\HerHimself{\gendered{Herself}{Himself}\xspace}
\WithSuffix\newcommand\HerHimself*{\gendered*{Herself}{Himself}\xspace}
\newcommand\herhimself{\gendered{herself}{himself}\xspace}
\WithSuffix\newcommand\herhimself*{\gendered*{herself}{himself}\xspace}

\makeatother

%% Test document:

\begin{document}

\SheHe* asked \himher to move \hisher car out of
\herhis driveway. \HeShe told \herhim that the
driveway was as much \hishers as \hershis, so
\shehe could go love \herhimself.

\SheHe* asked \himher to move \hisher car out of
\herhis driveway. \HeShe told \herhim that the
driveway was as much \hishers as \hershis, so
\shehe could go love \herhimself.

\end{document}