Hebrew (right to left) title in biblatex

right-to-left

Is there a way to use Hebrew in the title field of bibliography database, so it might be displayed properly when the bibliography is generated by biblatex? What happens is: the Hebrew text appears correctly (utf8 encoding) but the last world becomes the first.

To give you some context: The rest of the bibliographic citation has latin characters as I'm writing in Italian, but with some Hebrew in the text and in the bibliography.

\documentclass{article}[9pt]
\begin{filecontents*}{Midrash.bib}
@book{frenkelYvnymBvlmvHrvkhny1981a, 
title = {עיונים בעולמו הרוחני של ספור האגדה.}, 
author = {Frenḳel, Yonah.}, 
date = {1981}, 
publisher = {{Hakibuts Hame'uḥad}}, 
location = {{Tel-Aviv}}, 
langid = {hebrew} 
} 
\end{filecontents*}
\usepackage{reledmac} 
\usepackage{fontspec} 
\usepackage{polyglossia} 
\usepackage{wrapfig} 
\setdefaultlanguage{italian} 
\setotherlanguage{hebrew} 
\setmainfont{Times New Roman} 
\usepackage[style=verbose-trad3,doi=false,isbn=false,url=false,eprint=false]{biblatex}
\bibliography{Midrash.bib} 
\Xarrangement[A]{paragraph} 
\begin{document} 
see \cite{frenkelYvnymBvlmvHrvkhny1981a} 
\printbibliography 
\end{document}

The result is shown in the image below:

enter image description here

Thanks!

Best Answer

My understanding is that you have to tell polyglossia what font to use for each language, and when you are using each language.

hebrew bib

Blue is FreeSerif font set as \hebrewfont.

By the time biblatex/biber reads the .bib file, the polyglossia command in the .bib file is already established, because polyglossia has been loaded before biblatex.

The dummy bib ref is just a random snippet from the Wikipedia article on the solar system.

MWE

% !TeX TS-program = lualatex

\documentclass{article}[9pt]
\begin{filecontents*}[overwrite]{Midrash.bib}
    @book{frenkelYvnymBvlmvHrvkhny1981a, 
        title = {\begin{hebrew}עיונים בעולמו הרוחני של סיפור האגדה\end{hebrew}.}, 
        author = {Frenḳel, Yonah.}, 
        date = {1981}, 
        publisher = {{Hakibuts Hame'uḥad}}, 
        location = {{Tel-Aviv}}, 
        langid = {hebrew} 
    } 
    @book{מ,
    title={\begin{hebrew}מערכת השמש\end{hebrew}},
    author={\begin{hebrew}נפטון\end{hebrew}},
    }
\end{filecontents*}
\usepackage{reledmac} 
\usepackage{xcolor}
\usepackage{fontspec} 
\usepackage{polyglossia} 
\usepackage{wrapfig} 
\setdefaultlanguage{italian} 
\setotherlanguage{hebrew} 
\setmainfont{Times New Roman} 
\newfontfamily\hebrewfont{FreeSerif}[Script=Hebrew,Color=blue]
\usepackage[style=verbose-trad3, doi=false,
isbn=false,
url=false,
eprint=false, 
backend=biber
]{biblatex}
\addbibresource{Midrash.bib} 
\Xarrangement[A]{paragraph} 
\begin{document} 
    \section{אבגד -- without environment}
    \section{\begin{hebrew}אבגד \end{hebrew} -- with environment}
            \begin{hebrew}אבגד הוז חטיך כלםמ ןנסע ףפץצ קרשת\end{hebrew}
            
    See \cite{frenkelYvnymBvlmvHrvkhny1981a,מ} 
    \printbibliography 
\end{document}

I used biblatex's \addbibresource command, as well.


Addendum

Babel package

Lualatex can identify scripts by using Unicode algorithms, so explicit markup is not generally needed. (Multiple runs of different scripts diving in and out of the main script, like the Latin texts in the Hebrew-version bibliography, will need markup, for a tidier presentation.)

For a comparison of intermingled languages (ignoring runs), using babel package compiled with lualatex to take advantage of this feature, with Italian as the main language:

italian main

MWE

\documentclass{article}[9pt]
\begin{filecontents*}[overwrite]{\jobname.bib}
    @book{frenkelYvnymBvlmvHrvkhny1981a, 
        title = {עיונים בעולמו הרוחני של סיפור האגדה.}, 
        author = {Frenḳel, Yonah.}, 
        date = {1981}, 
        publisher = {{Hakibuts Hame'uḥad}}, 
        location = {{Tel-Aviv}}, 
        langid = {hebrew} 
    } 
    @book{מ,
    title={מערכת השמש},
    author={נפטון},
    }
\end{filecontents*}
\usepackage{reledmac} 
\usepackage{xcolor}
\usepackage{wrapfig} 
\usepackage{fontspec} 
\usepackage[italian,bidi=basic]{babel}%<--- main language 
\usepackage[autostyle]{csquotes}

\babelfont{rm}{Noto Serif}
\babelfont{sf}{Noto Sans}
\babelfont{tt}{Noto Sans Mono}
\babelprovide[import, onchar=fonts ids]{hebrew}
\babelfont[hebrew]{rm}[Color=blue]{LiberationSerif}

%\makeatletter%workaround to satisfy biblatex parms - not needed
%\newtoggle{blx@lang@captions@english}
%\makeatother

\usepackage[style=verbose-trad3, doi=false,
isbn=false,
url=false,
eprint=false, 
backend=biber
]{biblatex}
\addbibresource{\jobname.bib} 

\Xarrangement[A]{paragraph} 
\begin{document} 
    \section{אבגד}
            אבגד הוז חטיך כלםמ ןנסע ףפץצ קרשת

The cat sat on the mat.

    \section{הוז}
            אבגד הוז the cat חטיך כלםמ ןנסע ףפץצ קרשת
 
            
See \cite{frenkelYvnymBvlmvHrvkhny1981a,מ} 
\printbibliography 
\end{document}

and with Hebrew as the main language:

hebrew main

MWE

\documentclass{article}[9pt]
\begin{filecontents*}[overwrite]{\jobname.bib}
    @book{frenkelYvnymBvlmvHrvkhny1981a, 
        title = {עיונים בעולמו הרוחני של סיפור האגדה.}, 
        author = {Frenḳel, Yonah.}, 
        date = {1981}, 
        publisher = {{Hakibuts Hame'uḥad}}, 
        location = {{Tel-Aviv}}, 
        langid = {hebrew} 
    } 
    @book{מ,
    title={מערכת השמש},
    author={נפטון},
    }
\end{filecontents*}
\usepackage{reledmac} 
\usepackage{xcolor}
\usepackage{wrapfig} 
\usepackage{fontspec} 
\usepackage[bidi=basic]{babel} 
\usepackage[autostyle]{csquotes}

\babelfont{rm}{Noto Serif}
\babelfont{sf}{Noto Sans}
\babelfont{tt}{Noto Sans Mono}
\babelprovide[import, main, onchar=fonts ids]{hebrew}%<-- main language
\babelfont[hebrew]{rm}[Color=blue]{LiberationSerif}

\makeatletter%workaround to satisfy biblatex parms
\newtoggle{blx@lang@captions@english}
\makeatother

\usepackage[style=verbose-trad3, doi=false,
isbn=false,
url=false,
eprint=false, 
backend=biber
]{biblatex}
\addbibresource{\jobname.bib} 

\Xarrangement[A]{paragraph} 
\begin{document} 
    \section{אבגד}
            אבגד הוז חטיך כלםמ ןנסע ףפץצ קרשת

The cat sat on the mat.

    \section{הוז}
            אבגד הוז the cat חטיך כלםמ ןנסע ףפץצ קרשת
 
            
See \cite{frenkelYvnymBvlmvHrvkhny1981a,מ} 
\printbibliography 
\end{document}
Related Question