tud-cd / tudscr

TUD-Script
Other
105 stars 22 forks source link

Unequal spacing between number and text in bibliography #74

Open 0ttoman opened 2 years ago

0ttoman commented 2 years ago

Hey, so this visual error annoyed me a bit.. I created a minimal script to reproduce the issue. When using scrreprt it works perfectly, even without siunitx there is no distance error.

The spacing between the numbers 1-9 and the text are different from those after number 10 (and onwards)

\documentclass{tudscrreprt}
\usepackage{siunitx}

\usepackage[sorting=none]{biblatex}
\addbibresource{bib.bib}

\begin{document}
\nocite{*}
\printbibliography
\end{document}

bib.bib:

@book{a,
        title={Test},
}
@book{b,
        title={Test},
}
@book{c,
        title={Test},
}
@book{d,
        title={Test},
}
@book{e,
        title={Test},
}
@book{f,
        title={Test},
}
@book{g,
        title={Test},
}
@book{h,
        title={Test},
}
@book{i,
        title={Test},
}
@book{j,
        title={Test},
}

I used texlive 2020, but the error also occurs when using the newest version at tex.zih.tu-dresden.de / overleaf: image

mrpiggi commented 2 years ago

I can confirm the observed behavior with TeX Live 2020/2021. A quick workaround for this issue would be:

\documentclass[cdfont=true]{tudscrreprt}
\AfterPackage!{siunitx}{%
  \ifcsundef{if@tud@x@siunitx@enabled}{}{\boolfalse{@tud@x@siunitx@enabled}}%
}
\usepackage{siunitx}

\begin{filecontents}{\jobname-temp.bib}
@book{a,title={Test}}
@book{b,title={Test}}
@book{c,title={Test}}
@book{d,title={Test}}
@book{e,title={Test}}
@book{f,title={Test}}
@book{g,title={Test}}
@book{h,title={Test}}
@book{i,title={Test}}
@book{j,title={Test}}
\end{filecontents}

\usepackage[sorting=none]{biblatex}
\addbibresource{\jobname-temp.bib}

\begin{document}
\nocite{*}
\printbibliography
\end{document}

although this could raise other issues regarding siunitx.

Since for package siunitx a new major release v3 was published and is currently fixed quite a lot (https://github.com/josephwright/siunitx/releases) I do have to refactor the interaction with siunitx at all. I hopefully will find some time at the end of this year in order to publish a new major release for tudscr. In general, I am rather reluctant to provide bug fixes for outdated versions.

0ttoman commented 2 years ago

Thank you for getting back to me so soon and thank you for the quick fix! It works and I didn't see any other issues at first glance.

I totally understand that you don't want to also backport bug fixes, and I will switch to the newest TeX Live soon.

baloe commented 2 years ago

Unfortunately, this workaround,

\documentclass[cdfont=true]{tudscrreprt}
\AfterPackage!{siunitx}{%
  \ifcsundef{if@tud@x@siunitx@enabled}{}{\boolfalse{@tud@x@siunitx@enabled}}%
}
\usepackage{siunitx}

does not work with more recent latex distributions.

Here is an MWE which compiles fine without siunitx being loaded:

% !TeX TXS-program:bibliography = txs:///biber
% !TeX TXS-program:compile = txs:///pdflatex | txs:///bibliography | txs:///pdflatex

\documentclass{tudscrartcl}

\usepackage{filecontents}
\begin{filecontents}{bibliography.bib}
@article{ref1,  title = {Some really really really really really really long title designed to break into the next line}, author = {Author, Some and Auther, Other} }
@article{ref2,  title = {Some really really really really really really long title designed to break into the next line}, author = {Author, Some and Auther, Other} }
@article{ref3,  title = {Some really really really really really really long title designed to break into the next line}, author = {Author, Some and Auther, Other} }
@article{ref4,  title = {Some really really really really really really long title designed to break into the next line}, author = {Author, Some and Auther, Other} }
@article{ref5,  title = {Some really really really really really really long title designed to break into the next line}, author = {Author, Some and Auther, Other} }
@article{ref6,  title = {Some really really really really really really long title designed to break into the next line}, author = {Author, Some and Auther, Other} }
@article{ref7,  title = {Some really really really really really really long title designed to break into the next line}, author = {Author, Some and Auther, Other} }
@article{ref8,  title = {Some really really really really really really long title designed to break into the next line}, author = {Author, Some and Auther, Other} }
@article{ref9,  title = {Some really really really really really really long title designed to break into the next line}, author = {Author, Some and Auther, Other} }
@article{ref10, title = {Some really really really really really really long title designed to break into the next line}, author = {Author, Some and Auther, Other} }
@article{ref11, title = {Some really really really really really really long title designed to break into the next line}, author = {Author, Some and Auther, Other} }
\end{filecontents}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage[style=trad-plain,backend=biber]{biblatex}
\addbibresource{bibliography.bib}

\begin{document}

\nocite{*}
\printbibliography[heading=none]

\end{document}

Screenshot without siunitx

But when adding

\usepackage{siunitx}

or

\AfterPackage!{siunitx}{%
  \ifcsundef{if@tud@x@siunitx@enabled}{}{\boolfalse{@tud@x@siunitx@enabled}}%
}
\usepackage{siunitx}

I get Screenshot with siunitx

I tested:

and

and

Over at https://tex.zih.tu-dresden.de with texlive 2020.1 the workaround does function though.