Formatting XML and other computer code

Lester C. Smalley lsmalley at infocon.com
Fri Nov 16 07:56:15 PST 2007


I also use the table approach (although I use a monospace font at 10 pt
for legibility) for formatting program code examples.

The advantage of a table is that if you have long code lines, they wrap
within the table cell, and will be kept together on the same page as FM
won't split a cell over a column or page break.  You can fine-tune the
spacing between lines by adjusting the table's top and bottom cell
margins via the table designer.

You can improve a bit on this perhaps by setting the left indent of the
paragraph format so the 'continuation' lines are offset from the initial
line, making it clearer to the reader that it is a single line of code
(or even provide a note to that effect) and this could be set up in
format rules if you're using a structured template.  If not, you might
create a few 'code sample' paragraph formats to control indentation
level if desired.

You can convert any number of sequential paragraphs into a table by
selecting them and choosing "Convert to Table" from the table menu.  If
you wish, you can use the table to preserve indentations by setting
multiple columns based on tabs (or another character or multiple spaces)
but then you usually have a very large amount of work to do to straddle
cells to get the appearance correct.  A single column with appropriate
tab stops/different paragraph formats for indentation as desired is much
more automatic...
 
On Thursday, November 15, 2007 09:45 AM, Carol Wade wrote:

| Thanks, all who responded. Over time, I'll try all the 
| approaches & will report back.
|  
| Art: What is the advantage of putting the text in a table, 
| with each line a separate row? (which I assume can be done 
| automatically based on carriage returns)
|  
| Paul: I'm downloading UltraEdit now - looks like a good tool!
|  
| - Carol
....
| > I copy it from the screen into FM as raw text with Paste Special >
| > Text with a para at the end of each line. If it has too many tabs,
| > you can do a find-and-replace to clean them out or convert to
| > multiple spaces. 
| > Then convert it to a single column table, one line per cell. The
| > para tag for each cell is a 6 or 7 point monospace font, such as
| > Courier.

- Lester 
-------------------------------------------------------
Lester C. Smalley              Email: lsmalley AT infocon DOT com 	
Information Consultants, Inc.  Phone: 302-239-2942 FAX: 302-239-1712	
Yorklyn, DE  19736               Web: www.infocon.com	
-------------------------------------------------------




More information about the framers mailing list