1

I am writing a book in Hebrew with bibliography entries in English.

I have some trouble with printing nicely the bibliography with \printbibliography.

I want 3 things:

  1. The heading (or title) of \printbibliography to be רשימת המקורות, aligned from right-to-left
  2. Same Hebrew string to appear in the table of contents
  3. Bibliography entries to be aligned left-to-right

(I have only English bib entries, nothing in Hebrew)

My MWE is the following:

\documentclass[openany,a5paper]{memoir}
\usepackage{hyperref}

\usepackage{polyglossia}
\setdefaultlanguage{hebrew}
\setotherlanguage{english}
\newfontfamily\hebrewfont{Arial}[Script=Hebrew]
\newfontfamily\englishfont{Latin Modern Roman}[Script=Latin, Language=English]

\usepackage[language=english,style=alphabetic]{biblatex}
\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@article{einstein,
    author = "Albert Einstein",
    title = "{Zur Elektrodynamik bewegter K{\"o}rper}. ({German})
    [{On} the electrodynamics of moving bodies]",
    journal = "Annalen der Physik",
    volume = "322",
    number = "10",
    pages = "891--921",
    year = "1905",
    DOI = "http://dx.doi.org/10.1002/andp.19053221004",
    keywords = "physics"
}

@book{dirac,
    title = {The Principles of Quantum Mechanics},
    author = {Paul Adrien Maurice Dirac},
    isbn = {9780198520115},
    series = {International series of monographs on physics},
    year = {1981},
    publisher = {Clarendon Press},
    keywords = {physics}
}
\end{filecontents}

\addbibresource{\jobname.bib}

%\addbibresource{biblio.bib}
\begin{document}
\tableofcontents
\chapter{הקדמה}
להלן כמה ציטוטים: \cite{dirac} וגם \cite{einstein}.

\begin{english}
\printbibliography[title={רשימת המקורות}]
\end{english}

\end{document}

The output is

output 1

The way this should be solved, as it seems to me, is to somehow include a \begin{english} right after TeX types the heading, then list all the cited works, and then finish with \end{english}.

How can I instruct TeX to give the output the way I want it?

0

1 Answer 1

4
+150

Update:

The following appears to work for me in LuaLaTeX, using your font selections. (Which I’m glad to see do not appear to be the ones you will use in the final document.)

\documentclass[openany,a5paper]{memoir}
\tracinglostchars=3
    
\usepackage[nil,
            bidi=basic,
            layout=sectioning.tabular
           ]{babel}
\usepackage{fontspec}

\babelprovide[import=en, onchar=fonts ids]{english}
\babelprovide[import=he, main, onchar=fonts ids]{hebrew}

\defaultfontfeatures{Scale=MatchLowercase, Ligatures=TeX}

\babelfont{rm}
          [Scale=1.0]{Arial}
\babelfont[english]{rm}
          {Latin Modern Roman}

\babeltags{hebrew=hebrew}
\babeltags{english=english}

\usepackage[style=alphabetic, backend=biber]{biblatex}
\usepackage{filecontents}

\usepackage[unicode]{hyperref}

\begin{filecontents}{\jobname.bib}
@article{einstein,
    author = "Albert Einstein",
    title = "{Zur Elektrodynamik bewegter K{\"o}rper}. ({German})
    [{On} the electrodynamics of moving bodies]",
    journal = "Annalen der Physik",
    volume = "322",
    number = "10",
    pages = "891--921",
    year = "1905",
    DOI = "http://dx.doi.org/10.1002/andp.19053221004",
    keywords = "physics",
    langid = {english}
}

@book{dirac,
    title = {The Principles of Quantum Mechanics},
    author = {Paul Adrien Maurice Dirac},
    isbn = {9780198520115},
    series = {International series of monographs on physics},
    year = {1981},
    publisher = {Clarendon Press},
    keywords = {physics},
    langid={english}
}
\end{filecontents}


\addbibresource{\jobname.bib}

%\addbibresource{biblio.bib}
\begin{document}
\tableofcontents
\chapter{הקדמה}
להלן כמה ציטוטים: 
\textenglish{\cite{dirac}} וגם \textenglish{\cite{einstein}}

\begin{english}
\printbibliography[title={\texthebrew{רשימת המקורות}}]
\end{english}

\end{document}

enter image description here

enter image description here

enter image description here

In most contexts, this version will detect when you type in the Latin script and switch languages, eliminating the need for tagging individual words and short phrases within a paragraph, but you will still need to use something like \textenglish{\cite{Einstein}} and an environment around the bibliography page. If you go this route, you probably want to define this as a command, like

\newcommand\ENcite[1]{\foreignlanguage{english}{\cite{#1}}}

There are a couple of things I added to my MWE. \tracinglostchars=3 makes it an error when the font you’re using does not support the language you’re trying to use, instead of failing silently with a warning buried in the log file. The \defaultfontfeatures command (from fontspec) enables a few tweaks, including making the quotation marks in your bibliography entry work and automatically scaling the x-height of your fonts. (You might prefer Scale=MatchUppercase, or a custom value for each font.) The onchar=fonts ids option automatically detects the language you’re typing in and changes font, direction and hyphenation accordingly. (It does not, however, work for \cite.) This version also fixes \texttt and \textsf in multiple languages.

You might also want to add the autolang option to biblatex if you ever do want to add a bibliography entry in Hebrew.

You appear to be using XeLaTeX, which nearly does what you want, if you change the babel setup to

\usepackage[english,
            bidi=default,
            layout=sectioning.tabular
           ]{babel}
\usepackage{fontspec}

\babelprovide[import=he, main]{hebrew}

However, this centers your titles rather than justifying them to the right. You might want to change the style if you go this route (section 6.5 of the memoir manual.)

If you want to stick with polyglossia, a workaround for the problem you had with the bibliography citations failing to display Latin letters is to \setmainfont in addition to \hebrewfont and \englishfont. The alphabetic bibliography style appears to need one.

XeTeX and Polyglossia

In a comment, you clarified that you need to use these two packages. This works for me:

\documentclass[openany,a5paper]{memoir}
\tracinglostchars=3
\usepackage[unicode]{hyperref}

\usepackage{polyglossia}
\setdefaultlanguage{hebrew}
\setotherlanguage{english}

\defaultfontfeatures{Scale=MatchUppercase, Ligatures=TeX}

\setmainfont[Scale=1.0]{Latin Modern Roman}
\newfontfamily\hebrewfont{Arial}[Script=Hebrew]

\usepackage[style=alphabetic, backend=biber, autolang=other]{biblatex}
\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@article{einstein,
    author = "Albert Einstein",
    title = "{Zur Elektrodynamik bewegter K{\"o}rper}. ({German})
    [{On} the electrodynamics of moving bodies]",
    journal = "Annalen der Physik",
    volume = "322",
    number = "10",
    pages = "891--921",
    year = "1905",
    DOI = "http://dx.doi.org/10.1002/andp.19053221004",
    keywords = "physics",
    langid = {english}
}

@book{dirac,
    title = {The Principles of Quantum Mechanics},
    author = {Paul Adrien Maurice Dirac},
    isbn = {9780198520115},
    series = {International series of monographs on physics},
    year = {1981},
    publisher = {Clarendon Press},
    keywords = {physics},
    langid={english}
}
\end{filecontents}


\addbibresource{\jobname.bib}

\begin{document}
\tableofcontents
\chapter{הקדמה}
להלן כמה ציטוטים: 
\textenglish{\cite{dirac}} וגם \textenglish{\cite{einstein}}

\printbibliography[title={רשימת המקורות}]

\end{document}

enter image description here

enter image description here

enter image description here

You’re probably better off picking one font that supports both languages (such as New Computer Modern Book, Arial or DejaVu Sans) and declaring it as both your main font and your Hebrew font. If you don’t, and the bug in your bibliography captions recurs, try

\begin{english}
\printbibliography[title={\hfill\texthebrew{רשימת המקורות}}]
\end{english}

If you have any other problems with a title being flush left instead of flush right, a quick-and-dirty fix is to put a \hfill in front of the text.

8
  • Well this is certainly an advance. But: I am using the Miriam CLM font, which doesn't contain any Latin glyphs and therefore emphasizes the issue here. My output with your modifications is this. I am using style=alphabetic which means typing some additional text for the citation style. Even with the numeric citation style you get the numbers typed in Miram CLM (and not in Latin Modern). And I don't have any "trouble with the citation label running into the text", as you said.
    – tush
    Commented Jan 13, 2022 at 19:07
  • @tush OK, posted a new version.
    – Davislor
    Commented Jan 13, 2022 at 22:02
  • The only thing is that I am constrained to work with XeTeX and not LuaLaTeX.. And with polyglossia and not babel. I should have emphasized it earlier. Sorry!
    – tush
    Commented Jan 13, 2022 at 22:11
  • @tush The only thing that currently doesn’t work in ZeTeX is that it centers some of the titles instead of flushing them right, but in a quick test, adding \setmainfont to the polyglossia version seems to solve your problem with the captions in the bibliography.
    – Davislor
    Commented Jan 13, 2022 at 22:14
  • I am sorry, your edit got me confused. I am not familiar with babel, altogether this is not the package I am about to use. Is this problem of mine could be solved with polyglossia?
    – tush
    Commented Jan 13, 2022 at 22:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .