Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

When was \ifdefined defined in LaTeX?

1,482 views
Skip to first unread message

Jeffrey Goldberg

unread,
Oct 9, 2014, 1:45:29 PM10/9/14
to
I'm writing a LaTeX class in which I make use of \ifdefined

I would like to know what release date I should set for my

\NeedsTeXFormat{LaTeX2e}[release-date]

command.

In my youth, I recall that \ifdefined was not generally
available (though I may be misremembering), but
it now (happily) appears that e-TeX extensions are in
LaTeX2e.

As I know that \idefined works nicely with today's LaTeX,
I could always use today's date, but that might be overly
restrictive.

So I would like to know when e-TeX stuff got incorporated
into LaTeX, in particular \ifdefined.

Cheers,

-j

Joseph Wright

unread,
Oct 10, 2014, 8:49:35 AM10/10/14
to
It's not anything to do with LaTeX: \ifdefined is a primitive, so
availability depends on the engine. Usually you test for this once 'up
front' in some way, for example

\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname eTeXversion\endcsname\relax
% No e-TeX
\else
% e-TeX
\fi

The extensions were finalised in 1999 but are not necessarily available
'out of the box' for people using some commercial TeX systems even today.
--
Joseph Wright

Jeffrey Goldberg

unread,
Oct 12, 2014, 12:29:47 AM10/12/14
to
On 2014-10-10 12:49:35 +0000, Joseph Wright said:

> On 09/10/2014 18:45, Jeffrey Goldberg wrote:
>> I'm writing a LaTeX class in which I make use of \ifdefined

> It's not anything to do with LaTeX: \ifdefined is a primitive, so
> availability depends on the engine.

Thanks, Joseph!

Ah. I had engine and format confused. Once I am reminded of the distinction
I realize that my question doesn't make sense.


> Usually you test for this once 'up
> front' in some way, for example
>
> \begingroup\expandafter\expandafter\expandafter\endgroup
> \expandafter\ifx\csname eTeXversion\endcsname\relax
> % No e-TeX
> \else
> % e-TeX
> \fi

I am not going to try to get my head around all of the \expandafter
sequences in there, as I am far closer to senility than to the cleverness
of youth. So I am content with accepting that as magic.

> The extensions were finalised in 1999 but are not necessarily available
> 'out of the box' for people using some commercial TeX systems even today.

Well that sucks. Basically it means that I need to, in effect, create something
that checks to see if \eTeXversion is defined without using \ifdefined.
And then,
presumably, define an equivalent to \ifdefine if needed.

Cheers,

-j






Joseph Wright

unread,
Oct 12, 2014, 3:36:58 AM10/12/14
to
On 12/10/2014 05:29, Jeffrey Goldberg wrote:
>> The extensions were finalised in 1999 but are not necessarily available
>> 'out of the box' for people using some commercial TeX systems even today.
>
> Well that sucks. Basically it means that I need to, in effect, create
> something
> that checks to see if \eTeXversion is defined without using \ifdefined.
> And then,
> presumably, define an equivalent to \ifdefine if needed.

There is no equivalent of \ifdefined available without the extensions.
What you can do is say that they are required: you do the test for
\eTeXversion then if they are not there bail out. The major TeX systems
(TeX Live, MiKTeX) have had them available for many years, and a lot of
LaTeX packages do require them.
--
Joseph Wright

Jeffrey Goldberg

unread,
Oct 12, 2014, 4:33:18 PM10/12/14
to
On 2014-10-12 07:36:58 +0000, Joseph Wright said:

> On 12/10/2014 05:29, Jeffrey Goldberg wrote:
>>> The extensions were finalised in 1999 but are not necessarily available
>>> 'out of the box' for people using some commercial TeX systems even today.
>>
>> Well that sucks. Basically it means that I need to, in effect, create
>> something
>> that checks to see if \eTeXversion is defined without using \ifdefined.
>> And then,
>> presumably, define an equivalent to \ifdefine if needed.
>
> There is no equivalent of \ifdefined available without the extensions.

Well the particular test that you offered, if I read it correctly, is
a test for whether \eTeXversion is defined. So presumably a similar
construction could be used elsewhere.


> What you can do is say that they are required: you do the test for
> \eTeXversion then if they are not there bail out.

That makes sense. I can bail with a nice message instead of just having
TeX fail with
...\ifdefined

Undefined control sequence on line ...

> The major TeX systems (TeX Live, MiKTeX) have had them available for many
> years, and a lot of LaTeX packages do require them.

I could also see if there is another way to do what I am trying to do.

As what I am doing is analogous to what \maketitle does, I should see how
it deals with cases where \thetitle and \thedate are not defined.

Cheers,

-j


Message has been deleted

Ulrich D i e z

unread,
Oct 12, 2014, 6:16:43 PM10/12/14
to
( In my previous posting I overlooked that brace-checking might be needed,
so I superseded with this one. )

Jeffrey Goldberg wrote:

> Well that sucks. Basically it means that I need to, in effect, create something
> that checks to see if \eTeXversion is defined without using \ifdefined.
> And then,
> presumably, define an equivalent to \ifdefine if needed.

The problem is: \ifdefined can be applied to any token,
even to an \outer-token or to a single catcode-1-character-token
like an opening brace or to a single catcode-2-token like a
closing brace.

So you cannot define an equivalent to \ifdefined by means of
processing macro arguments as macro arguments cannot
contain \outer-tokens or single unbalanced brace-tokens.


If you don't mind about affecting the hash-table, and if testing is
only about control-sequence-tokens, not also character-tokens,
you can have the token in question constructed in terms of
\csname..\endcsname in order to see whether the meaning
of the token in question equals \relax.


When you can rely on some really bizarre Token not being defined,
e.g. \UnDeFINedAndBIzaRREe , you can do something like

\ifx\UnDeFINedAndBIzaRREe<Token to test> .. \else .. \fi


If you don't like at all to rely on some bizarre token being undefined,
and if you don't care about \outer-token or single unbalanced braces
and the like, you can apply \meaning to the token in question
and check whether the result starts with the
catcode-12-character-token-sequence "undefined".
That won't affect the hash table with each test that is to be carried
out, which is nice when such testing is done very often.
(Nonetheless doing the thing below instead of relying on a really
bizarre token not being defined seems like overkill to me...)


%%-----------------------------------------------------------------------------
%% Paraphernalia:
%%.............................................................................
\long\def\firstoftwo#1#2{#1}%
\long\def\secondoftwo#1#2{#2}%
%%-----------------------------------------------------------------------------
%% Check whether argument is empty:
%%.............................................................................
%% \CheckWhetherNull{<Argument which is to be checked>}%
%% {<Tokens to be delivered in case that
%% argument which is to be checked is empty>}%
%% {<Tokens to be delivered in case that
%% argument which is to be checked is not empty>}%
%% ( Test is based on Robert R Schneck's \ifempty-macro.
%% Newsgroup: comp.text.tex
%% Subject: Macro puzzle: maximally general \ifempty
%% Google-Groups-URL:
%% https://groups.google.com/forum/#!topic/comp.text.tex/kuOEIQIrElc )
\long\def\CheckWhetherNull#1{%
\expandafter\secondoftwo\string{\expandafter\secondoftwo
\expandafter{\expandafter{\string#1}\expandafter\secondoftwo
\string}\expandafter\firstoftwo\expandafter{\expandafter
\firstoftwo\expandafter\secondoftwo\expandafter}\string
}\firstoftwo
}
%%---------------------------------------------------------------
%% Check whether brace-balanced argument starts with a
%% catcode-1-character-token, e.g., an opening brace:
%%...............................................................
\long\def\CheckWhetherLeadingBrace#1{%
\expandafter\secondoftwo\expandafter{\expandafter{\string#1.%
}\expandafter\firstoftwo\expandafter{\expandafter\firstoftwo
\expandafter\firstoftwo\expandafter}\string}\secondoftwo
}
%%---------------------------------------------------------------
%% Check whether macro argument has an undefined token as
%% it's first token:
%%...............................................................
\begingroup
\long\def\CheckWhetherArgumentHasAFirstTokenThatIsUndefined#1{%
\endgroup
\long\def\CheckWhetherArgumentHasAFirstTokenThatIsUndefined##1{%
\CheckWhetherLeadingBrace{##1}{\secondoftwo}{%
\expandafter\secondoftwo
\string{\expandafter\CheckWhetherArgumentHasAFirstTokenThatIsUndefinedB
\meaning##1.#1}{}%
}%
}%
\long\def\CheckWhetherArgumentHasAFirstTokenThatIsUndefinedB##1#1{%
\CheckWhetherNull{##1}%
{\expandafter\expandafter\expandafter\firstoftwo}%
{\expandafter\expandafter\expandafter\secondoftwo}%
\expandafter\secondoftwo\expandafter{\string}%
}%
}%
\begingroup
\edef\CheckWhetherArgumentHasAFirstTokenThatIsUndefined{%
\endgroup
\noexpand\CheckWhetherArgumentHasAFirstTokenThatIsUndefined{%
\string u\string n\string d\string e\string f%
\string i\string n\string e\string d%
}%
}%
\CheckWhetherArgumentHasAFirstTokenThatIsUndefined


\long\def\ArgumentHasAFirstTokenThatIsUndefined#1{%
0\CheckWhetherArgumentHasAFirstTokenThatIsUndefined{#1}{0}{1}%
}%

\tt

Using \string\CheckWhetherArgumentHasAFirstTokenThatIsUndefined

\medskip

a\ $\to$
\CheckWhetherArgumentHasAFirstTokenThatIsUndefined{a}{true}{false}

\string\TeX\ $\to$
\CheckWhetherArgumentHasAFirstTokenThatIsUndefined{\TeX}{true}{false}

\string\uNdEfInED\ $\to$
\CheckWhetherArgumentHasAFirstTokenThatIsUndefined{\uNdEfInED}{true}{false}

\medskip

\string a\string\biZarre\string\fi\ $\to$
\CheckWhetherArgumentHasAFirstTokenThatIsUndefined{a\biZarre\fi}{true}{false}

\string\TeX\string\biZarre\string\fi\ $\to$
\CheckWhetherArgumentHasAFirstTokenThatIsUndefined{\TeX\biZarre\fi}{true}{false}

\string\uNdEfInED\string\biZarre\string\fi\ $\to$
\CheckWhetherArgumentHasAFirstTokenThatIsUndefined{\uNdEfInED\biZarre\fi}{true}{false}

\medskip

\string{in braces\string} $\to$
\CheckWhetherArgumentHasAFirstTokenThatIsUndefined{{in braces}}{true}{false}

\medskip

<emptiness> $\to$
\CheckWhetherArgumentHasAFirstTokenThatIsUndefined{}{true}{false}

\bigskip

Using \string\if\string\ArgumentHasAFirstTokenThatIsUndefined

\medskip

\string a\ $\to$
\if\ArgumentHasAFirstTokenThatIsUndefined{a}true\else false\fi

\string\TeX\ $\to$
\if\ArgumentHasAFirstTokenThatIsUndefined{\TeX}true\else false\fi

\string\uNdEfInED\ $\to$
\if\ArgumentHasAFirstTokenThatIsUndefined{\uNdEfInED}true\else false\fi

\medskip

\string a\string\biZarre\string\fi\ $\to$
\if\ArgumentHasAFirstTokenThatIsUndefined{a\biZarre\fi}true\else false\fi

\string\TeX\string\biZarre\string\fi\ $\to$
\if\ArgumentHasAFirstTokenThatIsUndefined{\TeX\biZarre\fi}true\else false\fi

\string\uNdEfInED\string\biZarre\string\fi\ $\to$
\if\ArgumentHasAFirstTokenThatIsUndefined{\uNdEfInED\biZarre\fi}true\else false\fi

\medskip

\string{in braces\string} $\to$
\if\ArgumentHasAFirstTokenThatIsUndefined{{in braces}}true\else false\fi

\medskip

<emptiness> $\to$
\if\ArgumentHasAFirstTokenThatIsUndefined{}true\else false\fi


% \ifdefined a defined \else undefined\fi

% \ifdefined \TeX defined \else undefined\fi

% \ifdefined \uNdEfInED defined \else undefined\fi

\bye





The code above looks rather cumbersome and long.
I'd prefer \ifx-checking with some bizarre control sequence token that
can be assumed to be undefined.
Only plain TeX is used.
Any \if .. \else ..\fi is avoided.
\CheckWhetherArgumentHasAFirstTokenThatIsUndefined also deals the cases
of the argument being empty / consisting of several tokens.
Carrying out \CheckWhetherArgumentHasAFirstTokenThatIsUndefined won't
affect the hash-table.
\CheckWhetherArgumentHasAFirstTokenThatIsUndefined can also be carried
out in expansion-contexts, e.g. inside \csname..\endcsname, e.g., within \edef,
e.g., when \romannumeral-expansion takes place.

Ulrich


Robin Fairbairns

unread,
Oct 12, 2014, 7:10:28 PM10/12/14
to
\maketitle, in the standard classes, probably uses the internal command:

\@ifundefined{<cs name>}{<not defined code>}{<defined code>}

this has (at least) two disadvantages:

(1) it sets the <cs name> to \relax, if it _is_ undefined
(2) it doesn't distinguish a cs name defined by

\let\foo\relax

from the case where \foo is undefined

for all that, \@ifundefined is widely used within latex.

the etex primitive \ifdefined is much preferable, but won't be present
in an archaic tex distribution.
--
Robin Fairbairns, Cambridge

Jeffrey Goldberg

unread,
Oct 13, 2014, 1:08:11 AM10/13/14
to
On 2014-10-12 23:10:28 +0000, Robin Fairbairns said:

> Jeffrey Goldberg <nob...@goldmark.org> writes:
>
>> As what I am doing is analogous to what \maketitle does, I should see how
>> it deals with cases where \thetitle and \thedate are not defined.
>
> \maketitle, in the standard classes, probably uses the internal command:
>
> \@ifundefined{<cs name>}{<not defined code>}{<defined code>}
>
> this has (at least) two disadvantages:
>
> (1) it sets the <cs name> to \relax, if it _is_ undefined
> (2) it doesn't distinguish a cs name defined by
>
> \let\foo\relax
>
> from the case where \foo is undefined
>
> for all that, \@ifundefined is widely used within latex.

Thanks, Robin!

That is pretty messy. I can live with both (1) and (2)
in my specific case, but I see the general problem.

> the etex primitive \ifdefined is much preferable, but won't be present
> in an archaic tex distribution.

Of course I should have realized that if something equivalent to
\ifdefined could be defined without an \ifdefined primitive, then
we wouldn't need the primitive. Derp.

Cheers,

-j




jfbu

unread,
Oct 13, 2014, 10:17:02 AM10/13/14
to
The code above pays attention to not leave a previously
undefined \eTeXversion token now defined and with meaning
\relax: this is in contrast to LaTeX's \@ifundefined test.

If you plan to use \ifdefined in your class, you should be aware
that it will declare "defined" any control sequence name previously
tested by some package with \@ifundefined and since then with meaning
\relax

\makeatletter

1. \ifdefined\testmacroname defined\else undefined\fi

2. \@ifundefined{testmacroname}{undefined}{defined}

1'. \ifdefined\testmacroname defined\else undefined\fi

2'. \@ifundefined{testmacroname}{undefined}{defined}

At 1', \ifdefined answers defined, but at 1. it said undefined.

The code above with all its \expandafter's is better than \@ifundefined
in that sense. But it does impact the hash table, as can be thing with this

\documentclass{article}
\begin{document}
\makeatletter
\begingroup
\count0 1000
\loop
{\count@ 10000
\loop
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname \the\count\z@\the\count@\endcsname\relax
\fi
\advance\count@ \m@ne
\ifnum\count@ >\z@
\repeat
}\message{.}\advance\count0 \m@ne
\ifnum\count0>\z@
\repeat
\endgroup
\end{document}


This fails on my installation with
(./testifdefined.aux) . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
! TeX capacity exceeded, sorry [number of strings=493108].
\iterate ...he \count \z@ \the \count@ \endcsname
\relax \fi \advance \count...
l.17 \repeat

No pages of output.
Transcript written on testifdefined.log.

LaTeX exited abnormally with code 1 at Mon Oct 13 15:45:02


If however you run the code above with "\ifcsname" from e-TeX replacing
"\ifx\csname" then you will see it compiles successfully.

Thus, there is a simpler alternative to the code from Joseph's post which
is to do

\ifx\mymacroname\undefined
% undefined
\else
% defined
\fi

It has the same impact on the hash-table, it does not leave \mymacroname
with meaning \relax if it was not defined before.

1. \ifdefined\testothername defined\else undefined\fi

2. \ifx\testothername\undefined undefined\else defined\fi

1'. \ifdefined\testothername defined\else undefined\fi

2'. \ifx\testothername\undefined undefined\else defined\fi

However
a. this is not for macro names with non-letters
b. if someone else has tested the same name with \@ifundefined,
this test will choose the "undefined" branch, contrarily to
\@ifundefined
c. it may cause problems depending on the surroundings
if you try to apply it to an \if... sequence
due to the way TeX parses \if..\else..\fi

for example
%=== start
\documentclass{article}
\begin{document}

\iffalse
\ifx \ifdefined\undefined
no e-TeX
\else
e-TeX
\fi
\fi

\end{document}

\fi
OOPS!

\end{document}% yes second time!
%==== end is here!

with e-TeX extension you will get the OOPS!

with no e-TeX, you will get no e-TeX.

Anyway, for simple things whose names you control
yourself and which are NOT susceptible to having
been tested before with \@ifundefined, then

\makeatletter
\ifx\mymacro\undefined\expandafter\@firstoftwo
\else\expandafter\@secondoftwo\fi {NOT defined}{defined}

is a simple way.

Jean-Francois




Ulrich D i e z

unread,
Oct 13, 2014, 10:39:56 AM10/13/14
to
Robin Fairbairns wrote:

> \maketitle, in the standard classes, probably uses the internal command:
>
> \@ifundefined{<cs name>}{<not defined code>}{<defined code>}
>
> this has (at least) two disadvantages:
>
> (1) it sets the <cs name> to \relax, if it _is_ undefined
> (2) it doesn't distinguish a cs name defined by
>
> \let\foo\relax
>
> from the case where \foo is undefined

Assuming that \@ifundefined is defined in the LaTeX2e-Kernel as

\def\@ifundefined#1{%
\expandafter\ifx\csname#1\endcsname\relax
\expandafter\@firstoftwo
\else
\expandafter\@secondoftwo
\fi
}

, using proper grouping, a test can be implemented in terms of
\@ifundefined where the two disadvantages are neutralized:


\documentclass{article}

\begingroup
\makeatletter
\@firstofone{%
\endgroup
\long\def\CheckWhetherUndefined#1{%
\begingroup
\expandafter\expandafter\expandafter\expandafter
\expandafter\expandafter\expandafter\endgroup
\@ifundefined{#1}%
{%
% either undefined or \relax
\begingroup
\expandafter\expandafter\expandafter\endgroup
\@ifundefined{#1}{%
% defined to equal \relax
\@secondoftwo
}{%
% undefined
\@firstoftwo
}%
}{%
% defined; meaning differs from \relax's meaning.
\@secondoftwo
}%
}%
}%

\def\foo{defined}
\let\bar=\relax

\begin{document}

\ttfamily\selectfont

\verb|\CheckWhetherUndefined{foo}{undefined}{defined}| $\to$
\CheckWhetherUndefined{foo}{undefined}{defined}

\verb|\CheckWhetherUndefined{bar}{undefined}{defined}| $\to$
\CheckWhetherUndefined{bar}{undefined}{defined}

\verb|\CheckWhetherUndefined{UnDeFINed}{undefined}{defined}| $\to$
\CheckWhetherUndefined{UnDeFINed}{undefined}{defined}

\verb|\meaning\foo| $\to$ \meaning\foo

\verb|\meaning\bar| $\to$ \meaning\bar

\verb|\meaning\UnDeFINed| $\to$ \meaning\UnDeFINed

\end{document}




This test cannot be used in expansion-contexts:

\begingroup and \endgroup will have no effect within \edef.

Within \csname-expansion, they will have the effect of
ending \csname-expansion with an error-message about
missing \endcsname .

This test only works on the names of control sequence tokens.

This test can't be used with character-tokens, e.g., active character-tokens.

This test can be outmanoeuvred by playing around with the
\globaldefs-integer-parameter.

That's why in my previous posting I tried to elaborate on the approach
of checking whether the \meaning of the token that is to be tested
has the leading phrase "undefined" .
This is the case if and only if the token in question is undefined.
Even if a token is defined to be a macro that spits out the phrase
"undefined", its meaning will not have the leading phrase "undefined"
but it will have a leading phrase containing the sequence "macro:" .


By the way:

Why not just:

\ifx \BiZARReAndTherEFOreUnDeFiNED <cs> .. \else .. \fi ?


Ulrich

jfbu

unread,
Oct 13, 2014, 10:49:51 AM10/13/14
to

> for example
> %=== start
> \documentclass{article}
> \begin{document}
>
> \iffalse
> \ifx \ifdefined\undefined
> no e-TeX
> \else
> e-TeX
> \fi
> \fi
>
> \end{document}
>
> \fi
> OOPS!
>
> \end{document}% yes second time!
> %==== end is here!
>
> with e-TeX extension you will get the OOPS!
>
> with no e-TeX, you will get no e-TeX.
sorry about that. I had some other code,
with no-eTeX you get nothing, naturally
because the \ifx test is not executed
after the \iffalse thing

> in that sense. But it does impact the hash table, as can be thing

is a thing seen a mean thing?

sorry
JF




jfbu

unread,
Oct 13, 2014, 11:32:24 AM10/13/14
to
Le 13/10/2014 16:39, Ulrich D i e z a écrit :
> \long\def\CheckWhetherUndefined#1{%
> \begingroup

yes but you lose expandability...

JF

Ulrich D i e z

unread,
Oct 13, 2014, 12:27:56 PM10/13/14
to
"jfbu" <jfREM...@free.fr> schrieb im Newsbeitrag news:543bf089$0$21664$426a...@news.free.fr...
In the posting quoted by you I also wrote:

| This test cannot be used in expansion-contexts:

| \begingroup and \endgroup will have no effect within \edef.

That was misleading: They will not open up a new scope
and they won't vanish ...

| Within \csname-expansion, they will have the effect of
| ending \csname-expansion with an error-message about
| missing \endcsname .


Ulrich

jfbu

unread,
Oct 13, 2014, 1:46:36 PM10/13/14
to
Le 13/10/2014 18:27, Ulrich D i e z a écrit :
>> yes but you lose expandability...
>>
>> JF
>
> In the posting quoted by you I also wrote:
>
> | This test cannot be used in expansion-contexts:
>
> | \begingroup and \endgroup will have no effect within \edef.
>
> That was misleading: They will not open up a new scope
> and they won't vanish ...
>
> | Within \csname-expansion, they will have the effect of
> | ending \csname-expansion with an error-message about
> | missing \endcsname .
>
>
> Ulrich
>

my fault, I had not seen that part of your message...

:-(

I committed already some blunders in this thread, so
that was the continuation

I wanted now to quote the end
where there was mention of using \meaning, but
your message has disappeared suddenly!

(is there a recipe for me to kill all my posts here, too?)

continuing on this topic which surely has been
over-debated decades ago, but in these days of low
traffic on c.t.tex, I don't think I will harm
people, if I go into the same mantras,

there is a big difference between a test which
will handle a given token #1 or a test which
will be handed over the _name_ #1 of a putative
control word.

in the latter case I see no way, expandably,
in TeX without e-TeX, which could avoid the \relax
after-effect

the former case does allow expandable handling via \meaning,
and people must have done these things

The expandability constraint appear a bit artificial,
I know I mentioned it, but in practice why would one
an expandable test for existence of a control sequence?

certainly not for things like availability of e-TeX
extensions, as this can be checked by the macro provider
who can define accordingly its expandable macros
acting (if possible) one way under pure TeX and another
way under e-TeX

\ifx\candidate\undefined

is simple and expandable
but if \candidate has been \let previously to
an \iftrue or \iffalse
this can cause the problem I mentioned

And in the \meaning (virtual or already
written up) method to handle (expandably)
an explicit token "\candidate"
I don't see anyway to avoid
the very same problem with booleans

Or rather: the only way is to make sure that
the piece
of code where the test is done is not included
inside a true or false branch of some \if ... \else .. \fi

for example I had once this problem with
code to handle both an e-TeX and tne non e-TeX
situation in governing action of docstrip on
a file.

I checked for \numexpr using \csname, and then
I was using \ifdefined in the branch where
e-TeX was known to be available. However when
the file was run with pure tex, \ifdefined
was not seen as a conditional and this caused the
problems I mentioned

It is a trap the unwary could fall into:
do not use \ifdefined in code with a surrounding
\if...\else...\fi which may potentially
be run under pure TeX

Jean-Francois














Dan Luecking

unread,
Oct 14, 2014, 4:26:36 PM10/14/14
to
On Mon, 13 Oct 2014 00:10:28 +0100, Robin Fairbairns
<rf...@cl.cam.ac.uk> wrote:

>Jeffrey Goldberg <nob...@goldmark.org> writes:
>
>> I could also see if there is another way to do what I am trying to do.
>>
>> As what I am doing is analogous to what \maketitle does, I should see how
>> it deals with cases where \thetitle and \thedate are not defined.
>
>\maketitle, in the standard classes, probably uses the internal command:
>
> \@ifundefined{<cs name>}{<not defined code>}{<defined code>}

It does seem like it would, but in fact \maketitle does not use
it or anything like it. The title and author are stored in
\@title and \@author. These are predefined to produce an error
message until there is a use of \title{...} and \author{...} to
give them a normal value. So \maketitle simply executes \@title
and \@author without checking if they are defined.


Dan
To reply by email, change LookInSig to luecking
0 new messages