TeX - LaTeX Asked by redicing on February 6, 2021
I am using the biblatex
package in an article document, and am trying to list references all in one line, as the writer of this question is trying to do. I’ve tried the fix that is offered, but it didn’t work as expected since I am using biblatex
. I tried to follow the link in the second answer that mentions biblatex
, but the link is broken. In his answer, he mentions a parameter called defbiblatex
, but I could not find its definition in the biblatex documentation.
Currently, I am using biblatex
as follows:
documentclass[11pt]{article}
usepackage[
backend=biber,
style=numeric-comp,
sort=nty
]{biblatex}
addbibresource{references.bbl}
renewcommand{refname}{References vspace{-0.6baselineskip}} % no extra vert. space after title
setlength{bibitemsep}{0pt} % no extra vert. space between bib items
printbibliography
What is the simplest way for me to format the bibliography so that the resultant citation list will look like:
[1] Article 1 [2] Article 2 [3] Article 3 …
lockstep's answer to Reduce bibliography to one line contains a fully compilable example document that shows exactly what you could do. There is no need to follow any links to understand the main point of the answer (indeed link rot is one of the main reasons why self-contained answers are encouraged here).
The command you are looking for is called defbibenvironment
. The standard settings in a numeric
style look like this
defbibenvironment{bibliography}
{list
{printtext[labelnumberwidth]{%
printfield{labelprefix}%
printfield{labelnumber}}}
{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}
The idea in lockstep's answer is to remove the list environment from that definition and have everything printed as normal text in the same line.
There is just one tiny detail in lockstep's answer that I'd change: It was written for an older version of biblatex
where the labelprefix
field was still called prefixnumber
. With a current version of biblatex
I'd suggest
documentclass{article}
usepackage[
backend=biber,
style=numeric-comp,
sorting=nty,
]{biblatex}
defbibenvironment{bibliography}
{}
{}
{addspace
printtext[labelnumberwidth]{%
printfield{labelprefix}%
printfield{labelnumber}}%
addhighpenspace}
addbibresource{biblatex-examples.bib}
begin{document}
nocite{sigfridsson,worman,geer,nussbaum}
printbibliography
end{document}
Note that the option to specify the sorting is called sorting
and not sort
.
Answered by moewe on February 6, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP