35

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?

SwiftMango
  • 15,092
  • 13
  • 71
  • 136
  • What do you mean by "weird symbols"? – Will Vousden Jan 07 '13 at 20:13
  • You can fix this with a different encoding. See [Why do the less than symbol (`<`) and the greater than symbol (`>`) appear wrong as upside down exclamation or question mark?](http://tex.stackexchange.com/q/2369/5764) – Werner Jan 07 '13 at 21:07

1 Answers1

56

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.

Will Vousden
  • 32,488
  • 9
  • 84
  • 95
  • I tried to add the begin verbatim in the tabular but it does not compile – SwiftMango Jan 07 '13 at 20:21
  • @texasbruce ...so what error message does it fail with? – Will Vousden Jan 07 '13 at 20:27
  • `! LaTeX Error: Something's wrong--perhaps a missing \item. See the LaTeX manual or LaTeX Companion for explanation. Type H for immediate help. ... l.186 \begin{verbatim} Try typing to proceed. If that doesn't work, type X to quit.` – SwiftMango Jan 07 '13 at 20:29