为什么 LaTeX 在进行引用时要另起一行

发布于 2024-08-01 18:31:51 字数 101 浏览 3 评论 0原文

我刚刚创建了一个 LaTeX 文档并使用 pdftex 将其编译为 PDF。 每次我使用 \ref 命令进行引用时,引用都会放在新行上。 为什么会发生这种情况以及如何防止这种情况发生?

I just created a LaTeX document and compile it to a PDF using pdftex. Every time I make a reference using the \ref command, the reference is put on a new line. Why does this happen and how do I prevent this?

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

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

发布评论

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

评论(3

两人的回忆 2024-08-08 18:31:51

您是否有机会在 URL 中使用 \\ 而不是 //? \\ 在 TeX 中用作换行符。

尝试本地化问题:创建一个新文件,以相同的方式初始化 hyperref,不使用其他包,并且包含一些文本和引用。 检查引用是否仍从新行开始。 如果他们这样做,您可以在此处(以及 LaTeX 论坛)展示它; 如果没有,请添加更多报告的前言,直到获得显示问题的文件。

Are you by any chance using \\ in URLs instead of //? \\ is used as a linebreak in TeX.

Try to localize the problem: create a new file which initializes hyperref the same way, uses no other packages, and has some text and a reference. Check if references still start on new lines. If they do, you can show it here (and on LaTeX forums); if not, add more of your report's preamble until you get a file which exhibits the problem.

可爱咩 2024-08-08 18:31:51

你能准备一个最小的例子来证明你的问题吗?

我尝试过:

\documentclass{report}
\usepackage[pdftex,breaklinks=true,bookmarks=true,bookmarksopen= true,pdfpagemode=UseNone,plainpages=false,pdfpagelabels,pdfstartview=FitH,olorlinks=true,citecolor=blue]{hyperref}
\begin{document}
Test \url{http://test.com} \ref{http://someother.com}.
\end{document}

整个输出是 PDF 中的一行。

BTW \ref 用于生成内部文档链接(如“如章节 \ref{chapter:second}... 中所述”)。

Can you prepare a minimum example demonstrating your problem?

I've tried with:

\documentclass{report}
\usepackage[pdftex,breaklinks=true,bookmarks=true,bookmarksopen= true,pdfpagemode=UseNone,plainpages=false,pdfpagelabels,pdfstartview=FitH,olorlinks=true,citecolor=blue]{hyperref}
\begin{document}
Test \url{http://test.com} \ref{http://someother.com}.
\end{document}

And the whole output is a single line in PDF.

BTW \ref is used to produce internal document links (like in "As described in chapter \ref{chapter:second}...").

謌踐踏愛綪 2024-08-08 18:31:51

这是我自己的错,我使用 \par 作为段落符号而不是 \P。 这是我的第一个 LaTeX 文档,所以我忽略了它。 不过还是感谢您的快速回复/解答。

It was my own fault, I used \par for the paragraph sign instead of \P. This is one of my first LaTeX documents, so I overlooked it. Thanks for the quick responses/answers though.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文