tex 代码如下。
\documentclass[a4paper,11pt,number]{elsarticle}
\usepackage{times}%Use Times New Roman Font
\usepackage[hyphens]{url} %To recognize URLs
\begin{document}
\title{Integrated Model for Power Interruption Contracts}
\author{Lakshmi Palaparambil Dinesh}
\begingroup %\raggedright
\bibliography{reference_PowerInterruption}
%\bibliographystyle{apalike}
\bibliographystyle{elsarticle-num}
\endgroup
\end{document}
使用 url 包中的连字符后,我发现单词或 url 部分之间有空格,并且有一些空格。如何删除剩余的额外空格?
答案1
因为您没有给我们 bib 文件,所以我创建了一个进行测试。
请参阅以下 MWE(该包filecontents
仅用于将 bib 文件和 tex 代码合并到一个可编译的 MWE 中):
\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@Book{Goossens,
author = {Goossens, Michel and Mittelbach, Frank and
Samarin, Alexander},
title = {The LaTeX Companion},
edition = {1},
publisher = {Addison-Wesley},
location = {Reading, Mass.},
year = {1994},
}
@Book{adams,
title = {The Restaurant at the End of the Universe},
author = {Douglas Adams},
series = {The Hitchhiker's Guide to the Galaxy},
publisher = {Pan Macmillan},
year = {1980},
}
@article{feynman,
title = {Very High-Energy Collisions of Hadrons},
author = {Richard P. Feynman},
journal = {Phys. Rev. Lett.},
volume = {23},
issue = {24},
pages = {1415--1417},
year = {1969},
month = {Dec},
doi = {10.1103/PhysRevLett.23.1415},
url = {http://link.aps.org/doi/10.1103/PhysRevLett.23.1415},
publisher = {American Physical Society},
}
@article{einstein,
author = {Albert Einstein},
title = {{Zur Elektrodynamik bewegter K{\"o}rper}. ({German})
[{On} the electrodynamics of moving bodies]},
journal = {Annalen der Physik},
volume = {322},
number = {10},
pages = {891--921},
year = {1905},
DOI = {http://dx.doi.org/10.1002/andp.19053221004},
}
@Article{Schamb2010,
Title = {Properties of the Distant Kuiper Belt: Results from the
Palomar Distant Solar System Survey},
Author = {(Megan E.) Schwamb and (Michael E.) Brown and
(David L.) Rabinowitz and Darin Ragozzine},
Journal = {The Astrophysical Journal},
Year = {2010},
Month = {September},
Number = {2},
Pages = {17},
Volume = {720},
Doi = {10.1088/0004-637X/720/2/1691},
Timestamp = {2014.09.21},
Url = {http://m.iopscience.iop.org/0004-637X/720/2/1691/pdf/0004-637X\_720\_2\_1691.pdf}
}
\end{filecontents*}
\documentclass[a4paper,11pt,number]{elsarticle}
\usepackage{showframe} % to visualise the typing area and margins
\usepackage{times} % Use Times New Roman Font
\usepackage[hyphens]{url} % To recognize URLs
\usepackage{ragged2e} % command \RaggedRight
\begin{document}
\title{Integrated Model for Power Interruption Contracts}
\author{Lakshmi Palaparambil Dinesh}
This is text with \cite{Goossens, einstein} and \cite{adams}.
\nocite{*} % to test all bib entrys
{
%\RaggedRight % <===================================================
\bibliographystyle{elsarticle-num} % apalike
\bibliography{\jobname}
}
\end{document}
您将获得以下结果:
我用红色标记了您不想要的空白区域...我知道的最优雅的方法是使用包ragged2e
,它为您提供命令\RaggdRight
以更好地使用连字符来获得左对齐的文本!请\RaggdRight
在 MWE 中取消注释(参见标记<=======
)并重新编译。
现在得到的结果是:
红色箭头标记了布局变化。对我来说,这个解决方案比第一个好得多……