25

Latex参考文献中长URL自动分行显示

 2 years ago
source link: https://blog.csdn.net/yanxiangtianji/article/details/120878803
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Latex参考文献中长URL自动分行显示

专栏收录该内容
9 篇文章 1 订阅

先上结论:
网上有很多或新或旧的解决方法,这是我找到的最简单有效的解决方案:

\usepackage[hyphens]{url}
\usepackage{breakurl}

核心原理是使用breakurl包。

注意事项1:

默认是会在/(#.之类非普通字符处分行。但是如果长url中有大量的-(连字符),那么一定要给url传入参数hyphens。否则连字符部分是不会自动分行的。
如果URL中没用长-

注意事项2:

如果使用了出版社的style,可能会分行失败,这多半是出版社的style文件里面使用默认方式引用了url包。我们可以在指定之前(通常是documentclass命令,个别是usepackage)使用下面的命令将hyphens参数传递进去。

\PassOptionsToPackage{hyphens}{url}

参考资料:
https://tex.stackexchange.com/questions/115690/urls-in-bibliography-latex-not-breaking-line-as-expected


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK