[ << Documentation work ] | [Top][Contents] | [ Website work >> ] |
[ < External links ] | [ Up : Syntax survey ] | [ Indexing > ] |
Fixed-width font
-
@code{…}
,@samp{…}
—Use the
@code{…}
command when referring to individual language-specific tokens (keywords, commands, engravers, scheme symbols, etc.) in the text. Ideally, a single@code{…}
block should fit within one line in the PDF output.Use the
@samp{…}
command when you have a short example of user input, unless it constitutes an entire@item
by itself, in which case@code{…}
is preferable. Otherwise, both should only be used when part of a larger sentence within a paragraph or@item
. Do not use@code{…}
or@samp{…}
inside an@example
block, and do not use either as a free-standing paragraph; use@example
instead.A single unindented line in the PDF has space for about 79 fixed-width characters (76 if indented). Within an
@item
there is space for about 75 fixed-width characters. Each additional level of@itemize
or@enumerate
shortens the line by about 4 columns.However, even short blocks of
@code{…}
and@samp{…}
can run into the margin if the Texinfo line-breaking algorithm gets confused. Additionally, blocks that are longer than this may in fact print nicely; it all depends where the line breaks end up. If you compile the docs yourself, check the PDF output to make sure the line breaks are satisfactory.The Texinfo setting
@allowcodebreaks
is set tofalse
in the manuals, so lines within@code{…}
or@samp{…}
blocks will only break at spaces, not at hyphens or underscores. If the block contains spaces, use@w{@code{…}}
or@w{@samp{…}}
to prevent unexpected line breaks.The Texinfo settings
txicodequoteundirected
andtxicodequotebacktick
are both set in the manuals, so backticks (`
) and apostrophes ('
) placed within blocks of@code
,@example
, or@verbatim
are not converted to left- and right-angled quotes (‘ ’
) as they normally are within the text, so the apostrophes in ‘@w{@code{\relative c''}}
’ will display correctly. However, these settings do not affect the PDF output for anything within a@samp
block (even if it includes a nested@code
block), so entering ‘@w{@samp{\relative c''}}
’ wrongly produces ‘\relative c’’
’ in PDF. Consequently, if you want to use a@samp{…}
block which contains backticks or apostrophes, you should instead use ‘@q{@code{…}}
’ (or ‘@q{@w{@code{…}}}
’ if the block also contains spaces). -
@command{…}
— Use when referring to command-line commands within the text (eg. ‘@command{convert-ly}’). Do not use inside an@example
block. -
@example
— Use for examples of program code. Do not add extraneous indentation (i.e., don’t start every line with whitespace). Use the following layout (notice the use of blank lines). Omit the@noindent
if the text following the example starts a new paragraph:…text leading into the example… @example … @end example @noindent continuation of the text…
Individual lines within an
@example
block should not exceed 74 characters; otherwise they will run into the margin in the PDF output, and may get clipped. If an@example
block is part of an@item
, individual lines in the@example
block should not exceed 70 columns. Each additional level of@itemize
or@enumerate
shortens the line by about 4 columns.For long command-line examples, if possible, use a trailing backslash to break up a single line, indenting the next line with 2 spaces. If this isn’t feasible, use ‘@smallexample … @end smallexample’ instead, which uses a smaller fontsize. Use
@example
whenever possible, but if needed,@smallexample
can fit up to 90 characters per line before running into the PDF margin. Each additional level of@itemize
or@enumerate
shortens a@smallexample
line by about 5 columns. -
@file{…}
— Use when referring to file names and directories in the text. Do not use inside an@example
block. -
@option{…}
— Use when referring to command-line options in the text (eg. ‘@option{--format}’). Do not use inside an@example
block. -
@verbatim
— Prints the block exactly as it appears in the source file (including whitespace, etc.). For program code examples, use@example
instead.@verbatim
uses the same format as@example
.Individual lines within an
@verbatim
block should not exceed 74 characters; otherwise they will run into the margin in the PDF output, and may get clipped. If an@verbatim
block is part of an@item
, individual lines in the@verbatim
block should not exceed 70 columns. Each additional level of@itemize
or@enumerate
shortens the line by about 4 columns.
[ << Documentation work ] | [Top][Contents] | [ Website work >> ] |
[ < External links ] | [ Up : Syntax survey ] | [ Indexing > ] |