您的位置:首页 > 其它

如何在参考文献中优雅地引用URL?How do you get nicely formatted URLs in the bibliography?

2017-04-07 16:51 495 查看
在论文应用URL参考文献的过程中, 总感觉编译出来的格式怪怪的,而且最严重的的一个问题是,若URL标题比较短,而URL地址比较长的时候,URL的标题部分会被横向拉伸以填充整行的长度,从而导致单词之间的间隔特别大。解决这个问题也很简单,主要就是使用\url{}来处理URL地址。但是这个\url{URL地址}部分放到哪个字段里,在网上找到两种不同的说法:

一篇比较老的外文教程是这么说的,网址http://www.kronto.org/thesis/tips/url-formatting.html

Answer

Use the url package by Donald
Arseneau.

Example usage

In the preamble:
\usepackage{url}

%% Define a new 'leo' style for the package that will use a smaller font.
\makeatletter
\def\url@leostyle{%
\@ifundefined{selectfont}{\def\UrlFont{\sf}}{\def\UrlFont{\small\ttfamily}}}
\makeatother
%% Now actually use the newly defined style.
\urlstyle{leo}

In a BibTEX entry:
@misc{
c.elmohamed,
author = "Saleh Elmohamed",
title = "Examples in {H}igh {P}erformance {F}ortran",
howpublished = "Website",
year = {1996},
note = {\url{http://www.npac.syr.edu/projects/
cpsedu/summer98summary/ examples/hpf/hpf.html}}
}

Result, before



Result, after



Things to watch out for

I tweak the default url style to use a smaller version of the typewriter font because I otherwise find that the Adobe Courier font I use (see also the Using
Courier tip) displays a bit too large for my tastes, but also because the larger font still causes more spacing ugliness (in terms of underfull hboxes), as illustrated by the following screenshot:



If strange ‘%’ signs start appearing in the list of references in the bibliography section, this is because BibTEX inserts
those when it encounters a line it feels is too long:



This is purely a BibTEX thing:
inside a URL being handled by the url package, the line won't actually be too long — after all the whole idea is for url to be responsible for splitting it. The solution, as shown in the listing given earlier, is to add some stray
whitespace to the long url. BibTEX will
then no longer think the line is too long, and \url{} ignores all whitespace anyway, so it will
not appear in the output.
The biggest problem with the url package is that you do not use it in your LATEX source
file, but in your BibTEX source
files, thus making your bibliographies non-portable: once you start using \url{} in your BibTEX entries,
you will be forced to include the url package in all your LATEX files
that use that bibliography file.

在StackExchange上有人的回答是这样的,网址http://tex.stackexchange.com/questions/35977/how-to-add-a-url-to-a-latex-bibtex-file

这个网页的内容不好复制,就不贴在这里了,只给出一段例子

@misc{bworld,
author = {Ingo Lütkebohle},
title = {{BWorld Robot Control Software}},
howpublished = "\url{http://aiweb.techfak.uni-bielefeld.de/content/bworld-robot-control-software/}",
year = {2008},
note = "[Online; accessed 19-July-2008]"
}


两个的相同之处在于:

都使用的@misc标签,URL标题放到title字段中,URL地址需要包含到"\url{}"中。都需要引入url包,\usepackage{url}.

两个的不同之处在于:

第一种说法中,"\url{}"部分放到note字段中;第二种说法里,"\url{}"部分放到howpublished字段中,经过实际验证,放在哪个字段中,对最终肉眼可见的格式没有任何影响(至于有没有什么理论上的,含义上的或者编译中的潜在不兼容或者冲突目前不得而知)。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  url latex
相关文章推荐