使用 biblatex 等间距参考书目键

使用 biblatex 等间距参考书目键

我正在用 制作参考书目biblatex。我必须格式化我的引用键以满足某些要求。我目前的问题是,我没有找到更改键的水平间距/对齐方式的选项。这是我当前的设置:

citations and keys

我希望它的键间距相等,以便括号像这样对齐(但仅限于参考书目本身):

Text with citation [CD] and this [OBB]

Bibliography:
[  CD ] Some text
[ OBB ] Some text

这里最重要的方面是括号的对齐。如何做到这一点?此外,有没有办法将键置于括号内的中心?

\documentclass{scrartcl}

\usepackage[backend=biber,style=alphabetic,maxbibnames=1,maxcitenames=1,defernumbers,%
    doi=false,isbn=false,clearlang=false,backref=false]{biblatex}
\DeclareFieldFormat{labelalpha}{\textsc{#1}}

\begin{filecontents}{bib.bib}
@ONLINE{text:source,
    author={B. Obby},
    title={Sources today},
    url={http://www.example.com},
    urldate={2017-02-20},}
@ONLINE{text:src,
    author={Cicero, Marcus Tullius and Doe, John},
    title={Sources tomorrow},
    url={http://www.example.com},
    urldate={2017-02-20},}
\end{filecontents}

\bibliography{bib}
\nocite{*}

\begin{document}

Text with citation and no extended spacing: \autocite{text:src}\\
Text witch citation and ordinary spacing: \autocite{text:source}

\printbibliography

\end{document}

答案1

\documentclass{scrartcl}

\usepackage[backend=biber,style=alphabetic,maxbibnames=1,maxcitenames=1,defernumbers,%
    doi=false,isbn=false,clearlang=false,backref=false]{biblatex}
\DeclareFieldFormat{labelalpha}{\textsc{#1}}


\addbibresource{biblatex-examples.bib}
\nocite{*}

\DeclareFieldFormat{labelalphawidth}{\mkbibbrackets{\hfill#1\hfill}}

\begin{document}

Text with citation and no extended spacing: \autocite{doody}\\
Text witch citation and ordinary spacing: \autocite{herrmann}

\printbibliography

\end{document}

enter image description here

相关内容