31

我有一些 xml 文本要作为纯文本插入到文档中。我直接插入,但它给出了奇怪的符号。我怎样才能避免这种情况?

我要添加的 XML:

\begin{tabular}{|c|}

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


\end{tabular}

输出如下:

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

基本上我想在表格中添加 HTML 代码。我怎样才能做到这一点?

4

1 回答 1

53

你试过verbatim环境吗?

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

在不知道您的“奇怪符号”是什么的情况下,很难为您的问题提出解决方案。


更新:为了verbatim在表格单元格中嵌入环境,您需要将列更改为段落列(使用pmb作为列说明符);例如

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

有关更多信息,请参阅Wikibooks

于 2013-01-07T20:14:41.197 回答