| <!DOCTYPE html> |
| <html> |
| <!-- Created by Texinfo 6.8dev+dev, http://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.8dev, 23 February 2022), |
| 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-2022 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>@samp (GNU Texinfo 6.8dev)</title> |
| |
| <meta name="description" content="@samp (GNU Texinfo 6.8dev)"> |
| <meta name="keywords" content="@samp (GNU Texinfo 6.8dev)"> |
| <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="Indicating.html" rel="up" title="Indicating"> |
| <link href="_0040verb.html" rel="next" title="@verb"> |
| <link href="_0040key.html" rel="prev" title="@key"> |
| <style type="text/css"> |
| <!-- |
| div.example {margin-left: 3.2em} |
| --> |
| </style> |
| |
| |
| </head> |
| |
| <body lang="en"> |
| <div class="subsection-level-extent" id="g_t_0040samp"> |
| <div class="nav-panel"> |
| <p> |
| Next: <a href="_0040verb.html" accesskey="n" rel="next"><code class="code">@verb</code>{<var class="var">char</var><var class="var">text</var><var class="var">char</var>}</a>, Previous: <a href="_0040key.html" accesskey="p" rel="prev"><code class="code">@key</code>{<var class="var">key-name</var>}</a>, Up: <a href="Indicating.html" accesskey="u" rel="up">Indicating Definitions, Commands, etc.</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> |
| <h4 class="subsection" id="g_t_0040samp_007btext_007d">6.1.5 <code class="code">@samp</code>{<var class="var">text</var>}</h4> |
| |
| <a class="anchor" id="samp"></a><a class="index-entry-id" id="index-samp"></a> |
| |
| <p>Use the <code class="code">@samp</code> command to indicate text that is a literal example |
| or ‘sample’ of a sequence of characters in a file, string, pattern, etc. |
| Enclose the text in braces. The argument appears within single |
| quotation marks in both the Info file and the printed manual; in |
| addition, it is printed in a fixed-width font. |
| </p> |
| <div class="example"> |
| <pre class="example-preformatted">To match @samp{foo} at the end of the line, |
| use the regexp @samp{foo$}. |
| </pre></div> |
| |
| <p>produces |
| </p> |
| <blockquote class="quotation"> |
| <p>To match ‘<samp class="samp">foo</samp>’ at the end of the line, use the regexp |
| ‘<samp class="samp">foo$</samp>’. |
| </p></blockquote> |
| |
| <p>Any time you are referring to single characters, you should use |
| <code class="code">@samp</code> unless <code class="code">@kbd</code> or <code class="code">@key</code> is more appropriate. |
| Also, you may use <code class="code">@samp</code> for entire statements in C and for entire |
| shell commands—in this case, <code class="code">@samp</code> often looks better than |
| <code class="code">@code</code>. Basically, <code class="code">@samp</code> is a catchall for whatever is |
| not covered by <code class="code">@code</code>, <code class="code">@kbd</code>, <code class="code">@key</code>, |
| <code class="code">@command</code>, etc. |
| </p> |
| <p>Only include punctuation marks within braces if they are part of the |
| string you are specifying. Write punctuation marks outside the braces |
| if those punctuation marks are part of the English text that surrounds |
| the string. In the following sentence, for example, the commas and |
| period are outside of the braces: |
| </p> |
| <div class="example"> |
| <div class="group"><pre class="example-preformatted">In English, the vowels are @samp{a}, @samp{e}, |
| @samp{i}, @samp{o}, @samp{u}, and sometimes |
| @samp{y}. |
| </pre></div></div> |
| |
| <p>This produces: |
| </p> |
| <blockquote class="quotation"> |
| <p>In English, the vowels are ‘<samp class="samp">a</samp>’, ‘<samp class="samp">e</samp>’, |
| ‘<samp class="samp">i</samp>’, ‘<samp class="samp">o</samp>’, ‘<samp class="samp">u</samp>’, and sometimes |
| ‘<samp class="samp">y</samp>’. |
| </p></blockquote> |
| |
| |
| </div> |
| <hr> |
| <div class="nav-panel"> |
| <p> |
| Next: <a href="_0040verb.html"><code class="code">@verb</code>{<var class="var">char</var><var class="var">text</var><var class="var">char</var>}</a>, Previous: <a href="_0040key.html"><code class="code">@key</code>{<var class="var">key-name</var>}</a>, Up: <a href="Indicating.html">Indicating Definitions, Commands, etc.</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> |