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

LaTeX ifthenelse not working

122 views
Skip to first unread message

Steven Freed

unread,
Apr 22, 1998, 3:00:00 AM4/22/98
to

I have a situation where the ifthen package doesn't seem to be working.
....actually, It's probably just not working as I think it should.

I am building a class on top of the article class. Instead of
putting a title, date and author, it will put a logo, address, and
title.

I load in the article class:

\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions
\LoadClass[letterpaper]{article}

Then I make a couple booleans:

\newboolean{@mlogo} \setboolean{@mlogo}{false}
\newboolean{@maddr} \setboolean{@maddr}{false}

Then a couple commands:

\newcommand{\magiclogo}{\setboolean{@mlogo}{true}}
\newcommand{\magicaddr}{\setboolean{@maddr}{true}}

I want to be able to use the commands \magiclogo and \magicaddr in
my document to control the insertion of the logo and address. Later
in my class I have:

\ifthenelse{\boolean{@mlogo}}
{\savebox{\LOGO}[\leftfield][t]
{\includegraphics[width=2.5in]{msd-logo.eps}}}
{}

The problem is that @mlogo always comes up false, no matter whether or
not I use the \magiclogo command in my document or not. If I put a

\setboolean{@mlogo}{true}

just before the ifthenelse, then it tests true and the logo is printed.
For some reason, the @mlogo doesn't seem to get set true by the \magiclogo
command. Any ideas what I am doing wrong?

Thanks,

--

Steven.


Daniel Luecking

unread,
Apr 23, 1998, 3:00:00 AM4/23/98
to

sfr...@tiehack.gilasoft.com (Steven Freed) writes:


>I have a situation where the ifthen package doesn't seem to be working.
> ....actually, It's probably just not working as I think it should.

>I am building a class on top of the article class. Instead of
>putting a title, date and author, it will put a logo, address, and
>title.

>I load in the article class:

> \DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
> \ProcessOptions
> \LoadClass[letterpaper]{article}

>Then I make a couple booleans:

> \newboolean{@mlogo} \setboolean{@mlogo}{false}
> \newboolean{@maddr} \setboolean{@maddr}{false}

>Then a couple commands:

> \newcommand{\magiclogo}{\setboolean{@mlogo}{true}}
> \newcommand{\magicaddr}{\setboolean{@maddr}{true}}

>I want to be able to use the commands \magiclogo and \magicaddr in
>my document to control the insertion of the logo and address. Later
>in my class I have:

> \ifthenelse{\boolean{@mlogo}}
> {\savebox{\LOGO}[\leftfield][t]
> {\includegraphics[width=2.5in]{msd-logo.eps}}}
> {}

Is this inside a macro that is only executed later than your \magiclogo
command, or is it at the top level and is executed when your class is
loaded? In the first case it should work, in the second it will always
be executed at a time when \@mlogo is false.

Perhaps you want to put this inside \AtBeginDocument. Or maybe you
should control the logo with an option to your class:

\documentclass[logo]{myclass}

You might have the option control the setting of @mlogo, instead of
initializing it to false.

--
Dan Luecking Dept. of Mathematical Sciences
luec...@comp.uark.edu University of Arkansas
http://comp.uark.edu/~luecking/ Fayetteville, AR 72101

Steven Freed

unread,
Apr 23, 1998, 3:00:00 AM4/23/98
to

In article <6hnvv6$p...@picayune.uark.edu>,
Daniel Luecking <luec...@comp.uark.edu> wrote:
>sfr...@tiehack.gilasoft.com (Steven Freed) writes:
>
[...]

>>I want to be able to use the commands \magiclogo and \magicaddr in
>>my document to control the insertion of the logo and address. Later
>>in my class I have:

>> \ifthenelse{\boolean{@mlogo}}
>> {\savebox{\LOGO}[\leftfield][t]
>> {\includegraphics[width=2.5in]{msd-logo.eps}}}
>> {}

>Is this inside a macro that is only executed later than your \magiclogo
>command, or is it at the top level and is executed when your class is
>loaded? In the first case it should work, in the second it will always
>be executed at a time when \@mlogo is false.

>Perhaps you want to put this inside \AtBeginDocument. Or maybe you
>should control the logo with an option to your class:

Thanks! This cured the problem.


--

Steven.


0 new messages