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

what does \newif mean?

2,978 views
Skip to first unread message

Thinking

unread,
May 10, 2007, 6:06:54 AM5/10/07
to
I am a new user of latex. I can't understand what does the command
"\newif" mean?
Where can I find the total latex command reference?


And what does the following sentence mean?

\newif\ifCAST@typeinfo \CAST@typeinfotrue


Thank you!

co...@zedat.fu-berlin.de

unread,
May 10, 2007, 6:51:21 AM5/10/07
to
Thinking <zhihan...@gmail.com> wrote:
: Where can I find the total latex command reference?

A full overview of more or less every bit of information is
http://www.ctan.org/tex-archive/info/

: I am a new user of latex. I can't understand what does the command
: "\newif" mean?

This one is a TeX primitive and not limited to LaTeX. The full documentation
for that can be found in the TeX Book by Donald Knuth.

\newif does what its name suggests: it creates a new conditional, or Boolean
toggle. The following example shows it:

\newif\ifLastname

\Lastnamefalse
My last name is \ifLastname Corff\else C.\fi, my first name is Oliver.
% prints:
% My last name is C., my first name is Oliver.
\Lastnametrue
My last name is \ifLastname Corff\else C.\fi, my first name is Oliver.
% prints:
% My last name is Corff, my first name is Oliver.

: And what does the following sentence mean?

: \newif\ifCAST@typeinfo \CAST@typeinfotrue

A Boolean \ifCAST@typeinfo is created which is then declared as true.
This 'sentence' actually is a sequence of two statements, not one.

Oliver.

--
Dr. Oliver Corff e-mail: co...@zedat.fu-berlin.de

Joseph Wright

unread,
May 10, 2007, 7:14:31 AM5/10/07
to
On May 10, 11:51 am, <c...@zedat.fu-berlin.de> wrote:

> Thinking <zhihang.w...@gmail.com> wrote:
>
> : Where can I find the total latex command reference?
>
> A full overview of more or less every bit of information ishttp://www.ctan.org/tex-archive/info/

>
> : I am a new user of latex. I can't understand what does the command
> : "\newif" mean?
>
> This one is a TeX primitive and not limited to LaTeX. The full documentation
> for that can be found in the TeX Book by Donald Knuth.
>
> \newif does what its name suggests: it creates a new conditional, or Boolean
> toggle. The following example shows it:
>
> \newif\ifLastname
>
> \Lastnamefalse
> My last name is \ifLastname Corff\else C.\fi, my first name is Oliver.
> % prints:
> % My last name is C., my first name is Oliver.
> \Lastnametrue
> My last name is \ifLastname Corff\else C.\fi, my first name is Oliver.
> % prints:
> % My last name is Corff, my first name is Oliver.
>
> : And what does the following sentence mean?
>
> : \newif\ifCAST@typeinfo \CAST@typeinfotrue
>
> A Boolean \ifCAST@typeinfo is created which is then declared as true.
> This 'sentence' actually is a sequence of two statements, not one.
>
> Oliver.
>
> --
> Dr. Oliver Corff e-mail: c...@zedat.fu-berlin.de

Also note that the @ symbol is used to make "private" commands.
Normally, if you type \ifCAST@typeinfo (or anything else with an @ in
it), TeX will complain as the at symbol is not a letter (and so not
allowed in command names). You can only use private commands inside
packages (.sty files) or by doing:

\makeatletter

Private commands here

\makeatother

Joseph Wright

Thinking

unread,
May 10, 2007, 8:29:56 AM5/10/07
to
Thank you very much for your warmly help, Dr. Oliver Corff and Joseph
Wright.

Dan

unread,
May 10, 2007, 11:32:18 AM5/10/07
to
On May 10, 5:51 am, <c...@zedat.fu-berlin.de> wrote:

> Thinking <zhihang.w...@gmail.com> wrote:
>
> : Where can I find the total latex command reference?
>
> A full overview of more or less every bit of information ishttp://www.ctan.org/tex-archive/info/

>
> : I am a new user of latex. I can't understand what does the command
> : "\newif" mean?
>
> This one is a TeX primitive and not limited to LaTeX. The full documentation
> for that can be found in the TeX Book by Donald Knuth.

It is not a TeX "primitive" in the sense of being built into TeX.
It is a defined command and is, in fact, defined slightly
differently in plainTeX , LaTeX and conTeXt (and possibly other
formats).

All, however, have exactly the same effect: \newif\ifXXX
creates three new commands:
\ifXXX, \XXXtrue, and \XXXfalse
The first is initialized with \let\ifXXX\iffalse.
The second has the meaning "\let\ifXXX\iftrue" and the
last has the meaning "\let\ifXXX\iffalse".

Dan

co...@zedat.fu-berlin.de

unread,
May 10, 2007, 12:00:57 PM5/10/07
to
Dan <luec...@uark.edu> wrote:

: Oliver <co...@zedat.fu-berlin.de> wrote:
: > This one is a TeX primitive and not limited to LaTeX. The full documentation


: > for that can be found in the TeX Book by Donald Knuth.

: It is not a TeX "primitive" in the sense of being built into TeX.
: It is a defined command and is, in fact, defined slightly
: differently in plainTeX , LaTeX and conTeXt (and possibly other
: formats).

Sorry for getting this one wrong; I was somehow convinced that it was
built-in. Haven't had a look at the files for too long time.

0 new messages