TeX - LaTeX Asked on March 17, 2021
I’m trying to create a compressed, single-paragraph bibliography using biblatex
, like in this answer. I’d also like to make the font quite a bit smaller than the main font size of the document. I’m doing this by setting bibfont
; however, this produces something that looks like double spacing, but I only want single spacing. I thought that
renewcommand*{bibfont}{fontsize{5pt}{7pt}selectfont}
would take care of this because fontsize
is supposed to also set the baselineskip
value. Does anyone know why I have such big line spacing in the bibliography, and how can I reduce this spacing to something that just looks like normal single spacing?
begin{filecontents*}{jobname.bib}
@article{a1,
author = {Smith, Jane},
journal = {Nature},
volume = {7},
pages = {201--204},
year = {1999},
}
@article{a2,
author = {Smith, Jane},
journal = {Nature},
volume = {7},
pages = {201--204},
year = {2000},
}
@article{a3,
author = {Smith, Jane},
journal = {Nature},
volume = {7},
pages = {201--204},
year = {2001},
}
@article{a4,
author = {Smith, Jane},
journal = {Nature},
volume = {7},
pages = {201--204},
year = {2002},
}
@article{a5,
author = {Smith, Jane},
journal = {Nature},
volume = {7},
pages = {201--204},
year = {2003},
}
end{filecontents*}
documentclass{article}
usepackage[american]{babel}
usepackage{csquotes}
usepackage[backend=biber,
style=authoryear-comp,
maxcitenames=2,
maxnames=1,
minnames=1,
firstinits=true]{biblatex}
addbibresource{jobname.bib}
renewcommand*{bibfont}{fontsize{5pt}{7pt}selectfont}
defbibenvironment{bibliography}
{}
{}
{addspace}
begin{document}
nocite{*}
printbibliography
end{document}
The issue is that, if horizontal mode is not ended in the bibliography environment, then the value of baselineskip
reverts to what it is elsewhere in the document. This is discussed in this answer to Reduce line spacing when using smaller font size in an environment.
You can end the paragraph (i.e., end horizontal mode and force the material to be broken into lines) by putting endgraf
into the <end code>
part of the defbibenvironment
command:
defbibenvironment{bibliography}
{}
{endgraf}
{addspace}
You have to use endgraf
here instead of par
, otherwise you'll get an error (see When is it better to use par than endgraf? for some discussion of the differences between par
and endgraf
).
Here is the full MWE:
begin{filecontents*}{jobname.bib}
@article{a1,
author = {Smith, Jane},
journal = {Nature},
volume = {7},
pages = {201-204},
year = {1999},
}
@article{a2,
author = {Smith, Jane},
journal = {Nature},
volume = {7},
pages = {201-204},
year = {2000},
}
@article{a3,
author = {Smith, Jane},
journal = {Nature},
volume = {7},
pages = {201-204},
year = {2001},
}
@article{a4,
author = {Smith, Jane},
journal = {Nature},
volume = {7},
pages = {201-204},
year = {2002},
}
@article{a5,
author = {Smith, Jane},
journal = {Nature},
volume = {7},
pages = {201-204},
year = {2003},
}
end{filecontents*}
documentclass{article}
usepackage[american]{babel}
usepackage{csquotes}
usepackage[backend=biber,
style=authoryear-comp,
maxcitenames=2,
maxnames=1,
minnames=1,
firstinits=true]{biblatex}
addbibresource{jobname.bib}
renewcommand*{bibfont}{fontsize{5pt}{7pt}selectfont}
defbibenvironment{bibliography}
{}
{endgraf}
{addspace}
begin{document}
nocite{*}
printbibliography
end{document}
And here is the resulting output with something that looks like single line spacing:
Correct answer by Adam Liter on March 17, 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