## How Do I... Post Fixed Width Text?

Announcements, comments, ideas, feedback, and "How do I... ?" questions
euler
Posts: 3210
Joined: Sun Mar 05, 2006 4:49 pm
Location: Cheshire, England
Contact:

### How Do I... Post Fixed Width Text?

(Note that spaces need to be removed from BBCode tags to make them work. If in doubt click "Quote" and look at the code I used.)

Fixed width tags are useful as they allow text to appear exactly as you wish. Normally extra spaces are stripped away, but in fixed width text everyting is preserved. This also allows text to aligned precisely on adjacent rows. There are two ways this can be done.
1. The [ tt ] tag is ideal for posting a span of fixed width text, or producing diagrams that require a "matrix" arrangement.
2. The [ code ] tag is better suited for posting programming code as the default view is only the first three lines. It is necessary to click "Expand" to view the full section.
Example 1 (tt tag)

[ tt ]
1   2   3
4   5
6
[ / tt ]

produces
1   2   3
4   5
6
Example 2 (code tag)

[ code ]
'Display the 20th Fibonacci number on the console
Dim intLoop, intF(20) As Integer
intF(1) = 1
intF(2) = 1
For intLoop = 3 to 20
intF(intLoop) = intF(intLoop - 1) + intF(intLoop - 2)
Next intLoop
Console.WriteLine(intF(20))
[ / code ]

produces

Code: Select all

'Display the 20th Fibonacci number on the console
Dim intLoop, intF(20) As Integer
intF(1) = 1
intF(2) = 1
For intLoop = 3 to 20
intF(intLoop) = intF(intLoop - 1) + intF(intLoop - 2)
Next intLoop
Console.WriteLine(intF(20))