![Biblatex 使用简写和数字样式 - 标签大小](https://linux22.com/image/296925/Biblatex%20%E4%BD%BF%E7%94%A8%E7%AE%80%E5%86%99%E5%92%8C%E6%95%B0%E5%AD%97%E6%A0%B7%E5%BC%8F%20-%20%E6%A0%87%E7%AD%BE%E5%A4%A7%E5%B0%8F.png)
现在的情况:
我需要分别引用文章和书籍等中的“规范性”文件(即标准和手册)。使用biblatex
和biber
风格numeric
我通过发出多个printbibliography
命令来实现这一点,如下所示:
\usepackage[style=numeric,backend=biber,bibencoding=utf8]{biblatex}
%... lots of stuff
\printbibliography[type=standard,title=Standards \& Manuals]
\vskip\baselineskip
\printbibliography[type=manual,heading=none]
\printbibliography[nottype=standard,nottype=manual]
给出了一个标题标准和手册,打印一份手册列表,留出一些空间,然后是标准列表,最后在新的标题下参考书目提供书籍和文章等。到目前为止一切都很好,输入:
问题:我正在使用shorthand
数据库中的标准和手册字段,就文本内的输出而言,该字段工作完美,并将简写设置为参考书目中的标签并在其右侧打印详细信息 - 问题是:我的简写比样式生成的标签长得多numeric
,但即使它们在三个不同的\printbibliography
命令中,所有内容都会缩进到标签的最大宽度,使书籍和文章的部分看起来相当荒谬。
下面仅用两个单独的\printbibliography
(以及明显夸张的长的速记)来展示该问题:
现在我显然想要的是每个\printbibliography
命令只使用实际需要的缩进来容纳其中出现的最大标签,即渲染手册部分如上所述,但参考书目部分如下:
有人能帮我实现这个吗?或者给我一些建议,告诉我去哪里找?
以上内容是在最新的 TeXLive 2014 上使用以下 MWE 生成的:
\documentclass[10pt,british]{scrbook}
\usepackage{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@manual{HowTo,
title = {How to Make the World Go Round},
shorthand = {HowToMakeTheWorlGoRound},
publisher = {The Publisher},
year = {2000}
}
@article{Article,
author = {Author, A. and Buthor, B.},
journal = {Journal Title},
pages = {113--126},
title = {The Article},
volume = {65},
year = {1900}
}
\end{filecontents*}
\usepackage[style=numeric,backend=biber,bibencoding=utf8]{biblatex}
\addbibresource{\jobname.bib}
\usepackage[hidelinks]{hyperref}
\begin{document}
\let\cleardoublepage\relax
\chapter{The Document}
Nothing to see here, but we refer to the \parencite{HowTo} based on a principle discovered by \textcite{Article}.
\printbibliography[type=manual,title=Manuals]
\printbibliography[nottype=manual]
\end{document}
答案1
正如所提到的Biblatex,前缀数字的使用改变了所有子书目的缩进 biblatex
3.11 有新的选项locallabelwidth
,使得每个标签宽度的计算都是本地的\printbibliography
。
\documentclass[10pt,british]{scrbook}
\usepackage{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@manual{HowTo,
title = {How to Make the World Go Round},
shorthand = {HowToMakeTheWorlGoRound},
publisher = {The Publisher},
year = {2000}
}
@article{Article,
author = {Author, A. and Buthor, B.},
journal = {Journal Title},
pages = {113--126},
title = {The Article},
volume = {65},
year = {1900}
}
\end{filecontents*}
\usepackage[style=numeric,backend=biber,locallabelwidth]{biblatex}
\addbibresource{\jobname.bib}
\usepackage[hidelinks]{hyperref}
\begin{document}
\let\cleardoublepage\relax
\chapter{The Document}
Nothing to see here, but we refer to the \parencite{HowTo} based on a principle discovered by \textcite{Article}.
\printbibliography[type=manual,title=Manuals]
\printbibliography[nottype=manual]
\end{document}
答案2
感谢@moewe 的链接和其中的评论,我找到了一个似乎有效的解决方案,它允许numeric
任意设置部件标签的宽度。
通过定义新的bibenvironment
带有\defbibenvironment{bibnumeric}...
和其中的设置,可以调整任何使用\labelnumberwidth
该标签的宽度- 通过添加到命令。\printbibliography
bibenvironment
env=bibnumeric
\printbibliography
因此,可以通过添加以下内容来修复上述 MWE:
%% make substyle for normal numbered bib
\defbibenvironment{bibnumeric}
{\list
{\printtext[labelnumberwidth]{%
\printfield{prefixnumber}%
\printfield{labelnumber}}}
{\settowidth{\labelnumberwidth}{8888}%
\setlength{\labelwidth}{\labelnumberwidth}%
\setlength{\leftmargin}{\labelwidth}%
\setlength{\labelsep}{\biblabelsep}%
\addtolength{\leftmargin}{\labelsep}%
\setlength{\itemsep}{\bibitemsep}%
\setlength{\parsep}{\bibparsep}}%
\renewcommand*{\makelabel}[1]{\hss##1}}
{\endlist}
{\item}
这是在中\defbibenvironment{bibliography}
找到的副本,除了添加之外,它还允许任意设置新的标签宽度- 使用的值允许使用三位数的引用号码。numeric.bbx
biblatex
\settowidth{\labelnumberwidth}{8888}
bibenvironment
完整的 MWE 为:
\documentclass[10pt,british]{scrbook}
\usepackage{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@manual{HowTo,
title = {How to Make the World Go Round},
shorthand = {HowToMakeTheWorlGoRound},
publisher = {The Publisher},
year = {2000}
}
@article{Article,
author = {Author, A. and Buthor, B.},
journal = {Journal Title},
pages = {113--126},
title = {The Article},
volume = {65},
year = {1900}
}
\end{filecontents*}
\usepackage[style=numeric,backend=biber,bibencoding=utf8]{biblatex}
\addbibresource{\jobname.bib}
%% make substyle for normal numbered bib
\defbibenvironment{bibnumeric}
{\list
{\printtext[labelnumberwidth]{%
\printfield{prefixnumber}%
\printfield{labelnumber}}}
{\settowidth{\labelnumberwidth}{8888}%
\setlength{\labelwidth}{\labelnumberwidth}%
\setlength{\leftmargin}{\labelwidth}%
\setlength{\labelsep}{\biblabelsep}%
\addtolength{\leftmargin}{\labelsep}%
\setlength{\itemsep}{\bibitemsep}%
\setlength{\parsep}{\bibparsep}}%
\renewcommand*{\makelabel}[1]{\hss##1}}
{\endlist}
{\item}
\usepackage[hidelinks]{hyperref}
\begin{document}
\let\cleardoublepage\relax
\chapter{The Document}
Nothing to see here, but we refer to the \parencite{HowTo} based on a principle discovered by \textcite{Article}.
\printbibliography[type=manual,title=Manuals]
\printbibliography[nottype=manual,env=bibnumeric]
\end{document}
给出输出: