BibDesk
我在 Mac 上使用它来管理我的参考书目,并且我使用phjcp
bibstyle(使用小型大写字母和未分类的参考文献)。
问题是:我要显示非常长的标题和网址,问题就来了:条目的文本是对齐的,而不是向左对齐(应该是这样)。您可以在图片上看到[1]
和之间的区别[2]
。我只有在长引用时才会这样,这有点糟糕。
此外,我试图通过一个长引用来隔离问题,[4]
但它并没有出现!
你能帮助我吗?这是我的biblio.bib
文件:
%% This BibTeX bibliography file was created using BibDesk.
@comment{x-kbibtex-personnameformatting=<%l><, %f>}
@book{pbkdf,
Author = {{Wikip{\'e}dia}},
Date-Added = {2015-09-24 12:03:46 +0000},
Date-Modified = {2015-09-25 08:25:58 +0000},
Lastchecked = {Octobre},
Publisher = {\url{https://en.wikipedia.org/wiki/small_titls}},
Title = {Small Title},
Year = {consult{\'e} en octobre 2015}}
@book{secuhash,
Author = {Gilbert,Henri and Handschuh, Helena},
Date-Added = {2015-09-24 09:27:15 +0000},
Date-Modified = {2015-09-24 09:33:47 +0000},
Pages = {175--193},
Publisher = {Springer-Verlag},
Series = {Lecture Notes in Computer Science},
Title = {Security analysis of SHA-256 and sisters},
Volume = {3006},
Year = {2003}}
@book{test,
Author = {Wikipedia, Jack, and Wikipedia, John},
Date-Added = {2015-09-24 06:47:35 +0000},
Date-Modified = {2015-09-25 08:29:03 +0000},
Publisher = {\url{super/long/url/with/a/lot/of/weird/things/in/it}},
Series = {SP 800-38D},
Title = {Very long title because it is a name of a very specific article (with abbreviations) and many otherthings that make it take more than one line},
Year = {2019, visited online on March 21, 2045}}
@book{justify,
Author = {McGrew, David and Viega,John},
Date-Added = {2015-09-23 15:29:41 +0000},
Date-Modified = {2015-09-24 08:21:29 +0000},
Month = {Mai},
Publisher = {\url{https://globaljournals.org/GJCST_Volume13/4-A-Study-of-Encryption-Algorithms.pdf}},
Title = {The Security and Performance of the Galois/Counter Mode (GCM) of Operation},
Year = {2005, consult{\'e} en octobre 2015}}
我使用一个book
条目来表示这类文章,因为它们只在线,而且我想要这种格式(我尝试创建一个新的 bibstyle,但没有成功)。
信息:我使用该url
包,以及该geometry
包:
\usepackage[top=2cm,bottom=2.5cm,left=2.5cm,right=2.5cm]{geometry}
答案1
因为我们不知道您使用的文档类,所以我使用标准书目测试代码来尝试重现您的问题。
代码如下:
% http://tex.stackexchange.com/questions/269438/text-alignment-in-bibliography
\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},
}
@comment{x-kbibtex-personnameformatting=<%l><, %f>}
@book{pbkdf,
Author = {{Wikip{\'e}dia}},
Date-Added = {2015-09-24 12:03:46 +0000},
Date-Modified = {2015-09-25 08:25:58 +0000},
Lastchecked = {Octobre},
Publisher = {\url{https://en.wikipedia.org/wiki/small_titls}},
Title = {Small Title},
Year = {consult{\'e} en octobre 2015},
}
@book{secuhash,
Author = {Gilbert,Henri and Handschuh, Helena},
Date-Added = {2015-09-24 09:27:15 +0000},
Date-Modified = {2015-09-24 09:33:47 +0000},
Pages = {175--193},
Publisher = {Springer-Verlag},
Series = {Lecture Notes in Computer Science},
Title = {Security analysis of SHA-256 and sisters},
Volume = {3006},
Year = {2003},
}
@book{test,
Author = {Wikipedia, Jack and Wikipedia, John},
Date-Added = {2015-09-24 06:47:35 +0000},
Date-Modified = {2015-09-25 08:29:03 +0000},
Publisher = {\url{super/long/url/with/a/lot/of/weird/things/in/it}},
Series = {SP 800-38D},
Title = {Very long title because it is a name of a very specific article (with abbreviations) and many otherthings that make it take more than one line},
Year = {2019, visited online on March 21, 2045},
}
@book{justify,
Author = {McGrew, David and Viega,John},
Date-Added = {2015-09-23 15:29:41 +0000},
Date-Modified = {2015-09-24 08:21:29 +0000},
Month = {Mai},
Publisher = {\url{https://globaljournals.org/GJCST_Volume13/4-A-Study-of-Encryption-Algorithms.pdf}},
Title = {The Security and Performance of the Galois/Counter Mode (GCM) of Operation},
Year = {2005, consult{\'e} en octobre 2015},
}
\end{filecontents*}
\documentclass[10pt,a4paper]{article}
\usepackage[top=2cm,bottom=2.5cm,left=2.5cm,right=2.5cm]{geometry}
%\usepackage{microtype}
\usepackage[%
newcommands % \RaggedRight=\raggedright etc.
,newparameters % use default settings of ragged2e
]{ragged2e}
\usepackage{showframe} % to visualise the typing area and margins
%\PassOptionsToPackage{hyphens}{url}
\usepackage{hyperref}
\begin{document}
This is text with \cite{Goossens} and \cite{adams}.
\nocite{*} % to test all bib entrys
\bibliographystyle{phjcp}% unsrt
%{\raggedright % group to end left justification after bib
\bibliography{\jobname}
%} % ends group for left justified bibliography
\end{document}
在第 64 行我添加了您的geometry
定义,我使用了类article
并准备了 MWE 以便稍后编写参考书目\raggedright
(仅左对齐参考书目)。
结果:
现在取消注释包含 的第 65 行\usepackage{microtype}
。然后编译 3 次。结果:
这表明microtype
应该将其添加到您的文档中。
如果这对您不起作用,请参见第 71 行。取消注释后,URL 就不再有问题了。
最后提示:取消注释第 80 行和第 82 行,这样就可以得到仅左对齐的参考书目。这样你的参考书目中就不会有大空格了。我认为这对参考书目来说更好。
您的代码中的问题是给定的 url 缺少连字符。这导致 LaTeX 添加大空格。它可以在哪里做到这一点?您已经有空格了,标题...
取消注释所有行后,您会得到以下结果(这些行来自包,showframe
用于可视化打字区域):