String variables in Latex

627 views
Skip to first unread message

Woltan

unread,
Jan 22, 2008, 1:07:49 PM1/22/08
to LaTeX Users Group
Heyas folks,
I am kind of new to Latex and was wondering if there is a way to
"allocate" a string variable. For example the \author function has to
save the authors name somewhere in order to create the titlepage. I
would like to do the very same thing except with my own functions and
strings.
Does anyone have a link/hint or suggestion?
Thx in advance!!
Best regards
Woltan

James McElhannon

unread,
Jan 22, 2008, 1:28:34 PM1/22/08
to latex...@googlegroups.com
Just curious... why would you want to do that instead of just using a macro?
 
\newcommand{\foo}{bar}
 
then just use \foo everywhere?
 
James



> Date: Tue, 22 Jan 2008 10:07:49 -0800
> Subject: String variables in Latex
> From: n.ho...@googlemail.com
> To: latex...@googlegroups.com

Dustin

unread,
Jan 24, 2008, 10:24:42 PM1/24/08
to LaTeX Users Group
It is useful for creating a style file. For example, I have a homework
style file that "allocates" a classname string.

I actually got this from some homework style file from the internet a
long time ago:

\def\hmwkClass#1{\gdef\@hmwkClass{#1}}

later in the style file was the line:
\title{\vspace{2in}\textmd{\textbf{\@hmwkClass:\
\@hmwkTitle}}\\\normalsize\vspace{0.1in}\small{Due\ on\
\@hmwkDueDate}\\\vspace{0.1in}\large{\textit{\@hmwkClassInstructor\
\@hmwkClassTime}}\vspace{3in}}

I myself have a question though. How do I check if a person actually
used the \hmwkClass{} command that I defined?
E.g. if it was not defined, I would change the title appropriately.


On Jan 22, 1:28 pm, James McElhannon <james_mcelhan...@hotmail.com>
wrote:
> Just curious... why would you want to do that instead of just using a macro?
>
> \newcommand{\foo}{bar}
>
> then just use \foo everywhere?
>
> James
>
> > Date: Tue, 22 Jan 2008 10:07:49 -0800> Subject: String variables in Latex> From: n.hor...@googlemail.com> To: latex...@googlegroups.com> > > Heyas folks,> I am kind of new to Latex and was wondering if there is a way to> "allocate" a string variable. For example the \author function has to> save the authors name somewhere in order to create the titlepage. I> would like to do the very same thing except with my own functions and> strings.> Does anyone have a link/hint or suggestion?> Thx in advance!!> Best regards> Woltan> > _________________________________________________________________
>
> Shed those extra pounds with MSN and The Biggest Loser!http://biggestloser.msn.com/

Luis Rivera

unread,
Jan 25, 2008, 4:33:02 PM1/25/08
to LaTeX Users Group
On Jan 24, 9:24 pm, Dustin <wdts...@gmail.com> wrote:
> It is useful for creating a style file. For example, I have a homework
> style file that "allocates" a classname string.
>
> I myself have a question though. How do I check if a person actually
> used the \hmwkClass{} command that I defined?
> E.g. if it was not defined, I would change the title appropriately.
>

just check if it has been \@undefined

\ifx\@hmwkClass\@undefined
foo
\else
bar
\fi

\bye

Luis.
Reply all
Reply to author
Forward
0 new messages