3

after I got very helpful advice to some modifications of the chem-biochem biblatex style in another, question, I have one more thing I'd like to alter:

By default chem-biochem creates a small indent in the first line of an entry in the bibliography. I'd like to get rid of that, if somehow possible and have all right aligned as in most other styles.

Thank you! Example

  • You can make your question much easier if you provide an MWE/MWEB. That way people don't have to go back through all your questions or build something themselves. – moewe Jan 24 '18 at 22:09

1 Answers1

3

biblatex-chem's chem-biochem still uses some pre-3.3 code. See Biblatex 3.3 name formatting. In particular you need to replace \ifblank with \ifdefvoid.

\renewbibmacro*{name:family-given}[4]{%
  \ifuseprefix
    {\usebibmacro{name:delim}{#3#1}%
     \usebibmacro{name:hook}{#3#1}%
     \ifdefvoid{#3}{}
       {\mkbibnameprefix{#3\isdot}%
        \ifprefchar{}{\addhighpenspace}}%
     \mkbibnamefamily{#1\isdot}%
     \ifdefvoid{#2}{}
       {\addcomma\addlowpenspace
        \mkbibnamegiven{#2}\isdot}%
     \ifdefvoid{#4}{}
       {\addlowpenspace
        \mkbibnamesuffix{#4}\isdot}}
    {\usebibmacro{name:delim}{#1}%
     \usebibmacro{name:hook}{#1}%
     \mkbibnamefamily{#1}\isdot
     \ifboolexpe{%
       test {\ifdefvoid{#2}}
       and
       test {\ifdefvoid{#3}}}
       {}
       {\addcomma}%
     \ifdefvoid{#2}{}
       {\addlowpenspace
        \mkbibnamegiven{#2}\isdot}%
     \ifdefvoid{#3}{}
       {\addlowpenspace
        \mkbibnameprefix{#3}\isdot}%
     \ifdefvoid{#4}{}
       {\addlowpenspace
        \mkbibnamesuffix{#4}\isdot}}%
} 

The definition in chem-biochem.bbx using the old macros does not quite work with the new name format and causes a spurious space in certain situations. That's what you are seeing as an incorrect indentation.

With the fix your MWE from chem-biochem options not working becomes

\documentclass{article}
\usepackage[style=chem-biochem, biblabel=brackets]{biblatex}

\addbibresource{biblatex-examples.bib}

\makeatletter
\renewcommand*{\bibleftbracket}{\blx@postpunct[}
\renewcommand*{\bibrightbracket}{\blx@postpunct]\midsentence}
\makeatother

\DeclareFieldFormat{labelnumber}{#1}

\renewbibmacro*{name:family-given}[4]{%
  \ifuseprefix
    {\usebibmacro{name:delim}{#3#1}%
     \usebibmacro{name:hook}{#3#1}%
     \ifdefvoid{#3}{}
       {\mkbibnameprefix{#3\isdot}%
        \ifprefchar{}{\addhighpenspace}}%
     \mkbibnamefamily{#1\isdot}%
     \ifdefvoid{#2}{}
       {\addcomma\addlowpenspace
        \mkbibnamegiven{#2}\isdot}%
     \ifdefvoid{#4}{}
       {\addlowpenspace
        \mkbibnamesuffix{#4}\isdot}}
    {\usebibmacro{name:delim}{#1}%
     \usebibmacro{name:hook}{#1}%
     \mkbibnamefamily{#1}\isdot
     \ifboolexpe{%
       test {\ifdefvoid{#2}}
       and
       test {\ifdefvoid{#3}}}
       {}
       {\addcomma}%
     \ifdefvoid{#2}{}
       {\addlowpenspace
        \mkbibnamegiven{#2}\isdot}%
     \ifdefvoid{#3}{}
       {\addlowpenspace
        \mkbibnameprefix{#3}\isdot}%
     \ifdefvoid{#4}{}
       {\addlowpenspace
        \mkbibnamesuffix{#4}\isdot}}%
} 

\begin{document}
\cite{sigfridsson}
\printbibliography
\end{document}

enter image description here

moewe
  • 175,683