Le 23 nov. 2009 à 19:15, Joel E. Denny a écrit :

Hi all!

> I've only recently begun to understand the difference between @samp and 
> @code (because I saw Akim correct some of my poor usage), and I'm not sure 
> I completely understand it.

Well, I would not pretend I know the rule :)  The one I follow is basically to 
use @code for single tokens, and to use @samp for compound statemnts.  The 
Texinfo documentation is not very clear cut either, but it says:

> Use the `...@code' command to indicate text that is a piece of a program
> and which consists of entire syntactic tokens.  Enclose the text in
> braces.
> 
>  Thus, you should use `...@code' for an expression in a program, for the
> name of a variable or function used in a program, or for a keyword in a
> programming language.

and

> Use the `...@samp' 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.
> 
>     To match @samp{foo} at the end of the line,
>     use the regexp @samp{foo$}.
> 
> produces
> 
>     To match `foo' at the end of the line, use the regexp `foo$'.
> 
>  Any time you are referring to single characters, you should use
> `...@samp' unless `...@kbd' or `...@key' is more appropriate.  Also, you may 
> use
> `...@samp' for entire statements in C and for entire shell commands--in
> this case, `...@samp' often looks better than `...@code'.  Basically, 
> `...@samp'
> is a catchall for whatever is not covered by `...@code', `...@kbd', or 
> `...@key'.

There are more examples in the documentation. 


> However, I'm pretty sure @code{.suffix} 
> should be @samp{.suffix} because it discusses a string of text instead of, 
> for example, a variable name.

Definitely.



Reply via email to