5

I am trying to use babel and biblatex package together but I am getting following error:

! Package biblatex Error: Patching 'babel' package failed.

This is my code example:

\documentclass[12pt,a4paper,twoside,openright]{book}
\usepackage{cmap}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[slovak]{babel}
\usepackage{xpatch}
\usepackage{csquotes}
\usepackage{biblatex}
\begin{document}
\enquote{quote}
\end{document}

I would need the result look like this:

enter image description here

Well, it seems like I could get rid of the error when using xpatch package, but it works only when I delete 'slovak' option for babel package. That way the result look like this:

enter image description here

Please, is there any workaround for this problem? I am really stuck in this.

4
  • 2
    I don't think csquotes are relevant here, this seems to be an interaction between slovak-babel and biblatex – daleif Mar 17 '20 at 15:42
  • 1
    Loading biblatex before babel seems to solve the problem... – Phelype Oleinik Mar 17 '20 at 15:44
  • @PhelypeOleinik yes, you are right, very easy solution, thank you! – Lukáš Maliar Mar 17 '20 at 15:49
  • I guess tex.stackexchange.com/q/529984/35864 is related, but I couldn't get the workaround from there to fly here. Looking into it... – moewe Mar 17 '20 at 15:50
5

It is basically the same as here Document with custom bibliography driver compiling with babel 3.33 and biblatex 3.13a ; but not compiling with most recent package versions. Only that it is not only the hyphen but also the apostroph.

Either disable all shorthands:

\usepackage[slovak,shorthands=off]{babel}

or patch the two offending chars away:

\documentclass[12pt,a4paper,twoside,openright]{book}
\usepackage{cmap}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[slovak]{babel}
\usepackage{etoolbox}
\makeatletter
\newcommand\my@hyphen{-}
\newcommand\my@apostroph{'}
\patchcmd\select@language{-}{\my@hyphen }{}{\fail}
\patchcmd\select@language{'}{\my@apostroph }{}{\fail}
\makeatother

\usepackage{csquotes}
\usepackage{biblatex}
\begin{document}
\enquote{quote}
\end{document}

1
  • Both you and @moewe are probably right but I tried only the solution, which was suggested in comment by PhelypeOleinik - I loaded biblatex package before babel and everything is right :) But very interesting solutions indeed. – Lukáš Maliar Mar 17 '20 at 16:00
5

Update

The recently released biblatex 3.15 now uses proper babel and polyglossia hooks and no longer needs to patch package internals.

That should resolve these issues. The fixes shown below and in Ulrike's answer should no longer be necessary after a biblatex update.

Please update your TeX system if you are experiencing this problem.


This is structurally the same issue as discussed in Document with custom bibliography driver compiling with babel 3.33 and biblatex 3.13a ; but not compiling with most recent package versions. But for Slovak we don't only need to think about the dash (-) but also about the apostrophe (').

\documentclass[12pt,a4paper,twoside,openright]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[slovak]{babel}

\usepackage{csquotes}

\usepackage{etoolbox}
\makeatletter
\newcommand\my@hyphen{-}
\patchcmd\select@language{-}{\my@hyphen }{}{\fail}
\newcommand\my@apo{'}
\patchcmd\select@language{'}{\my@apo }{}{\fail}
\makeatother
\usepackage{biblatex}
\begin{document}
\enquote{quote}
\end{document}

„quote“


The problem here should be resolved in the next biblatex release thanks to https://github.com/plk/biblatex/commit/0f8488545292e01626dd854fee0fed8ab40adc7d and https://github.com/plk/biblatex/commit/06913511f881172a0878cc19a6e5677af5885e74, but we should probably think of a better approach than patching the babel internals so late in \AtBeginDocument. See https://github.com/plk/biblatex/issues/970.

2
  • I was a minute faster ;-) – Ulrike Fischer Mar 17 '20 at 15:57
  • @UlrikeFischer I guess that's because you know what you are doing and I have to experiment before I can find the answer ... – moewe Mar 17 '20 at 16:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.