Editing Documentation/Maemo Documentation Guidelines/Formatting in LaTeX

Warning: You are not logged in. Your IP address will be recorded in this page's edit history.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 1: Line 1:
This chapter includes information about how to format Maemo documentation text in LaTeX environment.
This chapter includes information about how to format Maemo documentation text in LaTeX environment.
-
Basic instructions on how to use LaTeX can be found here in the [[wikibooks:LaTeX|LaTeX Wikibook]]
+
Basic instructions on how to use LaTeX can be found here: [http://en.wikibooks.org/wiki/LaTeX/ WikiBooks LaTex].
To be able to create a reference to a specific element in a document, you must label that element with the unique LaTeX special characters and especially spaces in the label name. Position <code>\label</code> tag on the next row after the referenced element tag (like <code>\section</code>).
To be able to create a reference to a specific element in a document, you must label that element with the unique LaTeX special characters and especially spaces in the label name. Position <code>\label</code> tag on the next row after the referenced element tag (like <code>\section</code>).
Line 11: Line 11:
=== Using list of tables ===
=== Using list of tables ===
-
Use <code>\listoftables</code> to create a list of tables automatically. Used for PDF documents to get a more book-like result.
+
Use <code>\listoftables</code> to create a list of tables automatically. Used for PDF documents to get a more book like result.
=== Using list of figures ===
=== Using list of figures ===
Line 27: Line 27:
Both <code>\textraw</code> and <code>\verb</code> will display given text in an appropriate fixed-width font.
Both <code>\textraw</code> and <code>\verb</code> will display given text in an appropriate fixed-width font.
-
{{ambox|text=<code>\textraw</code> is a Maemo-specific definition and is usable only in the Maemo environment.}}
+
{|
 +
|-
 +
| [[Image:dialog-information.png]]
 +
| '''Note:'''  <code>\textraw</code> is a Maemo-specific definition and is usable only in the Maemo environment.
 +
|}
For example:
For example:
Line 93: Line 97:
Use <code>{graybox}</code> environment for command line and screen output examples that require more than one row.
Use <code>{graybox}</code> environment for command line and screen output examples that require more than one row.
-
{{ambox|text=<code>{graybox}</code> is a Maemo-specific definition and is usable only in the Maemo environment.}}
+
{|
 +
|-
 +
| [[Image:dialog-information.png]]
 +
| '''Note:'''  <code>{graybox}</code> is a Maemo-specific definition and is usable only in the Maemo environment.
 +
|}
Explicit new lines (<code>\\</code>) need to be given inside <code>{graybox}</code> environment to separate different rows. LaTeX special characters (<code>_$#%{}^~{}</code>) need to be handled in text with special marking unless they are used inside <code>\verb</code> command.
Explicit new lines (<code>\\</code>) need to be given inside <code>{graybox}</code> environment to separate different rows. LaTeX special characters (<code>_$#%{}^~{}</code>) need to be handled in text with special marking unless they are used inside <code>\verb</code> command.
Line 114: Line 122:
Use <code>{notebox}</code> environment for notes that require whole sentence or paragraph to be highlighted.
Use <code>{notebox}</code> environment for notes that require whole sentence or paragraph to be highlighted.
-
{{ambox|text=<code>{notebox}</code> is a Maemo-specific definition and is usable only in the Maemo environment.}}
+
{|
 +
|-
 +
| [[Image:dialog-information.png]]
 +
| '''Note:'''  <code>{notebox}</code> is a Maemo-specific definition and is usable only in the Maemo environment.
 +
|}
Explicit new lines (<code>\\</code>) need to be given inside <code>{notebox}</code> environment to separate different rows. LaTeX special characters (<code>_$#%{}^~{}</code>) need to be handled in text with special marking unless they are used inside <code>\verb</code> command.
Explicit new lines (<code>\\</code>) need to be given inside <code>{notebox}</code> environment to separate different rows. LaTeX special characters (<code>_$#%{}^~{}</code>) need to be handled in text with special marking unless they are used inside <code>\verb</code> command.
Line 126: Line 138:
   <code>\end{notebox}</code>
   <code>\end{notebox}</code>
-
{{ambox|text=This is note text inside a yellow box<br/><span><font face="monospace">Second line in TextRaw</font></span><br/>Third line has underscore (character '_') and dollar sign (character '$')
+
{|
 +
|-
 +
| [[Image:dialog-information.png]]
 +
| '''Note:'''  This is note text inside a yellow box <br> <span><font face="monospace">Second line in TextRaw</font></span> <br>Third line has underscore (character '_') and dollar sign (character '$')
 +
|}
=== Using code listings ===
=== Using code listings ===
Line 172: Line 188:
=== Using figures ===
=== Using figures ===
-
Use <code>\includegraphics</code> for figures without a file name extension. For example, use <code>image_file_name</code> instead of <code>image_file_name.png</code>.
+
Use <code>\includegraphics</code> for figures without a file name extension. For example, <span><font face="monospace">use image_file_name</font></span> instead of <span><font face="monospace">image_file_name.png</font></span>.
Use option <code>[H]</code> for figure environment if the position of the figure related to base text cannot be changed by LaTeX . For example <code>\begin{figure}[H]</code>.
Use option <code>[H]</code> for figure environment if the position of the figure related to base text cannot be changed by LaTeX . For example <code>\begin{figure}[H]</code>.
-
{{ambox|text=Use <code>maemodoc-scaleimage</code> command line tool to scale down figure files that are bigger than recommended maximum size of 600 × 1200 (width × height) pixels. Use option <code>[width=\textwidth]</code> when including figures in LaTeX that are wider than 340 pixels.
+
{|
 +
|-
 +
| [[Image:dialog-information.png]]
 +
| '''Note:'''  Use <span><font face="monospace">maemodoc-scaleimage</font></span> command line tool to scale down figure files that are bigger than recommended maximum size of 600 x 1200 (width x height) pixels. Use option <code>[width=\textwidth]</code> when including figures in LaTeX that are wider than 340 pixels.
|}
|}
Line 190: Line 209:
   <code>\end{figure}</code>
   <code>\end{figure}</code>
-
<div id="figure-example_picture">
+
{| summary="Example picture"
-
[[Image:LaTeX_logo.png|frame|center|alt=LaTeX logo|'''Figure 4.1:''' Example picture]]
+
|+ align="BOTTOM" |'''Figure 4.1:''' Example picture
-
</div>
+
|-
 +
|
 +
[[Image:LaTeX_logo.png|Image LaTeX_logo]]
 +
|}
=== Combining small tables and figures ===
=== Combining small tables and figures ===
Line 243: Line 265:
* For more information on example topic, see figure <code>\ref{fig:example-chapter-title-example-picture}</code>.
* For more information on example topic, see figure <code>\ref{fig:example-chapter-title-example-picture}</code>.
-
* For more information on example topic, see figure [[#figure-formatting-in-latex-example-picture|4.1]].
+
* For more information on example topic, see figure [[#fig:formatting-in-latex-example-picture|4.1]].
=== Referring to a table ===
=== Referring to a table ===
Line 267: Line 289:
Use <code>\cite</code> for external references from Bibliography database. All references to external documents that are other than product version specific documents (documents that are not expected to change regularly) must use Maemo bibliography database. Use LaTeX tag <code>\htmladdnormallink</code> for references to product version specific documents.
Use <code>\cite</code> for external references from Bibliography database. All references to external documents that are other than product version specific documents (documents that are not expected to change regularly) must use Maemo bibliography database. Use LaTeX tag <code>\htmladdnormallink</code> for references to product version specific documents.
-
Give document name in ''Italics'' before citation from bibliography database and join document name and citation together with tilde (~). Tilde prevents LaTeX from breaking the row between document name end and citation link.
+
Give document name in ''Italics'' before citation from bibliography database and join document name and citation together with tilde (~). Tilde prevents LaTeX to break row between document name end and citation link.
For example:
For example:
Line 274: Line 296:
* For more information on example topic, see document ''Maemo Documentation Guidelines'' <ref name=r4>Maemo Documentation Guidelines. http://library.maemodocs.nokia.com</ref>.
* For more information on example topic, see document ''Maemo Documentation Guidelines'' <ref name=r4>Maemo Documentation Guidelines. http://library.maemodocs.nokia.com</ref>.
* For more information on example topic, see document <code>\textit{Maemo Documentation Guidelines}</code><code>~\cite[Formatting in LaTex]{bibliography-key}</code>.
* For more information on example topic, see document <code>\textit{Maemo Documentation Guidelines}</code><code>~\cite[Formatting in LaTex]{bibliography-key}</code>.
-
* For more information on example topic, see document ''Maemo Documentation Guidelines'' [[{{PAGENAME}}|Formatting in LaTex]].
+
* For more information on example topic, see document ''Maemo Documentation Guidelines'' [[/node7.html#maemo-documentation-guidelines 4], Formatting in LaTex].
=== Using normal tables ===
=== Using normal tables ===
Line 284: Line 306:
</source>
</source>
-
To set the width for the whole table, use <code>{tabular*}</code> with option <code>\textwidth</code>:
+
To set the width for the whole table, use <code>{tabular*}</code> with option <code>\textwidth</code><nowiki>: </nowiki>
<source lang="latex">
<source lang="latex">
Line 290: Line 312:
</source>
</source>
-
To reduce column width use <code>@{}</code>: <code>\begin{tabular}
+
To reduce column width use <code>@{}</code><nowiki>: </nowiki><code>\begin{tabular}<nowiki>
-
<nowiki>{|@{}c@{}|c|}</nowiki></code>.
+
{|@</nowiki>{}c@{}<nowiki>|c|}</nowiki></code>.
To add horizontal lines between cells, use <code>\hline</code>. To separate cells, use <code>&</code>. To change row, use <code>\\</code>.
To add horizontal lines between cells, use <code>\hline</code>. To separate cells, use <code>&</code>. To change row, use <code>\\</code>.
Line 357: Line 379:
| 2
| 2
|-
|-
-
| colspan="2" align="center" | '''''SubHeader Center'''''
+
| colspan="2" aling="center" | '''''SubHeader Center'''''
|-
|-
| 3
| 3
Line 632: Line 654:
You can reduce the size of tables and figures that do not fit on the page without scaling them down.
You can reduce the size of tables and figures that do not fit on the page without scaling them down.
-
{{ambox|text=Scaling and rotating does not work with tables, and reducing font size does not work with figures.}}
+
{|
 +
|-
 +
| [[Image:dialog-information.png]]
 +
| '''Note:'''  Scaling and rotating does not work with tables, and reducing font size does not work with figures.
 +
|}
If the object is too long or wide, you can:
If the object is too long or wide, you can:
Line 644: Line 670:
To reduce the size of the table use the font size command inside the table environment to reduce the size of the table font. Font size commands in order from biggest to smallest are:
To reduce the size of the table use the font size command inside the table environment to reduce the size of the table font. Font size commands in order from biggest to smallest are:
-
<code>Huge</code>, <code>huge</code>, <code>LARGE</code>, <code>Large</code>, <code>large</code>, <code>normalsize</code>, <code>small</code>, <code>footnotesize</code>, <code>scriptsize</code> and <code>tiny</code>.
+
<span><font face="monospace">Huge</font></span>, <span><font face="monospace">huge</font></span>, <span><font face="monospace">LARGE</font></span>, <span><font face="monospace">Large</font></span>, <span><font face="monospace">large</font></span>, <span><font face="monospace">normalsize</font></span>, <span><font face="monospace">small</font></span>, <span><font face="monospace">footnotesize</font></span>, <span><font face="monospace">scriptsize</font></span> and <span><font face="monospace">tiny</font></span>.
==== Rotate and scale down a figure ====
==== Rotate and scale down a figure ====
-
To fit on the page, figures in Maemo documents are recommended to have maximum size of 600 × 1200 (width × height) pixels. If a figure is bigger than this, it needs to be rotated, scaled down, or both rotated and scaled down before it can be used. Maemo documentation infrastructure provides a command line tool for automatic figure rotation and scaling.
+
To fit on the page, figures in Maemo documents are recommended to have maximum size of 600 x 1200 (width x height) pixels. If a figure is bigger than this, it needs to be rotated, scaled down, or both rotated and scaled down before it can be used. Maemo documentation infrastructure provides a command line tool for automatic figure rotation and scaling.
-
For Maemo documents figures wider than 340 pixels must be scaled down in LaTeX to fit to the default page width used in PDF documents. Figures wider than 600 pixels or higher than 1200 pixels are recommended to be scaled down with <code>maemodoc-scaleimage</code> command line tool for them to be readable also in HTML documents.
+
For Maemo documents figures wider than 340 pixels must be scaled down in LaTeX to fit to the default page width used in PDF documents. Figures wider than 600 pixels or higher than 1200 pixels are recommended to be scaled down with <span><font face="monospace">maemodoc-scaleimage</font></span> command line tool for them to be readable also in HTML documents.
-
{{ambox|text=Use <span><font face="monospace">maemodoc-scaleimage</font></span> command line tool to scale down figure files that are bigger than recommended maximum size of 600 × 1200 (width × height) pixels. Use option <code>[width=\textwidth]</code> when including figures in LaTeX that are wider than 340 pixels.}}
+
{|
 +
|-
 +
| [[Image:dialog-information.png]]
 +
| '''Note:'''  Use <span><font face="monospace">maemodoc-scaleimage</font></span> command line tool to scale down figure files that are bigger than recommended maximum size of 600 x 1200 (width x height) pixels. Use option <code>[width=\textwidth]</code> when including figures in LaTeX that are wider than 340 pixels.
 +
|}
-
Figures which are smaller than 340 × 1200 (width × height) pixels do not need to be scaled down either in LaTeX or with <code>maemodoc-scaleimage</code> tool.
+
Figures which are smaller than 340 x 1200 (width x height) pixels do not need to be scaled down either in LaTeX or with <span><font face="monospace">maemodoc-scaleimage</font></span> tool.
For example, the following command scales a figure down to the recommended maximum width and height.
For example, the following command scales a figure down to the recommended maximum width and height.

Learn more about Contributing to the wiki.


Please note that all contributions to maemo.org wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see maemo.org wiki:Copyrights for details). Do not submit copyrighted work without permission!


Cancel | Editing help (opens in new window)

Templates used on this page: