none
[openafs-wiki.git] / TWiki / TextFormattingFAQ.mdwn
1 **Text Formatting FAQ**
2
3 This topic has answers to frequently asked questions about text formatting. [[TextFormattingRules]] has more on formatting rules in general. It also has links to HTML documentation.
4
5 - [Q:](#sepa) How do I make a separator?
6 - [Q:](#head) How do I create a title or a heading?
7 - [Q:](#brac) Text enclosed in angle brackets like <filename> is not displayed. How can I show it as it is?
8 - [Q:](#ques) Some words (like [[WinAPI]]) have an unwanted question mark at the end. How can I prevent that?
9 - [Q:](#fixe) How can I write fixed font text?
10 - [Q:](#wrap) Text I enter gets wrapped around. How can I keep the formatting as it is?
11 - [Q:](#tabl) How do I create tables?
12 - [Q:](#imag) Can I include images and pictures?
13 - [Q:](#colo) Can I write colored text?
14
15 ----
16
17 <a name="sepa">Q:</a> **How do I make a separator?**
18
19 You can make a horizontal separator by writing 4 or more dashes at the beginning of a line.
20
21 ----
22
23 <a name="head">Q:</a> **How do I create a title or a heading?**
24
25 The most simple way is to enclose it in '\*' Asterisk characters or '\_' Underscore charcters.
26
27 **This is an example header enclosed in Asterisk characters**
28
29 _This is an example header enclosed in Underscore characters_
30
31 You could use also HTML tags for headings, e.g. `<H4>This is an HTML heading</H4>` will show up as:
32
33 #### <a name="This is an HTML heading"></a> This is an HTML heading
34
35 ----
36
37 <a name="brac">Q:</a> **Text enclosed in angle brackets like &lt;filename&gt; is not displayed. How can I show it as it is?**
38
39 TWiki interprets text as HTML. The '&lt;' and '&gt;' characters are used to define HTML commands. Any valid text within angle brackets gets interpreted by the browser as an HTML command. Invalid text is ignored, that's why it doesn't show up.
40
41 There are two work arounds if you want to display angle brackets:
42
43 - Do an escape sequence in HTML:
44   - Write `&lt;` instead of `<`
45   - Write `&gt;` instead of `>`
46   - Example: Write `(a &gt; 0)` instead of `(a > 0)`
47 - Replace angle brackets with curly brackets.
48   - Example: Write `{is-writable}` instead of `<is-writable>`
49
50 ----
51
52 <a name="ques">Q:</a> **Some words (like [[WinAPI]]) have an unwanted question mark at the end. How can I prevent that?**
53
54 A question mark after a word is a link to a not yet existing topic. For example, [[WinAPI]] is a valid [[WikiTopic]] name in [[WikiNotation]], but the actual topic _WinAPI_ does not exist.
55
56 If you do not intend to create a topic for a valid TWiki topic name, you can prevent it being linked by putting an HTML tag in front of it. I usually use &lt;NOP&gt;. This is a non existing HTML tag, so a browser just ignores it.
57
58 - Example text: <br />`WinAPI as it is, <NOP>WinAPI with preceeding NOP.`
59 - Example output: <br />[[WinAPI]] as it is, WinAPI with preceeding NOP.
60
61 ----
62
63 <a name="fixe">Q:</a> **How can I write fixed font text?**
64
65 Enclose text in "=" equal signs.
66
67 - Example text: <br />`Proportional text, =fixed font text= , proportional again.`
68 - Example output: <br /> Proportional text, `fixed font text` , proportional again.
69
70 Alternatively you could also use preformatted text, see next question for details.
71
72 ----
73
74 <a name="wrap">Q:</a> **Text I enter gets wrapped around. How can I keep the formatting as it is?**
75
76 TWiki interprets text as HTML. It is possible to use preformatted text to work around this. Use the preformatted HTML tags to keep the new line of text as it is. Do so by enclosing the text with &lt;PRE&gt; and &lt;/PRE&gt; tags, e.g.
77
78     This text will keep its format as it is:
79     <PRE>
80       Unit        Price Qty  Cost
81       -------  ------  ---  ------
82       aaa                12.00   3      36.00
83     </PRE>
84
85 It is recommended to use preformatting for tables and source code.
86
87 ----
88
89 <a name="tabl">Q:</a> **How do I create tables?**
90
91 There are three possibilities:
92
93 1. Use Wiki rule with "|" vertical bars.
94 2. Use HTML tables with &lt;TABLE&gt;, &lt;TR&gt;, &lt;TD&gt; tags.
95 3. Use preformatted text with &lt;PRE&gt; tags.
96
97 **\_1. Use Wiki rule with "|" vertical bars\_**
98
99 - Example text: <br />`| cell A1 | cell B1 | cell C1 |`<br />`| cell A2 | cell B2 | cell C2 |`
100 - Example output: <table border="1" cellpadding="0" cellspacing="0">
101   <tr>
102     <td> cell A1 </td>
103     <td> cell B1 </td>
104     <td> cell C1 </td>
105   </tr>
106   <tr>
107     <td> cell A2 </td>
108     <td> cell B2 </td>
109     <td> cell C2 </td>
110   </tr>
111 </table>
112
113 **\_2. Use HTML tables with &lt;TABLE&gt;, &lt;TR&gt;, &lt;TD&gt; tags\_**
114
115 This is a manual process using HTML commands. Here is an example. If you enter this:
116
117     <TABLE BORDER=1>
118       <TR>
119          <TH> Head A  </TH> <TH> Head B  </TH>
120       </TR><TR>
121          <TD> Cell A2 </TD> <TD> Cell B2 </TD>
122       </TR><TR>
123          <TD> Cell A3 </TD> <TD> Cell B3 </TD>
124       </TR>
125     </TABLE>
126
127 It is displayed as a table like this:
128
129 <table border="1">
130   <tr>
131     <th> Head A </th>
132     <th> Head B </th>
133   </tr>
134   <tr>
135     <td> Cell A2 </td>
136     <td> Cell B2 </td>
137   </tr>
138   <tr>
139     <td> Cell A3 </td>
140     <td> Cell B3 </td>
141   </tr>
142 </table>
143
144 You can copy the example from &lt;TABLE&gt; to &lt;/TABLE&gt; and change it to your needs.
145
146 More information about HTML tables can be found at <http://www.htmlhelp.com/reference/wilbur/table/table.html>
147
148 **\_3. Use preformatted text with &lt;PRE&gt; tags\_**
149
150 See [Q:](#wrap) Text I enter gets wrapped around. How can I keep the formatting as it is?
151
152 ----
153
154 <a name="imag">Q:</a> **Can I include images and pictures?**
155
156 Yes, this is possible. The easiest way of including images is to attach a GIF or JPG file to a topic and then to include it with text `%ATTACHURL%/myImage.gif` . [[FileAttachment]] has more.
157
158 There are actually two ways of including inline images.
159
160 **\_1. Using URL ending in .gif, .jpg, .jpeg\_**
161
162 This is a simple and automatic way of including inline images. Simply write the URL of the image file, this will create the inline image for you. **Note:** The images must be accessible as a URL.
163
164 - Example text: <br />` TWiki http://www.dementia.org/twiki//view/wikiHome.gif logo.`
165 - Example output: <br /> TWiki ![wikiHome.gif](http://www.dementia.org/twiki//view/wikiHome.gif) logo.
166
167 **\_2. Using &lt;IMG&gt; tag\_**
168
169 This is a manual process where you have more control over the rendering of the image. Use the &lt;IMG&gt; tag of HTML to include JPEG and GIF files. **Note:** The display of the topic is faster if you include the WIDTH and HEIGHT parameters that have the actual image size. <http://www.htmlhelp.com/reference/wilbur/special/img.html> has more on inline images.
170
171 - Example text: <br />`TWiki <IMG SRC="http://www.dementia.org/twiki//view/wikiHome.gif" WIDTH=46 HEIGHT=50> logo.`
172 - Example output: <br /> TWiki <img src="http://www.dementia.org/twiki//view/wikiHome.gif" width="46" height="50" /> logo.
173
174 ----
175
176 <a name="colo">Q:</a> **Can I write colored text?**
177
178 Place text you would like to specify a color inside &lt;FONT COLOR="colorCode"&gt; and &lt;/FONT&gt; tags.
179
180 "colorCode" is the hexadecimal RGB color code. The color is composed by specifying the red, green and blue components of the color in hexadecimal notation. For example, to specify white, the red, green and blue components are 255, 255, 255, so you would use "#FFFFFF". Common color codes are:
181
182 <table>
183   <tr bgcolor="#E0E0E0">
184     <td><font color="#000000"> <strong>Black:</strong> </font></td>
185     <td>"#000000" </td>
186     <td><font color="#008000"> <strong>Green:</strong> </font></td>
187     <td>"#008000" </td>
188     <td><font color="#C0C0C0"> <strong>Silver:</strong> </font></td>
189     <td>"#C0C0C0" </td>
190     <td><font color="#00FF00"> <strong>Lime:</strong> </font></td>
191     <td>"#00FF00" </td>
192   </tr>
193   <tr bgcolor="#C0C0C0">
194     <td><font color="#808080"> <strong>Gray:</strong> </font></td>
195     <td>"#808080" </td>
196     <td><font color="#808000"> <strong>Olive:</strong> </font></td>
197     <td>"#808000" </td>
198     <td><font color="#FFFFFF"> <strong>White:</strong> </font></td>
199     <td>"#FFFFFF" </td>
200     <td><font color="#FFFF00"> <strong>Yellow:</strong> </font></td>
201     <td>"#FFFF00" </td>
202   </tr>
203   <tr bgcolor="#E0E0E0">
204     <td><font color="#800000"> <strong>Maroon:</strong> </font></td>
205     <td>"#800000" </td>
206     <td><font color="#000080"> <strong>Navy:</strong> </font></td>
207     <td>"#000080" </td>
208     <td><font color="#FF0000"> <strong>Red:</strong> </font></td>
209     <td>"#FF0000" </td>
210     <td><font color="#0000FF"> <strong>Blue:</strong> </font></td>
211     <td>"#0000FF" </td>
212   </tr>
213   <tr bgcolor="#C0C0C0">
214     <td><font color="#800080"> <strong>Purple:</strong> </font></td>
215     <td>"#800080" </td>
216     <td><font color="#008080"> <strong>Teal:</strong> </font></td>
217     <td>"#008080" </td>
218     <td><font color="#FF00FF"> <strong>Fuchsia:</strong> </font></td>
219     <td>"#FF00FF"</td>
220     <td><font color="#00FFFF"> <strong>Aqua:</strong> </font></td>
221     <td>"#00FFFF" </td>
222   </tr>
223 </table>
224
225 - Example text: <br />` <FONT COLOR="#FF0000"> Red color </FONT> draws attention. `
226 - Example output: <br /><font> Red color </font> draws attention.
227
228 ----
229
230 -- [[PeterThoeny]] - 08 Aug 1999