Go to the first, previous, next, last section, table of contents.


@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.


Go to the first, previous, next, last section, table of contents.