# Problems with formatting of reference list using multibib

I'm using the multibib package to distinguish different types of references. In my document I have about 50 references in the first and about 70 in the second reference list. The numbering of the references works fine, but the formatting changes with reference number 100. I have created an MWE that isolates the main issue: the maximum label length seems to extracted by the number of elements of just one reference list.

In this example everything works fine, because i have 100 references in the second reference file:

\documentclass[12pt]{scrbook}

\usepackage{cite}
\usepackage{multibib}
\usepackage[fixlanguage]{babelbib}
\usepackage[german]{babel}
\selectbiblanguage{german}

\newcites{mine}{FooBar}

\begin{document}

\citemine{A1}
\cite{A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17,A18,A19,A20,A21,A22,A23,A24,A25,A26,A27,A28,A29,A30,A31,A32,A33,A34,A35,A36,A37,A38,A39,A40,A41,A42,A43,A44,A45,A46,A47,A48,A49,A50,A51,A52,A53,A54,A55,A56,A57,A58,A59,A60,A61,A62,A63,A64,A65,A66,A67,A68,A69,A70,A71,A72,A73,A74,A75,A76,A77,A78,A79,A80,A81,A82,A83,A84,A85,A86,A87,A88,A89,A90,A91,A92,A93,A94,A95,A96,A97,A98,A99,A100}

\bibliographystylemine{babplain-Customized}
\bibliographymine{references}

\bibliographystyle{babplain-Customized}
\bibliography{references}

\end{document}


The result looks like

In this example I have an issue, because i have less than 100 references in the second reference file:

\documentclass[12pt]{scrbook}

\usepackage{cite}
\usepackage{multibib}
\usepackage[fixlanguage]{babelbib}
\usepackage[german]{babel}
\selectbiblanguage{german}

\newcites{mine}{FooBar}

\begin{document}

\citemine{A1}
\cite{A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17,A18,A19,A20,A21,A22,A23,A24,A25,A26,A27,A28,A29,A30,A31,A32,A33,A34,A35,A36,A37,A38,A39,A40,A41,A42,A43,A44,A45,A46,A47,A48,A49,A50,A51,A52,A53,A54,A55,A56,A57,A58,A59,A60,A61,A62,A63,A64,A65,A66,A67,A68,A69,A70,A71,A72,A73,A74,A75,A76,A77,A78,A79,A80,A81,A82,A83,A84,A85,A86,A87,A88,A89,A90,A91,A92,A93,A94,A95,A96,A97,A98,A99,A100}

\bibliographystylemine{babplain-Customized}
\bibliographymine{references}

\bibliographystyle{babplain-Customized}
\bibliography{references}

\end{document}


The result looks like

My aux files look good and as far as I understand the bst file I would expect that the longest label, i.e. 100 would be identified. But from the MWE it follows that the entries seem to be counted to determine the longest label.

Has anyone an idea how to trick bibtex to get a nice and clean formatting of my reference list?

You'll find the bst file here

You'll find the reference file here

Ok, I found a solution myself. If somenone runs into the same issue here is my solution:

First I learned that I have the issue using plain but everything works fine with mbplain. The differnce regarding determination of label width is the following

FUNCTION {longest.label.pass}
{ number.label int.to.str$'label := number.label #1 + 'number.label := label width$ longest.label.width >
{ label 'longest.label :=
label width$'longest.label.width := } 'skip$
if$}  In mbplain.bst it reads FUNCTION {longest.label.pass} { number.label int.to.str$ 'label :=
number.label #1 + 'number.label :=
label width$longest.label.width > label width$ longest.label.width =   %% added to count the labels
or                                   %% added to count the labels
{ label 'longest.label :=
label width$'longest.label.width := } 'skip$
if\$
}


While plain.bst counts the actual number of entries in one of the bibliographies it ends up with a double-digit number. mbplain.bst just searches for the longest label, i.e. a three-digit number.

So in my bst-file I just replaced the function longest.label.pass by the second version and everything works fine.