JezK
Edit File: Raw-Formatter-Commands.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <!-- Created by GNU Texinfo 6.8, https://www.gnu.org/software/texinfo/ --> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <!-- This manual is for GNU Texinfo (version 6.8, 8 June 2021), a documentation system that can produce both online information and a printed manual from a single source using semantic markup. Copyright (C) 1988, 1990-1993, 1995-1999, 2001-2021 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License". --> <title>Raw Formatter Commands (GNU Texinfo 6.8)</title> <meta name="description" content="Raw Formatter Commands (GNU Texinfo 6.8)"> <meta name="keywords" content="Raw Formatter Commands (GNU Texinfo 6.8)"> <meta name="resource-type" content="document"> <meta name="distribution" content="global"> <meta name="Generator" content="texi2any"> <meta name="viewport" content="width=device-width,initial-scale=1"> <link href="index.html" rel="start" title="Top"> <link href="Command-and-Variable-Index.html" rel="index" title="Command and Variable Index"> <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> <link href="Conditionals.html" rel="up" title="Conditionals"> <link href="Inline-Conditionals.html" rel="next" title="Inline Conditionals"> <link href="Conditional-Not-Commands.html" rel="prev" title="Conditional Not Commands"> <style type="text/css"> <!-- a.copiable-anchor {visibility: hidden; text-decoration: none; line-height: 0em} a.summary-letter {text-decoration: none} blockquote.indentedblock {margin-right: 0em} div.display {margin-left: 3.2em} div.example {margin-left: 3.2em} kbd {font-style: oblique} pre.display {font-family: inherit} pre.format {font-family: inherit} pre.menu-comment {font-family: serif} pre.menu-preformatted {font-family: serif} span.nolinebreak {white-space: nowrap} span.roman {font-family: initial; font-weight: normal} span.sansserif {font-family: sans-serif; font-weight: normal} span:hover a.copiable-anchor {visibility: visible} ul.no-bullet {list-style: none} --> </style> </head> <body lang="en"> <div class="section" id="Raw-Formatter-Commands"> <div class="header"> <p> Next: <a href="Inline-Conditionals.html" accesskey="n" rel="next">Inline Conditionals: <code>@inline</code>, <code>@inlineifelse</code>, <code>@inlineraw</code></a>, Previous: <a href="Conditional-Not-Commands.html" accesskey="p" rel="prev">Conditional Not Commands</a>, Up: <a href="Conditionals.html" accesskey="u" rel="up">Conditionally Visible Text</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Command-and-Variable-Index.html" title="Index" rel="index">Index</a>]</p> </div> <hr> <span id="Raw-Formatter-Commands-1"></span><h3 class="section">15.3 Raw Formatter Commands</h3> <span id="index-Raw-formatter-commands"></span> <span id="index-TeX-commands_002c-using-ordinary"></span> <span id="index-Ordinary-TeX-commands_002c-using"></span> <span id="index-Commands-using-raw-TeX"></span> <span id="index-Plain-TeX"></span> <p>The <code>@if…</code> conditionals just described must be used only with normal Texinfo source. For instance, most features of plain TeX will not work within <code>@iftex</code>. The purpose of <code>@if…</code> is to provide conditional processing for Texinfo source, not provide access to underlying formatting features. For that, Texinfo provides so-called <em>raw formatter commands</em>. They should only be used when truly required (most documents do not need them). </p> <span id="index-tex"></span> <span id="index-Category-codes_002c-of-plain-TeX"></span> <p>The first raw formatter command is <code>@tex</code>. You can enter plain TeX completely, and use ‘<samp>\</samp>’ in the TeX commands, by delineating a region with the <code>@tex</code> and <code>@end tex</code> commands. All plain TeX commands and category codes are restored within a <code>@tex</code> region. The sole exception is that the <code>@</code> character still introduces a command, so that <code>@end tex</code> can be recognized. Texinfo processors will not output material in such a region unless TeX output is being produced. </p> <span id="index-_005cgdef-within-_0040tex"></span> <span id="index-_005cglobaldefs-within-_0040tex"></span> <p>In complex cases, you may wish to define new TeX macros within <code>@tex</code>. You must use <code>\gdef</code> to do this, not <code>\def</code>, because <code>@tex</code> regions are processed in a TeX group. If you need to make several definitions, you may wish to set <code>\globaldefs=1</code> (its value will be restored to zero as usual when the group ends at <code>@end tex</code>, so it won’t cause problems with the rest of the document). </p> <span id="index-Equation_002c-displayed_002c-in-plain-TeX"></span> <span id="index-Displayed-equation_002c-in-plain-TeX"></span> <p>As an example, here is a displayed equation written in plain TeX: </p> <div class="example"> <pre class="example">@tex $$ \chi^2 = \sum_{i=1}^N \left (y_i - (a + b x_i) \over \sigma_i\right)^2 $$ @end tex </pre></div> <p>The output of this example will appear only in a printed manual. If you are reading this in a format not generated by TeX, you will not see the equation that appears in the printed manual. </p> <span id="index-HTML_002c-including-raw"></span> <span id="index-ifhtml-1"></span> <span id="index-html"></span> <p>Analogously, you can use <code>@ifhtml … @end ifhtml</code> to delimit Texinfo source to be included in HTML output only, and <code>@html … @end html</code> for a region of raw HTML. </p> <span id="index-XML_002c-including-raw"></span> <span id="index-ifxml-1"></span> <span id="index-xml"></span> <p>Likewise, you can use <code>@ifxml … @end ifxml</code> to delimit Texinfo source to be included in XML output only, and <code>@xml … @end xml</code> for a region of raw XML. Regions of raw text in other formats will also be present in the XML output, but with protection of XML characters and within corresponding elements. For example, the raw HTML text: </p> <div class="example"> <pre class="example">@html <br /> @end html </pre></div> <p>will be included in the XML output as: </p> <div class="example"> <pre class="example"><html> &lt;br /&gt; </html> </pre></div> <span id="index-DocBook_002c-including-raw"></span> <span id="index-ifdocbook-1"></span> <span id="index-docbook"></span> <p>Again likewise, you can use <code>@ifdocbook … @end ifdocbook</code> to delimit Texinfo source to be included in DocBook output only, and <code>@docbook … @end docbook</code> for a region of raw DocBook. </p> <p>The behavior of newlines in raw regions is unspecified. </p> <p>In all cases, in raw processing, <code>@</code> retains the same meaning as in the remainder of the document. Thus, the Texinfo processors must recognize and even execute, to some extent, the contents of the raw regions, regardless of the final output format. Therefore, specifying changes that globally affect the document inside a raw region leads to unpredictable and generally undesirable behavior. For example, using the <code>@kbdinputstyle</code> command inside a raw region is undefined. </p> <p>The remedy is simple: don’t do that. Use the raw formatter commands for their intended purpose, of providing material directly in the underlying format. When you simply want to give different Texinfo specifications for different output formats, use the <code>@if…</code> conditionals and stay in Texinfo syntax. </p> </div> <hr> <div class="header"> <p> Next: <a href="Inline-Conditionals.html">Inline Conditionals: <code>@inline</code>, <code>@inlineifelse</code>, <code>@inlineraw</code></a>, Previous: <a href="Conditional-Not-Commands.html">Conditional Not Commands</a>, Up: <a href="Conditionals.html">Conditionally Visible Text</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Command-and-Variable-Index.html" title="Index" rel="index">Index</a>]</p> </div> </body> </html>