JezK
Edit File: _0040set-_0040value.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>@set @value (GNU Texinfo 6.8)</title> <meta name="description" content="@set @value (GNU Texinfo 6.8)"> <meta name="keywords" content="@set @value (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="_0040set-_0040clear-_0040value.html" rel="up" title="@set @clear @value"> <link href="_0040ifset-_0040ifclear.html" rel="next" title="@ifset @ifclear"> <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="subsection" id="g_t_0040set-_0040value"> <div class="header"> <p> Next: <a href="_0040ifset-_0040ifclear.html" accesskey="n" rel="next"><code>@ifset</code> and <code>@ifclear</code></a>, Up: <a href="_0040set-_0040clear-_0040value.html" accesskey="u" rel="up">Flags: <code>@set</code>, <code>@clear</code>, conditionals, and <code>@value</code></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="g_t_0040set-and-_0040value"></span><h4 class="subsection">15.5.1 <code>@set</code> and <code>@value</code></h4> <span id="set-value"></span><span id="index-set"></span> <span id="index-value"></span> <span id="index-clear"></span> <p>You use the <code>@set</code> command to specify a value for a flag, which is later expanded by the <code>@value</code> command. </p> <p>A <em>flag</em> (aka <em>variable</em>) name is an identifier starting with an alphanumeric, ‘<samp>-</samp>’, or ‘<samp>_</samp>’. Subsequent characters, if any, may not be whitespace, ‘<samp>@</samp>’, braces, angle brackets, or any of ‘<samp>~`^+|</samp>’; other characters, such as ‘<samp>%</samp>’, may work. However, it is best to use only letters and numerals in a flag name, not ‘<samp>-</samp>’ or ‘<samp>_</samp>’ or others—they will work in some contexts, but not all, due to limitations in TeX. </p> <p>The value is the remainder of the input line, and can contain anything. However, unlike most other commands which take the rest of the line as a value, <code>@set</code> need not appear at the beginning of a line. </p> <p>Write the <code>@set</code> command like this: </p> <div class="example"> <pre class="example">@set foo This is a string. </pre></div> <p>This sets the value of the flag <code>foo</code> to “This is a string.”. </p> <p>The Texinfo formatters then replace a <code>@value{<var>flag</var>}</code> command with the string to which <var>flag</var> is set. Thus, when <code>foo</code> is set as shown above, the Texinfo formatters convert this: </p> <div class="example"> <pre class="example">@value{foo} </pre><pre class="example"><span class="roman">to this:</span> </pre><pre class="example">This is a string. </pre></div> <p>You can write a <code>@value</code> command within a paragraph; but you must write a <code>@set</code> command on a line of its own. </p> <p>If you write the <code>@set</code> command like this: </p> <div class="example"> <pre class="example">@set foo </pre></div> <p>without specifying a string, the value of <code>foo</code> is the empty string. </p> <p>If you clear a previously set flag with <code>@clear <var>flag</var></code>, a subsequent <code>@value{flag}</code> command will report an error. </p> <p>For example, if you set <code>foo</code> as follows: </p> <div class="example"> <pre class="example">@set howmuch very, very, very </pre></div> <p>then the formatters transform </p> <div class="example"> <pre class="example">It is a @value{howmuch} wet day. </pre><pre class="example"><span class="roman">into</span> </pre><pre class="example">It is a very, very, very wet day. </pre></div> <p>If you write </p> <div class="example"> <pre class="example">@clear howmuch </pre></div> <p>then the formatters transform </p> <div class="example"> <pre class="example">It is a @value{howmuch} wet day. </pre><pre class="example"><span class="roman">into</span> </pre><pre class="example">It is a {No value for "howmuch"} wet day. </pre></div> <p><code>@value</code> cannot be reliably used as the argument to an accent command (see <a href="Inserting-Accents.html">Inserting Accents</a>). For example, this fails: </p> <div class="example"> <pre class="example">@set myletter a @'@value{myletter} </pre></div> </div> <hr> <div class="header"> <p> Next: <a href="_0040ifset-_0040ifclear.html"><code>@ifset</code> and <code>@ifclear</code></a>, Up: <a href="_0040set-_0040clear-_0040value.html">Flags: <code>@set</code>, <code>@clear</code>, conditionals, and <code>@value</code></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>