How to insert plain text?

texasbruce picture texasbruce · Jan 7, 2013 · Viewed 88.3k times · Source

I have some xml text to be inserted in the document as plain text. I directly inserted but it gives weird symbols. How can I avoid that?

XML I want to add:

\begin{tabular}{|c|}

<table>
<tr>
<td> Title and Logo</td>
</tr>
<tr>
<td> left Column </td>
<td> main table </td>
</tr>
</table>


\end{tabular}

And the output is like :

¡table¿ ¡tr¿ ¡td¿ Title and Logo¡/td¿ ¡/tr¿ ¡tr¿ ¡td¿ left Column ¡/td¿ ¡td¿ main table ¡/td¿ ¡/tr¿ ¡/table

Basically I want to add the HTML code in a tabular. How can I do that?

Answer

Will Vousden picture Will Vousden · Jan 7, 2013

Have you tried the verbatim environment?

\begin{verbatim}
  Your text here.
\end{verbatim}

Without knowing what your "weird symbols" are, it's difficult to suggest a solution to your problem.


Update: In order to embed a verbatim environment in a table cell, you need to change the column to a paragraph column (using either p, m, or b as the column specifier); e.g.

\begin{tabular}{|p{10cm}|}
  \begin{verbatim}
    Your text here.
  \end{verbatim}
\end{tabular}

See Wikibooks for more information.