nrao nrao
next up previous contents index home.gif
Next: 9.5 Sample Document Preamble Up: 9 Templates Previous: 9.3 Equation Template


9.4 Table Template

A simple $2 \times 2$ table, with caption and label.

\begin{table}
\caption{Caption text}
\label{tbl:example}
\begin{center}
\begin{tabular}{|c|c|}
\hline
\textbf{Column 1}  & \textbf{Column 2} \\
\hline
data[1,1] & data[1,2] \\
data[2,1] & data[2,2] \\
\hline
\end{tabular}
\end{center}
\end{table}

When composing tables in TEX for conversion to HTML, authors must be aware of a small difference between TEX and HTML that LATEX2HTML must mediate. TEX does not delineate row borders unless the user supplies an \hline whereas HTML applies the border information for a Table to every row in the table. TEX also interprets \\ inside the tabular environment format as an unuequivocal start of a new row, equivalent to a <TR> in HTML. When writing a long table entry that may extend over several lines, you cannot therefore use \\ as a line break within a table row, as in TEX because this will be interpreted as a new table row (and separated by a border) in the HTML version.

The workaround for this difference between TEX and HTML treatment of table borders is to use paragraph (p) format for table columns that will contain cells with lengthy text, as in the following example.

\begin{tabular}{|c|p{3in}|}
\hline
\TeX\  &  A publication-quality typesetting program that provides
          complete control of formatting for printed documents, with
          particularly strong capabilities for displaying mathematical
          equations and formulae..\\
\hline
HTML   &  A content markup language developed for document
          display on the World Wide Web, leaving many aspects of
          format control to the reader's web browser settings.
\hline
\end{tabular}


next up previous contents index home.gif
Next: 9.5 Sample Document Preamble Up: 9 Templates Previous: 9.3 Equation Template


Home | Contact Us | Directories | Site Map | Help | Search


2001-06-08