0

I redefined section, and somehow it screwed up the bibliography title. Here is the MWE:

\documentclass{article}
\usepackage[utf8]{inputenc}

\newcommand{\linia}{\rule{\linewidth}{0.5pt}} \renewcommand{\section}[1]{% \bigskip% {\LARGE\MakeUppercase{#1}}\[-1ex]% \linia\medskip }

\usepackage{biblatex} \addbibresource{sample.bib}

\begin{document} \nocite{*}

\printbibliography

\end{document}

And here is the output:

enter image description here

Vebjorn
  • 1,778

1 Answers1

1

biblatex's default bibliography heading uses \section*{<title>} to typeset the bibliography heading in article-like classes.

The redefinition

\renewcommand{\section}[1]{%
  \bigskip%
  {\LARGE\MakeUppercase{#1}}\\[-1ex]%
  \linia\medskip
}

disables the starred version of \section and thus causes undesirable output.

Either provide a definition that can deal with \section{<title>} and the starred version \section*{<title>} or tell biblatex to use another heading (e.g. \section). The latter can be done in many ways, one would be

\documentclass{article}
\usepackage[utf8]{inputenc}

\newcommand{\linia}{\rule{\linewidth}{0.5pt}} \renewcommand{\section}[1]{% \bigskip% {\LARGE\MakeUppercase{#1}}\[-1ex]% \linia\medskip }

\usepackage{biblatex} \addbibresource{biblatex-examples.bib}

\begin{document} \nocite{sigfridsson}

\printbibliography[heading=bibnumbered] \end{document}

One way to define starred and unstarred versions of your section command that do the same would be to go with (see Defining starred versions of commands (* macro) for more options, especially the xparse/expl3 option if you are using a modern TeX system)

\documentclass{article}
\usepackage[utf8]{inputenc}

\newcommand{\linia}{\rule{\linewidth}{0.5pt}}

\makeatletter \renewcommand{\section}{@ifstar@section@section} \newcommand{@section}[1]{% \bigskip% {\LARGE\MakeUppercase{#1}}\[-1ex]% \linia\medskip } \makeatother

\usepackage{biblatex} \addbibresource{biblatex-examples.bib}

\begin{document} \nocite{*}

\printbibliography \end{document}

moewe
  • 175,683
  • How can I provide a definition that deals with the starred version? – Vebjorn Oct 17 '22 at 07:04
  • 1
    @Vebjorn https://tex.stackexchange.com/q/4386/35864 has a number of ways to define starred commands. But of course you first need to figure out what the command is supposed to do. By default the unstarred sectioning commands are numbered and the starred commands are not numbered. Your definition does not have numbers, so maybe you want starred and unstarred to do the same thing? – moewe Oct 17 '22 at 08:12