Next: , Up: @set @clear @value   [Contents][Index]


16.5.1 @set and @value

You use the @set command to specify a value for a flag, which is later expanded by the @value command.

A flag (aka variable) name is an identifier starting with an alphanumeric, ‘-’, or ‘_’. Subsequent characters, if any, may not be whitespace, ‘@’, braces, angle brackets, or any of ‘~`^+|’; other characters, such as ‘%’, may work. However, it is best to use only letters and numerals in a flag name, not ‘-’ or ‘_’ or others—they will work in some contexts, but not all, due to limitations in TeX.

The value is the remainder of the input line, and can contain anything. However, unlike most other commands which take the rest of the line as a value, @set need not appear at the beginning of a line.

Write the @set command like this:

@set foo This is a string.

This sets the value of the flag foo to “This is a string.”.

The Texinfo formatters then replace a @value{flag} command with the string to which flag is set. Thus, when foo is set as shown above, the Texinfo formatters convert this:

@value{foo}
to this:
This is a string.

You can write a @value command within a paragraph; but you must write a @set command on a line of its own.

If you write the @set command like this:

@set foo

without specifying a string, the value of foo is the empty string.

If you clear a previously set flag with @clear flag, a subsequent @value{flag} command will report an error.

For example, if you set foo as follows:

@set howmuch very, very, very

then the formatters transform

It is a @value{howmuch} wet day.
into
It is a very, very, very wet day.

If you write

@clear howmuch

then the formatters transform

It is a @value{howmuch} wet day.
into
It is a {No value for "howmuch"} wet day.

@value cannot be reliably used as the argument to an accent command (see Inserting Accents). For example, this fails:

@set myletter a
@'@value{myletter}    

Next: , Up: @set @clear @value   [Contents][Index]