|
|
|
Publishing / FTX / Tutorial / code |
| Displaying computer code Word mode Once in a while youll want to express something in a computer-ish typeface, for example to describe a key on the keyboard or something you would like a reader to type. Using a pair of vertical bar characters around words, you can switch into HTMLs <TT> (teletype) font. Thus, if you wrote:
then it displays as Press the Enter key. Note: If you need to display a real vertical bar character, use a backtick just as you would for {, }, [, ], <, and >:
and this displays as I can write teletype stuff and I can write vertical bars |. Block mode You can also express entire blocks of text as pre-formatted text in the teletype font by using a vertical bar (followed by a space) at the beginning of each such line. For example, if you wrote:
then it displays as: int main(int argc, char *argv[])
{
...
Double block mode Alternatively, you can use two vertical bars (followed by a space) at the beginning of each line in a paragraph to show that block in a lightly shaded background with a thin border. For example, if you wrote:
then it displays as:
(This tutorial uses double-block mode judiciously.) Subtleties Note: Teletype mode behaves slightly differently between block-mode and word-mode. In block-mode (where the first two characters of the line are a vertical bar and a space character), you can safely use any other characters on the line. In word-mode, however, even though {, }, [, ], <, >, and _ are protected from interpretation, youll still need to use a backtick character for ` and |. For example,
displays nicely as The size is given by $foo_bar->{zot}, if present. But
will not display as The vector $C is computed as $A | $B. To get that, the backtick character ` still needs to be used, like this:
|
|
All text, images, or trademarks in this document are the intellectual property of their respective owners. |
| |
©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR |