[Tex/LaTex] Problem with patching babel package

babelbiblatexpatching

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.

Best Answer

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}

Related Question