Next: Conditional Not Commands, Up: Conditionals
Texinfo has an @if
format environment for each output
format, to allow conditional inclusion of text for a particular output
format.
@ifinfo
begins segments of text that should be ignored by
TeX when it typesets the printed manual, and by makeinfo
when not producing Info output. The segment of text appears only in
the Info file and, for historical compatibility, the plain text
output.
The environments for the other formats are analogous:
@ifdocbook ... @end ifdocbook
@ifhtml ... @end ifhtml
@ifplaintext ... @end ifplaintext
@iftex ... @end iftex
@ifxml ... @end ifxml
The @if...
and @end if...
commands must appear
on lines by themselves in your source file.
Here is an example showing all these conditionals:
@iftex This text will appear only in the printed manual. @end iftex @ifinfo However, this text will appear only in Info and plain text. @end ifinfo @ifhtml And this text will only appear in HTML. @end ifhtml @ifplaintext Whereas this text will only appear in plain text. @end ifplaintext @ifxml Notwithstanding that this will only appear in XML. @end ifxml @ifdocbook Nevertheless, this will only appear in Docbook. @end ifdocbook
The preceding example produces the following line:
And this text will only appear in HTML.
Notice that you only see one of the input lines, depending on which version of the manual you are reading.