Contents | < Browse | Browse >
`@ifset' and `@ifclear'
-----------------------

   When a FLAG is set, the Texinfo formatting commands format text
between subsequent pairs of `@ifset FLAG' and `@end ifset' commands.
When the FLAG is cleared, the Texinfo formatting commands do *not*
format the text.

   Use the `@set FLAG' command to turn on, or "set", a FLAG; a "flag"
can be any single word.  The format for the command looks like this:

     @set FLAG

   Write the conditionally formatted text between `@ifset FLAG' and
`@end ifset' commands, like this:

     @ifset FLAG
     CONDITIONAL-TEXT
     @end ifset

   For example, you can create one document that has two variants, such
as a manual for a `large' and `small' model:

     You can use this machine to dig up shrubs
     without hurting them.
     
     @set large
     
     @ifset large
     It can also dig up fully grown trees.
     @end ifset
     
     Remember to replant promptly ...

In the example, the formatting commands will format the text between
`@ifset large' and `@end ifset' because the `large' flag is set.

   Use the `@clear FLAG' command to turn off, or "clear", a flag.
Clearing a flag is the opposite of setting a flag.  The command looks
like this:

     @clear FLAG

Write the command on a line of its own.

   When FLAG is cleared, the Texinfo formatting commands do *not*
format the text between `@ifset FLAG' and `@end ifset'; that text is
ignored and does not appear in either printed or Info output.

   For example, if you clear the flag of the preceding example by
writing an `@clear large' command after the `@set large' command (but
before the conditional text), then the Texinfo formatting commands
ignore the text between the `@ifset large' and `@end ifset' commands.
In the formatted output, that text does not appear; in both printed and
Info output, you see only the lines that say, "You can use this machine
to dig up shrubs without hurting them.  Remember to replant promptly
...".

   If a flag is cleared with an `@clear FLAG' command, then the
formatting commands format text between subsequent pairs of `@ifclear'
and `@end ifclear' commands.  But if the flag is set with `@set FLAG',
then the formatting commands do *not* format text between an `@ifclear'
and an `@end ifclear' command; rather, they ignore that text.  An
`@ifclear' command looks like this:

     @ifclear FLAG

   In brief, the commands are:

`@set FLAG'
     Tell the Texinfo formatting commands that FLAG is set.

`@clear FLAG'
     Tell the Texinfo formatting commands that FLAG is cleared.

`@ifset FLAG'
     If FLAG is set, tell the Texinfo formatting commands to format the
     text up to the following `@end ifset' command.

     If FLAG is cleared, tell the Texinfo formatting commands to ignore
     text up to the following `@end ifset' command.

`@ifclear FLAG'
     If FLAG is set, tell the Texinfo formatting commands to ignore the
     text up to the following `@end ifclear' command.

     If FLAG is cleared, tell the Texinfo formatting commands to format
     the text up to the following `@end ifclear' command.