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: | ||
+ | = Formatting in LaTeX = | ||
+ | |||
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 | + | 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 7: | Line 9: | ||
For references, use <code>\ref</code> tag with a unique label. | For references, use <code>\ref</code> tag with a unique label. | ||
- | + | = Using LaTeX formatting commands = | |
- | + | == Using list of tables == | |
- | Use <code>\listoftables</code> to create a list of tables automatically. Used for PDF documents to get a more book | + | 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 == | |
Use <code>\listoffigures</code> to create a list of figures automatically. Used for PDF documents to get a more book like result. | Use <code>\listoffigures</code> to create a list of figures automatically. Used for PDF documents to get a more book like result. | ||
- | + | == Using LaTeX special characters == | |
LaTeX has special characters <code>_$#%{}^~{}</code> that need to be handled in text with a special marking like <code>\_</code>, <code>\$</code>, <code>\#</code>, <code>\%</code>, <code>\{</code>, <code>\}</code>, <code>\^</code> and <code>\~{}</code>. | LaTeX has special characters <code>_$#%{}^~{}</code> that need to be handled in text with a special marking like <code>\_</code>, <code>\$</code>, <code>\#</code>, <code>\%</code>, <code>\{</code>, <code>\}</code>, <code>\^</code> and <code>\~{}</code>. | ||
- | + | == Using highlight for example code == | |
Use <code>\textraw{Example text}</code> or <code>\verb|Example text|</code> to highlight command line examples, function names, and file names in base text. The difference between these two is that <code>\textraw</code> allows normal LaTeX commands inside text will be ignored and handled as plain text. | Use <code>\textraw{Example text}</code> or <code>\verb|Example text|</code> to highlight command line examples, function names, and file names in base text. The difference between these two is that <code>\textraw</code> allows normal LaTeX commands inside text will be ignored and handled as plain text. | ||
Line 27: | Line 29: | ||
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. | ||
- | { | + | {| |
+ | |- | ||
+ | | [[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 40: | Line 46: | ||
* File <code>~/folder/example_file.txt</code>. | * File <code>~/folder/example_file.txt</code>. | ||
- | + | == Using highlight for important words == | |
Use ''Italics'' for other than command line examples and function or file names. | Use ''Italics'' for other than command line examples and function or file names. | ||
Line 49: | Line 55: | ||
* This is ''important example text''. | * This is ''important example text''. | ||
- | + | == Using highlight for user interface component names == | |
Use '''Bold''' for UI element names in text. UI element name in text is the same as UI element caption in UI. | Use '''Bold''' for UI element names in text. UI element name in text is the same as UI element caption in UI. | ||
Line 58: | Line 64: | ||
* This is '''UI Element Caption'''. | * This is '''UI Element Caption'''. | ||
- | + | == Using normal headings == | |
Use the chapter tag for level 0 chapters (a) together with a unique label. Use the section (for a.b), subsection (for a.b.c) or subsubsection (for a.b.c.d) tag together with unique label for other headings. | Use the chapter tag for level 0 chapters (a) together with a unique label. Use the section (for a.b), subsection (for a.b.c) or subsubsection (for a.b.c.d) tag together with unique label for other headings. | ||
Line 80: | Line 86: | ||
<code> \label{sec:example-chapter-title-example-subsubsection-title}</code> | <code> \label{sec:example-chapter-title-example-subsubsection-title}</code> | ||
- | + | == Using level 4 headings == | |
Use '''Bold''' without a label for level 4 (a.b.c.d.e) headings. This way, level 4 titles are not numbered or included in the table of contents. | Use '''Bold''' without a label for level 4 (a.b.c.d.e) headings. This way, level 4 titles are not numbered or included in the table of contents. | ||
Line 89: | Line 95: | ||
* '''Example level 4 title''' | * '''Example level 4 title''' | ||
- | + | == Using command line and screen output examples == | |
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. | ||
- | { | + | {| |
+ | |- | ||
+ | | [[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 110: | Line 120: | ||
Third line has underscore (character '_') and dollar sign (character '$') | Third line has underscore (character '_') and dollar sign (character '$') | ||
- | + | == Using notes == | |
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. | ||
- | { | + | {| |
+ | |- | ||
+ | | [[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 140: | ||
<code>\end{notebox}</code> | <code>\end{notebox}</code> | ||
- | { | + | {| |
+ | |- | ||
+ | | [[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 == | |
Use <code>\lstset</code> and <code>\lstinputlisting</code> for listing source code for C/C++, CSS, HTML, Java, JavaScript, Latex, Pascal, Perl, PHP, Postscript, Python, Ruby, SQL, Tcl, Properties files, Makefile, XML, Log files, Ini files and Shell scripts. | Use <code>\lstset</code> and <code>\lstinputlisting</code> for listing source code for C/C++, CSS, HTML, Java, JavaScript, Latex, Pascal, Perl, PHP, Postscript, Python, Ruby, SQL, Tcl, Properties files, Makefile, XML, Log files, Ini files and Shell scripts. | ||
Line 137: | Line 155: | ||
<code>\lstinputlisting{chapters/DocumentationGuidelines/snippets/example_source.c}</code> | <code>\lstinputlisting{chapters/DocumentationGuidelines/snippets/example_source.c}</code> | ||
- | < | + | <code><nowiki> |
- | /* | + | /* |
- | * example_source.c, an example source code for kernel module | + | * example_source.c, an example source code for kernel module |
- | * | + | * |
- | * Copyright (C) 2010 Nokia Corporation. All rights reserved. | + | * Copyright (C) 2010 Nokia Corporation. All rights reserved. |
- | * | + | * |
- | * This maemo code example is licensed under a MIT-style license, | + | * This maemo code example is licensed under a MIT-style license, |
- | * that can be found in the file called "COPYING". | + | * that can be found in the file called "COPYING". |
- | * | + | * |
- | */ | + | */ |
- | #include | + | #include <linux/module.h> /* needed by all kernel modules */ |
- | #include | + | #include <linux/init.h> /* needed for custom init/exit functions */ |
- | #include | + | #include <linux/kernel.h> /* needed for KERN_ALERT macro */ |
- | /* Special macro to indicate license (to avoid tainting the kernel) */ | + | /* Special macro to indicate license (to avoid tainting the kernel) */ |
- | MODULE_LICENSE("Dual MIT/GPL"); | + | MODULE_LICENSE("Dual MIT/GPL"); |
- | static int hello_init(void) { | + | static int hello_init(void) { |
- | printk(KERN_ALERT "Hello, world\n"); /* top priority message */ | + | printk(KERN_ALERT "Hello, world\n"); /* top priority message */ |
- | return 0; | + | return 0; |
- | } | + | } |
- | static void hello_exit(void) | + | static void hello_exit(void) |
- | { | + | { |
- | printk(KERN_INFO "Goodbye, world\n"); | + | printk(KERN_INFO "Goodbye, world\n"); |
- | } | + | } |
- | /* macros to mark modules init/exit funcs (run on insmod/rmmod) */ | + | /* macros to mark modules init/exit funcs (run on insmod/rmmod) */ |
- | module_init(hello_init); | + | module_init(hello_init); |
- | module_exit(hello_exit); | + | module_exit(hello_exit); |
- | </ | + | </nowiki></code> |
- | + | == Using figures == | |
- | Use <code>\includegraphics</code> for figures without a file name extension. For example, | + | 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>. | ||
- | { | + | {| |
+ | |- | ||
+ | | [[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 211: | ||
<code>\end{figure}</code> | <code>\end{figure}</code> | ||
- | |||
- | |||
- | |||
- | === Combining small tables and figures | + | |
+ | {| summary="Example picture" | ||
+ | |+ align="BOTTOM" |'''Figure 4.1:''' Example picture | ||
+ | |- | ||
+ | | | ||
+ | [[Image:LaTeX_logo.png|Image LaTeX_logo]] | ||
+ | |} | ||
+ | |||
+ | |||
+ | |||
+ | == Combining small tables and figures == | ||
You can arrange small tables and figures side-by-side within the page width limitation. | You can arrange small tables and figures side-by-side within the page width limitation. | ||
Line 200: | Line 228: | ||
The following figure environment arranges two small figures side-by-side and creates individual captions for each figure and one common caption for the whole figure environment. | The following figure environment arranges two small figures side-by-side and creates individual captions for each figure and one common caption for the whole figure environment. | ||
- | < | + | <code>\begin{figure}[H]</code> |
- | \begin{figure}[H] | + | <code> \caption{Example logos}</code> |
- | \caption{Example logos} | + | <code> \label{fig:example-chapter-title-example-logos}</code> |
- | \label{fig:example-chapter-title-example-logos} | + | <code> \centering</code> |
- | \centering | + | <code> \subfloat[ESbox]{</code> |
- | \subfloat[ESbox]{ | + | <code> \includegraphics{chapters/DocumentationGuidelines/images/esbox_logo}</code> |
- | \includegraphics{chapters/DocumentationGuidelines/images/esbox_logo} | + | <code> }</code> |
- | } | + | <code> \subfloat[PluThon]{</code> |
- | \subfloat[PluThon]{ | + | <code> \includegraphics{chapters/DocumentationGuidelines/images/pluthon_logo}</code> |
- | \includegraphics{chapters/DocumentationGuidelines/images/pluthon_logo} | + | <code> }</code> |
- | } | + | <code>\end{figure}</code> |
- | \end{figure} | + | |
- | </ | + | |
{| summary="Example logos" | {| summary="Example logos" | ||
Line 221: | Line 249: | ||
|} | |} | ||
- | + | ||
+ | |||
+ | == Referring to a section == | ||
Use a standard reference <code>\ref</code> to refer to a section in base text. Use a unique label in a reference and refer only to sections inside the same level 1 section (a.b). | Use a standard reference <code>\ref</code> to refer to a section in base text. Use a unique label in a reference and refer only to sections inside the same level 1 section (a.b). | ||
Line 236: | Line 266: | ||
* For more information on example topic, see chapter [[#Using LaTeX formatting commands]]. | * For more information on example topic, see chapter [[#Using LaTeX formatting commands]]. | ||
- | + | == Referring to a figure == | |
Use standard reference <code>\ref</code> to refer to a figure in base text. Use a unique label in a reference and refer only to sections inside the same level 1 section (a.b). | Use standard reference <code>\ref</code> to refer to a figure in base text. Use a unique label in a reference and refer only to sections inside the same level 1 section (a.b). | ||
Line 243: | Line 273: | ||
* 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 [[# | + | * For more information on example topic, see figure [[#fig:formatting-in-latex-example-picture|4.1]]. |
- | + | == Referring to a table == | |
Use standard reference <code>\ref</code> to refer to a table in base text. Use a unique label in a reference and refer only to sections inside same level 1 section (a.b). | Use standard reference <code>\ref</code> to refer to a table in base text. Use a unique label in a reference and refer only to sections inside same level 1 section (a.b). | ||
Line 254: | Line 284: | ||
* For more information on example topic, see table 4.1. | * For more information on example topic, see table 4.1. | ||
- | + | == Using HTML links == | |
Use <code>\htmladdnormallink</code> for external references that are not included in the Maemo bibliography database. Notice that link text is normal LaTeX text and characters <code>_$#%{}^~</code> need to be handled with special marking but URL can be any normal HTTP link. | Use <code>\htmladdnormallink</code> for external references that are not included in the Maemo bibliography database. Notice that link text is normal LaTeX text and characters <code>_$#%{}^~</code> need to be handled with special marking but URL can be any normal HTTP link. | ||
Line 263: | Line 293: | ||
* For more information on example topic, see [http://www.maemo.org maemo.org]. | * For more information on example topic, see [http://www.maemo.org maemo.org]. | ||
- | + | == Using Maemo bibliography database == | |
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 | + | 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 273: | Line 303: | ||
* For more information on example topic, see document <code>\textit{Maemo Documentation Guidelines}</code><code>~\cite{bibliography-key}</code>. | * For more information on example topic, see document <code>\textit{Maemo Documentation Guidelines}</code><code>~\cite{bibliography-key}</code>. | ||
* 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'' [[ | + | * For more information on example topic, see document ''Maemo Documentation Guidelines'' [[/node7.html#maemo-documentation-guidelines 4], Formatting in LaTex]. |
- | + | == Using normal tables == | |
Use <code>\tabular</code> and <code>\table</code> to create tables. For example to create a table with two half-page-wide columns that can expand to new lines, use the following definition: | Use <code>\tabular</code> and <code>\table</code> to create tables. For example to create a table with two half-page-wide columns that can expand to new lines, use the following definition: | ||
- | < | + | <code>\begin{tabular}<nowiki> |
- | \begin{tabular}{|p\{0.5\textwidth}|p{0.5\textwidth}|} | + | {|p\</nowiki>{0.5\textwidth}<nowiki>|p</nowiki>{0.5\textwidth}<nowiki>|}</nowiki></code>. |
- | </ | + | |
- | 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> |
- | < | + | <code>\begin{tabular*}{\textwidth}<nowiki> |
- | \begin{tabular*}{\textwidth}{|c|p{0.5\textwidth}|} | + | {|c|p</nowiki>{0.5\textwidth}<nowiki>|}</nowiki></code>. |
- | </ | + | |
- | 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>. |
Use option <code>[H]</code> for table environment if LaTeX cannot change the position of the table related to base text: <code>\begin{table}[H]</code>. | Use option <code>[H]</code> for table environment if LaTeX cannot change the position of the table related to base text: <code>\begin{table}[H]</code>. | ||
Line 301: | Line 330: | ||
For example: | For example: | ||
- | < | + | <code>\begin{table}[H]</code> |
- | \begin{table}[H] | + | <code> \caption{Example normal table}</code> |
- | \caption{Example normal table} | + | <code> \label{tab:example-chapter-title-example-table}</code> |
- | \label{tab:example-chapter-title-example-table} | + | <code> \centering</code> |
- | \centering | + | <code> \begin{tabular}<nowiki> |
- | \begin{tabular}{|p{0.45\textwidth}|p{0.45\textwidth}|} | + | {|p</nowiki>{0.45\textwidth}<nowiki>|p</nowiki>{0.45\textwidth}<nowiki>|}</nowiki></code> |
- | \hline\hline | + | <code> \hline\hline</code> |
- | \textbf{Column 1} & \textbf{Column 2} \\ | + | <code> \textbf{Column 1} & \textbf{Column 2} \\</code> |
- | \hline | + | <code> \hline</code> |
- | % Table data starts from here | + | <code> % Table data starts from here</code> |
- | % | + | <code> %</code> |
- | 1 & 2 \\ \hline | + | <code> 1 & 2 \\ \hline</code> |
- | 3 & 4 \\ \hline | + | <code> 3 & 4 \\ \hline</code> |
- | 5 & 6 \\ \hline | + | <code> 5 & 6 \\ \hline</code> |
- | \hline | + | <code> \hline</code> |
- | \end{tabular} | + | <code> \end{tabular}</code> |
- | \end{table} | + | <code>\end{table}</code> |
- | </ | + | |
- | {| | + | |
- | |+ Table 4.1: Example normal table | + | |
+ | |||
+ | |||
+ | {| border="1" cellpadding="3" | ||
+ | |+ '''Table 4.1:''' Example normal table | ||
|- | |- | ||
- | ! Column 1 | + | ! width="225" align="LEFT" valign="TOP" | '''Column 1''' |
- | ! Column 2 | + | ! width="225" align="LEFT" valign="TOP" | '''Column 2''' |
|- | |- | ||
- | | 1 | + | | width="225" align="LEFT" valign="TOP" | 1 |
- | | 2 | + | | width="225" align="LEFT" valign="TOP" | 2 |
|- | |- | ||
- | | 3 | + | | width="225" align="LEFT" valign="TOP" | 3 |
- | | 4 | + | | width="225" align="LEFT" valign="TOP" | 4 |
|- | |- | ||
- | | 5 | + | | width="225" align="LEFT" valign="TOP" | 5 |
- | | 6 | + | | width="225" align="LEFT" valign="TOP" | 6 |
|} | |} | ||
- | + | ||
+ | |||
+ | == Using multi-column table rows == | ||
Use <code>\multicolumn</code> to widen a table row to cover multiple columns. Avoid using multi-column cells for other purposes than creating subheadings for the table. If complex tables are needed create them outside LaTeX as images. | Use <code>\multicolumn</code> to widen a table row to cover multiple columns. Avoid using multi-column cells for other purposes than creating subheadings for the table. If complex tables are needed create them outside LaTeX as images. | ||
Line 342: | Line 376: | ||
For example: | For example: | ||
- | + | <code>\multicolumn{2}<nowiki> | |
- | <code>\multicolumn{2}{|l|}{\textbf{\textit{Table SubHeader}}} \\ \hline | + | {|l|}</nowiki>{\textbf{\textit{Table SubHeader}}} \\ \hline</code> |
- | </ | + | |
- | {| | + | |
- | |+ Table 4.2: Example multicolumn table | + | |
+ | |||
+ | |||
+ | {| border="1" cellpadding="3" | ||
+ | |+ '''Table 4.2:''' Example multicolumn table | ||
|- | |- | ||
- | ! Column 1 | + | ! width="225" align="LEFT" valign="TOP" | '''Column 1''' |
- | ! Column 2 | + | ! width="225" align="LEFT" valign="TOP" | '''Column 2''' |
|- | |- | ||
- | | colspan="2" align=" | + | | colspan="2" align="LEFT" | <span>'''''SubHeader Left'''''</span> |
|- | |- | ||
- | | 1 | + | | width="225" align="LEFT" valign="TOP" | 1 |
- | | 2 | + | | width="225" align="LEFT" valign="TOP" | 2 |
|- | |- | ||
- | | colspan="2" align=" | + | | colspan="2" align="CENTER" | <span>'''''SubHeader Center'''''</span> |
|- | |- | ||
- | | 3 | + | | width="225" align="LEFT" valign="TOP" | 3 |
- | | 4 | + | | width="225" align="LEFT" valign="TOP" | 4 |
|- | |- | ||
- | | colspan="2" align=" | + | | colspan="2" align="RIGHT" | <span>'''''SubHeader Right'''''</span> |
|- | |- | ||
- | | 5 | + | | width="225" align="LEFT" valign="TOP" | 5 |
- | | 6 | + | | width="225" align="LEFT" valign="TOP" | 6 |
|} | |} | ||
- | + | ||
+ | |||
+ | == Using long tables == | ||
Use <code>{center}</code> and <code>{longtable}</code> environments to create tables that require multiple pages. For example, to create a table with two half-page-wide columns that can expand to new lines, use the following definition: | Use <code>{center}</code> and <code>{longtable}</code> environments to create tables that require multiple pages. For example, to create a table with two half-page-wide columns that can expand to new lines, use the following definition: | ||
- | < | + | <code>\begin{longtable}<nowiki> |
- | \begin{longtable}{|p{0.45\textwidth}|p{0.45\textwidth}|} | + | {|p</nowiki>{0.45\textwidth}<nowiki>|p</nowiki>{0.45\textwidth}<nowiki>|}</nowiki></code>. |
- | </ | + | |
- | To reduce column width use <code>@{}</code>: | + | To reduce column width use <code>@{}</code><nowiki>: </nowiki><code>\begin{longtable}<nowiki> |
- | < | + | {|@</nowiki>{}c@{}<nowiki>|c|}</nowiki></code>. |
- | \begin{longtable}{|@{}c@{}|c|} | + | |
- | </ | + | |
- | 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>. |
All tables must be centered and have both a caption and a label. | All tables must be centered and have both a caption and a label. | ||
Line 387: | Line 423: | ||
For example: | For example: | ||
- | < | + | <code>\begin{center}</code> |
- | \begin{center} | + | <code> \begin{longtable}<nowiki> |
- | \begin{longtable} | + | {|p</nowiki>{0.45\textwidth}<nowiki>|p</nowiki>{0.45\textwidth}<nowiki>|}</nowiki></code> |
- | {|p{0.45\textwidth}|p{0.45\textwidth}|} | + | <code> \caption{Example long table}</code> |
- | \caption{Example long table} | + | <code> \label{tab:example-chapter-title-example-long-table}</code> |
- | \label{tab:example-chapter-title-example-long-table} | + | <code> % FirstHead</code> |
- | % FirstHead | + | <code> \hline\hline</code> |
- | \hline\hline | + | <code> \textbf{Column 1} & \textbf{Column 2} \\ \hline</code> |
- | \textbf{Column 1} & \textbf{Column 2} \\ \hline | + | <code> \endfirsthead</code> |
- | \endfirsthead | + | <code> % Head</code> |
- | % Head | + | <code> \hline\hline</code> |
- | \hline\hline | + | <code> \multicolumn{2}<nowiki> |
- | \multicolumn{2}{|l|}{\small\tablename \thetable{} | + | {|l|}</nowiki>{\small\tablename \thetable{} </code> |
- | Continued from previous page} \\ | + | <code> Continued from previous page} \\</code> |
- | \hline\hline | + | <code> \hline\hline</code> |
- | \textbf{Column } & \textbf{Column 2} \\ \hline | + | <code> \textbf{Column } & \textbf{Column 2} \\ \hline</code> |
- | \endhead | + | <code> \endhead</code> |
- | % Foot | + | <code> % Foot</code> |
- | \multicolumn{2}{|r|}{\small\tablename \thetable{} | + | <code> \multicolumn{2}<nowiki> |
- | Continued to next page} \\ | + | {|r|}</nowiki>{\small\tablename \thetable{} </code> |
- | \hline | + | <code> Continued to next page} \\</code> |
- | \endfoot | + | <code> \hline</code> |
- | % LastFoot | + | <code> \endfoot</code> |
- | \hline\hline | + | <code> % LastFoot</code> |
- | \endlastfoot | + | <code> \hline\hline</code> |
- | % Table data starts from here | + | <code> \endlastfoot</code> |
- | % | + | <code> % Table data starts from here</code> |
- | 1 & 2 \\ \hline | + | <code> %</code> |
- | 3 & 4 \\ \hline | + | <code> 1 & 2 \\ \hline</code> |
- | 5 & 6 \\ \hline | + | <code> 3 & 4 \\ \hline</code> |
- | ... & ... \\ \hline | + | <code> 5 & 6 \\ \hline</code> |
- | \end{longtable} | + | <code> ... & ... \\ \hline</code> |
- | \end{center} | + | <code> \end{longtable}</code> |
- | </ | + | <code>\end{center}</code> |
+ | |||
- | {| | + | {| border="1" cellpadding="3" |
- | |+ Table 4.3: Example long table | + | |+ '''Table 4.3:''' Example long table |
|- | |- | ||
- | + | | width="225" align="LEFT" valign="TOP" | '''Column 1''' | |
- | ! Column 2 | + | ! width="225" align="LEFT" valign="TOP" | '''Column 2''' |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | |
- | | | + | | width="225" align="LEFT" valign="TOP" | |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 1 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 2 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 3 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 4 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 5 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 6 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 7 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 8 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 9 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 0 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 1 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 2 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 3 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 4 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 5 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 6 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 7 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 8 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 9 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 0 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 1 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 2 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 3 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 4 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 5 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 6 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 7 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 8 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 9 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 0 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 1 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 2 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 3 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 4 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 5 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 6 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 7 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 8 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 9 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 0 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 1 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 2 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 3 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 4 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 5 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 6 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 7 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 8 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 9 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 0 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 1 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 2 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 3 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 4 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 5 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 6 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 7 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 8 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 9 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 0 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 1 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 2 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 3 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 4 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 5 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 6 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 7 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 8 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 9 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 0 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 1 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 2 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 3 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 4 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 5 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 6 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 7 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 8 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 9 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 0 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 1 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 2 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 3 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 4 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 5 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 6 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 7 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 8 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 9 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 0 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 1 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 2 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 3 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 4 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 5 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 6 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 7 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 8 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 9 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 0 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 1 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 2 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 3 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 4 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 5 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 6 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 7 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 8 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 9 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 0 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 1 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 2 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 3 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 4 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 5 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 6 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 7 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 8 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 9 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 0 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 1 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 2 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 3 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 4 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 5 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 6 |
|- | |- | ||
- | | | + | | width="225" align="LEFT" valign="TOP" | 7 |
- | | | + | | width="225" align="LEFT" valign="TOP" | 8 |
|- | |- | ||
- | | ... | + | | width="225" align="LEFT" valign="TOP" | 9 |
- | | ... | + | | width="225" align="LEFT" valign="TOP" | 0 |
+ | |- | ||
+ | | width="225" align="LEFT" valign="TOP" | ... | ||
+ | | width="225" align="LEFT" valign="TOP" | ... | ||
+ | |- | ||
+ | | width="225" align="LEFT" valign="TOP" | | ||
+ | | width="225" align="LEFT" valign="TOP" | | ||
|} | |} | ||
- | + | ||
+ | |||
+ | == Reducing the size of tables and figures == | ||
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. | ||
- | { | + | {| |
+ | |- | ||
+ | | [[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 640: | Line 689: | ||
* scale down the figure | * scale down the figure | ||
- | + | === Reduce the size of the table === | |
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: | ||
- | < | + | <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 === | |
- | To fit on the page, figures in Maemo documents are recommended to have maximum size of 600 | + | 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 < | + | 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. |
- | { | + | {| |
+ | |- | ||
+ | | [[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 | + | 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. | ||
- | $ ./maemodoc-scaleimage | + | $ ./maemodoc-scaleimage <image_file> -outpath <output directory> |
The following command rotates the figure 90 degrees anticlockwise if doing so reduces the amount of scaling needed. The command scales down the figure to the recommended maximum width and height only if the figure after rotation still does not fit on the page. | The following command rotates the figure 90 degrees anticlockwise if doing so reduces the amount of scaling needed. The command scales down the figure to the recommended maximum width and height only if the figure after rotation still does not fit on the page. | ||
- | $ ./maemodoc-scaleimage | + | $ ./maemodoc-scaleimage <image_file> -outpath <output directory> -rotate |
- | |||
+ | |||
+ | == References == | ||
<references /> | <references /> | ||
[[Category:Documentation]] | [[Category:Documentation]] |
Learn more about Contributing to the wiki.