我正在准备我的论文,在很多地方我都看到了警告Overfull/Underfull
。通常它在文档中并不十分明显,但有时它会超出指定的边距。下面的 MWE 展示了一个这样的实例:
\documentclass[12pt]{report}
\usepackage[margin=1.25in]{geometry}
\usepackage{hanging}
\usepackage{doi}
\begin{document}
\begin{hangparas}{.3in}{1}
Aguero-Valverde, J., \& Jovanis, P. P. (2006). Spatial analysis of fatal and injury crashes in Pennsylvania. \textit{Accident Analysis \& Prevention, 38}(3), 618-625. \doi{10.1016/j.aap.2005.12.006}
\end{hangparas}
\end{document}
最终产品如下:
可以看出,文本溢出了边距。我该如何修复这个问题?是否有一个包或命令可用于使文本“对齐”。
答案1
这就是为什么你必须在这里使用 LaTeX(默认情况下会对齐)。它不会将整个“单词”doi:10.1016/j.aap.2005.12.006
对齐到新行,因为这会产生更糟糕的下划线段落。
我的建议:
url
模仿(宏:)\doiurl{…}
的行为doi:{\urlstyle{same}\href{http://dx.doi.org/10.1016/j.aap.2005.12.006}{\nolinkurl{10.1016/j.aap.2005.12.006}}}
doi: {\urlstyle…
用于比较(宏\doiurl[ ]{…}
:)- 利用
\sloppy
(产生上述“不完整段落”) 插入手动换行符 (
\\
)\\\doi{10.1016/j.aap.2005.12.006}
请注意,(3)和(4)之间的区别不在最后一行!
代码
\documentclass[12pt]{report}
\usepackage[margin=1.25in]{geometry}
\usepackage{hanging}
\usepackage{url,doi}
\newcommand{\doiurl}[2][]{doi:#1{\urlstyle{same}\href{http://dx.doi.org/#2}{\nolinkurl{#2}}}}
\begin{document}
\begin{hangparas}{.3in}{1}
Aguero-Valverde, J., \& Jovanis, P. P. (2006). Spatial analysis of fatal and injury crashes in Pennsylvania. \textit{Accident Analysis \& Prevention, 38}(3), 618-625. \doiurl{10.1016/j.aap.2005.12.006}
\end{hangparas}
\begin{hangparas}{.3in}{1}
Aguero-Valverde, J., \& Jovanis, P. P. (2006). Spatial analysis of fatal and injury crashes in Pennsylvania. \textit{Accident Analysis \& Prevention, 38}(3), 618-625. \doiurl[ ]{10.1016/j.aap.2005.12.006}
\end{hangparas}
\begin{hangparas}{.3in}{1}\sloppy
Aguero-Valverde, J., \& Jovanis, P. P. (2006). Spatial analysis of fatal and injury crashes in Pennsylvania. \textit{Accident Analysis \& Prevention, 38}(3), 618-625. \doi{10.1016/j.aap.2005.12.006}
\end{hangparas}
\begin{hangparas}{.3in}{1}
Aguero-Valverde, J., \& Jovanis, P. P. (2006). Spatial analysis of fatal and injury crashes in Pennsylvania. \textit{Accident Analysis \& Prevention, 38}(3), 618-625.\\\doi{10.1016/j.aap.2005.12.006}
\end{hangparas}
\begin{hangparas}{.3in}{1}
Buck, A. J., Blackstone, E. A., \& Hakim, S. (2009). A multivariate Poisson model of consumer choice in a multi-airport region. \textit{iBusiness, 1}(2). \doiurl{10.4236/ib.2009.12012}
\end{hangparas}
\begin{hangparas}{.3in}{1}
Buck, A. J., Blackstone, E. A., \& Hakim, S. (2009). A multivariate Poisson model of consumer choice in a multi-airport region. \textit{iBusiness, 1}(2). \doiurl[ ]{10.4236/ib.2009.12012}
\end{hangparas}
\begin{hangparas}{.3in}{1} \sloppy
Buck, A. J., Blackstone, E. A., \& Hakim, S. (2009). A multivariate Poisson model of consumer choice in a multi-airport region. \textit{iBusiness, 1}(2). \doi{10.4236/ib.2009.12012}
\end{hangparas}
\begin{hangparas}{.3in}{1}
Buck, A. J., Blackstone, E. A., \& Hakim, S. (2009). A multivariate Poisson model of consumer choice in a multi-airport region. \textit{iBusiness, 1}(2).\\\doi{10.4236/ib.2009.12012}
\end{hangparas}
\end{document}
输出
答案2
无论如何,它doi
是牢不可破的。你可以调整悬挂尺寸。
\usepackage[margin=1.25in]{geometry}
\usepackage{hanging}
\usepackage{doi}
\begin{document}
\begin{hangparas}{.45in}{1}
Aguero-Valverde, J., \& Jovanis, P. P. (2006). Spatial analysis of fatal and injury crashes in Pennsylvania. \textit{Accident Analysis \& Prevention, 38}(3), 618-625. \doi{10.1016/j.aap.2005.12.006}
\end{hangparas}
\end{document}
您可以使用uri
包代替doi
。
\documentclass[12pt]{report}
\usepackage[margin=1.25in]{geometry}
\usepackage{hanging}
\usepackage{hyperref,uri}
\begin{document}
\begin{hangparas}{.3in}{1}
Aguero-Valverde, J., \& Jovanis, P. P. (2006). Spatial analysis of fatal and injury crashes in Pennsylvania. \textit{Accident Analysis \& Prevention, 38}(3), 618-625. \doi{10.1016/j.aap.2005.12.006}
\end{hangparas}
\begin{hangparas}{.3in}{1}
Buck, A. J., Blackstone, E. A., \& Hakim, S. (2009). A multivariate Poisson model of consumer choice in a multi-airport region. \textit{iBusiness, 1}(2). \doi{10.4236/ib.2009.12012}
\end{hangparas}
\end{document}
答案3
您可以使用 \allowbreak 重新定义 \doi,以允许在其前面中断。此外,如果中断发生在那里,则用空白填充行上剩余的空间(如果有),这样就不会发生框未满或过满的情况。只需添加此行
\expandafter\def\expandafter\doi\expandafter{\expandafter\hfil\expandafter\allowbreak\doi}
也就是说,MWE 变成:
\documentclass[12pt]{report}
\usepackage[margin=1.25in]{geometry}
\usepackage{hanging}
\usepackage{doi}
\expandafter\def\expandafter\doi\expandafter{\expandafter\hfil\expandafter\allowbreak\doi}
\begin{document}
\begin{hangparas}{.3in}{1}
Aguero-Valverde, J., \& Jovanis, P. P. (2006). Spatial analysis of fatal
and injury crashes in Pennsylvania. \textit{Accident Analysis \& Prevention, 38}(3), 618-625. \doi{10.1016/j.aap.2005.12.006}
\end{hangparas}
\begin{hangparas}{.3in}{1}
Buck, A. J., Blackstone, E. A., \& Hakim, S. (2009). A multivariate Poisson model of consumer choice in a multi-airport region. \textit{iBusiness, 1}(2). \doi{10.4236/ib.2009.12012}
\end{hangparas}
\end{document}