<! banner_id > According to the format of the output file, the macro package defines a given symbol: <dl> <li > <code>latex</code> when the output format is LaTeX, <li > <code>html</code> when the output format is HTML, <li > <code>man</code> when the output format is groff in conjunction with the man macro package, <li > <code>ms</code> when the output format is groff with the ms package, <li > <code>sgml</code> when the output format is SGML, <li > <code>txt</code> when the output format is plain ASCII. </dl> The defined symbol can be tested in a document to determine the conversion type. Furthermore, the package defines the following macros to send litteral text (commands in the output format) to the output file: <dl> <li > <code>latexcommand(cmd)</code>: sends the LaTeX command <code>cmd</code> when in LaTeX conversion mode. The <code>cmd</code> is not further expanded. <li > <code>htmlcommand(cmd)</code>: sends the HTML command <code>cmd</code> when in HTML conversion mode. The <code>cmd</code> is not further expanded. <li > <code>htmltag(tag)(onoff)</code>: sends <code><tag></code> to the output when <code>onoff</code> is nonzero, or sends <code></tag></code> when <code>onoff</code> is zero. Only active in HTML conversions. <li > <code>mancommand(cmd)</code>: sends <code>cmd</code> to the output when in man conversion mode. The <code>cmd</code> is not further expanded. <li > <code>mscommand(cmd)</code>: sends <code>cmd</code> to the output when in ms conversion mode. The <code>cmd</code> is not further expanded. <li > <code>roffcmd(dotcmd)(trailer)(secondline)(thirdline)</code>: sends a command to the output when in <code>man</code> or <code>ms</code> conversion mode. The <code>dotcmd</code> is the typical <code>groff</code> command that starts with a dot. All other arguments may be empty, but when given are interpreted as follows. The <code>trailer</code> follows the <code>dotcmd</code> on the same line. The <code>secondline</code> is sent on a separate line following the <code>dotcmd</code> and <code>trailer</code>. The <code>thirdline</code> is sent after that. Of the four arguments, <code>dotcmd</code> and <code>thirdline</code> are <strong>not</strong> subject to further expansion. All other arguments are further expanded if necessary. The <code>roffcmd</code> macro illustrates the complexity of dot-commands for the divers <code>groff</code> macro packages. E.g., a section title for the <code>man</code> package should look as <pre> .SH "Section Title" </pre> <p>while the same command for the <code>ms</code> macro package must be sent as <p><pre> .SH Section Title .PP </pre> <p>The <code>roffcmd</code> macro can be used to send these commands to the output file as follows: <p><pre> COMMENT(For the man output format:) roffcmd(.SH)("Section Title")()() COMMENT(For the ms output format:) roffcmd(.SH)()(Section Title)(.PP)() </pre> <p><li > <code>sgmlcommand(cmd)</code>: sends the SGML command <code>cmd</code> when in SGML conversion mode. The <code>cmd</code> is not further expanded. <p><li > <code>sgmltag(tag)(onoff)</code>: sends <code><tag></code> when <code>onoff</code> is nonzero, or sends <code></tag></code> when <code>onoff</code> is zero. Only active in SGML conversions. <p><li > <code>txtcommand(cmd)</code>: implemented for compatibility reasons, though a `command' in plain ASCII output doesn't make much sense. The usefulness of this macro is rather in the fact that it only produces output when in ASCII conversion mode. <p></dl> <p>The above commands can be used to quickly implement a macro. E.g., the macro package implements the <code>it</code> macro (which starts an item in a list) as: <p><pre> DEFINEMACRO(it)(0)(\ latexcommand(\item )\ htmlcommand(<li> )\ ....) </pre> <p>Depending on the output format, <code>it()</code> will lead to one of the above expansions. <p>The above described <em>format</em><code>command()</code> macros are implemented to send not further expanded strings (i.e., commands) to the output. The macro package also implements <code>when</code><em>format</em><code>()</code> macros to send any text, which is then subject to further expansion. These <code>when...()</code> macros are: <p><dl> <p><li > <code>whenlatex(text)</code>: sends <code>text</code> when in LaTeX conversion mode, <p><li > <code>whenhtml(text)</code>: sends <code>text</code> when in HTML conversion mode, <p><li > <code>whenman(text)</code>: sends <code>text</code> when in man conversion mode, <p><li > <code>whenms(text)</code>: sends <code>text</code> when in ms conversion mode, <p><li > <code>whentxt(text)</code>: sends <code>text</code> when in ASCII conversion mode, <p><li > <code>whensgml(text)</code>: sends <code>text</code> when in SGML conversion mode. <p></dl> <p><strong>Note again</strong> that the difference between the <code>when</code><em>format</em><code>()</code> macros and the <em>format</em><code>command()</code> macros is, that the former will expand their argument while the latter will not. As an example, consider the following code fragment: <p><pre> You are now reading whenlatex(a LaTeX-generated footnote(LaTeX is a great document language!) document) whenhtml(a HTML document via your favorite browser) </pre> <p>The <code>when</code><em>format</em><code>()</code> macros are used here to make sure that the arguments to the macros are further expanded; this makes sure that the <code>footnote</code> macro in the <code>whenlatex</code> block gets treated as a footnote. <!-- if this file ./Documentation/footer.html.in is present, it is included automatically by add-html-footer, and replaces the simple standard footer substitutions: * index, * package name * package name * ENV:WEBMASTER, * ENV:WEBMASTER --> <hr> Go <a href=>back</a> to index of Yodl. <p> Please send Yodl questions and comments to <a href="mailto:yodl@icce.rug.nl"> <em>yodl@icce.rug.nl</em></a>. <p> <!-- package Yodl Yodl --> Please send comments on these web pages to <a href="mailto:(address unknown)"><em>(address unknown)</em></a> <p> Copyright (c) 1997, 1998, 1999 Karel Kubat and Jan Nieuwenhuizen. <p> Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.<p> <hr><font size=-1> This page was built from Yodl-1.31.18 by <address><br> <<a href=\"mailto:(address unknown)\">(address unknown)</a>>, Wed Mar 5 04:36:20 2008 EST.</address><p></font></BODY> </html>