LaTeX 表格标题中的特殊字符

发布于 2024-07-15 02:11:34 字数 110 浏览 10 评论 0原文

当我在表格的标题文本中包含 \overline{x} 或其他特殊字符时,整个标题文本根本不会显示。 当我输入没有特殊字符的简单文本时,标题效果很好。 如何在标题中包含特殊字符?

When I include \overline{x} or other special characters in the caption text of a table, the whole caption text won't appear at all. When I put simple text without special characters, the caption works fine. How can I include special characters in the caption?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

地狱即天堂 2024-07-22 02:11:34

你把美元放在数学上了吗? IE:

\caption{This is a caption with maths $\overline{x}$ in it.}

Are you putting $ around the maths? I.e.:

\caption{This is a caption with maths $\overline{x}$ in it.}
难忘№最初的完美 2024-07-22 02:11:34

显然,您的真正问题是 TeX 奇特的纠错机制使您无法知道文档中存在语法错误。 早在 1982 年左右,在一个很长的文档上运行 TeX 会花费很多时间,以至于 Knuth 不希望 TeX 在遇到错误时就退出。 相反,TeX 会尝试猜测您的意思并继续排版文档,以便您可以在再次运行之前修复一堆错误; 例如,当它发现数学模式之外的数学模式命令时,它会假设您忘记了美元符号并将其插入。 没有一种自动纠错机制是完美的,因此语法错误常常会导致文本的某些部分丢失或以错误的方式排版。

TeX 确实尝试告诉您它已发现错误,但我认为当前的 IDE 很容易忽略输出。 尝试从命令行在文档上运行 Latex 并注意它的内容。 例如,短文档

\documentclass{article}
\begin{document}
It seems \sqrt{2} I forgot some dollar signs.
\end{document}

会导致 TeX 提示您

! Missing $ inserted.
<inserted text> 
                $
l.3 It seems \sqrt{
                   2} I forgot some dollar signs.
? 

The 2009 way of Handling this is type X 退出,修复源文档,然后再次运行 Latex - 但实际上您可以在提示符处输入其他命令来编辑输入TeX 看到的。 如果你只是输入 Q (安静地运行 - 与指定 \batchmode 相同,Emacs 或你正在使用的任何 IDE 可能会为你做),你会得到一个排版文档,并且实际上可能不明显有语法其中的错误。

Apparently your real problem was that TeX's fancy error correction mechanism prevented you from knowing that there was a syntax error in the document. Back in 1982 or so, running TeX on a long document would take so much time that Knuth didn't want TeX to just quit when it ran into an error. Instead, TeX tries to guess what you meant and go on typesetting the document, so that you can fix a bunch of errors before you run it again; for example, when it spots a math-mode command outside math mode, it assumes that you forgot a dollar sign and inserts it. No automatic error-correction mechanism is perfect, so syntax errors often cause some part of text to be lost, or typeset in a wrong way.

TeX does try to tell you that it has found errors, but I suppose current IDEs make it easy to ignore the output. Try running latex on the document from the command line and pay attention to what it says. For example, the short document

\documentclass{article}
\begin{document}
It seems \sqrt{2} I forgot some dollar signs.
\end{document}

causes TeX to prompt you with

! Missing $ inserted.
<inserted text> 
                $
l.3 It seems \sqrt{
                   2} I forgot some dollar signs.
? 

The 2009 way of dealing with this is to type X to quit, fix the source document, and run latex again - but you can actually enter other commands at the prompt to edit the input that TeX sees. If you just type Q (to run quietly - same as specifying \batchmode, which Emacs or whatever IDE you are using probably does for you) you get a typeset document as a result, and it might not be obvious that there are in fact syntax errors in it.

故事和酒 2024-07-22 02:11:34

如果您正在寻找如何在表格中的 Latex 中插入任何特殊字符,那么这可能会对您有所帮助。 看一下这个...

\documentclass{article}
\begin{document}
\begin{tabular}{|l|r|r|}
Item & Quality & Price(\$)\\
Nails & 500 &  34\\
Wooden boards & 100 & 4\\
Bricks & 240 & 11\\
\end{tabular}
\end{document}

If you looking for how to insert any special character in Latex in a table then this may help you. Check this out...

\documentclass{article}
\begin{document}
\begin{tabular}{|l|r|r|}
Item & Quality & Price(\$)\\
Nails & 500 &  34\\
Wooden boards & 100 & 4\\
Bricks & 240 & 11\\
\end{tabular}
\end{document}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文