The following BibTeX document is saved in ~/TestBib.bib
.
@book{silberstein,
author = {Shel Silverstein},
title = {The Giving Tree},
year = {1964},
langid = {english}
}
@book{goldberg,
author = {Lea Goldberg},
title = {An Apartment for Rent},
year = {1959},
langid = {hebrew}
}
The following LaTeX document is saved in ~/Test.tex
.
\documentclass{article}
%\usepackage[bidi=basic,hebrew,provide=*]{babel}
%\babelfont{rm}[Renderer=HarfBuzz]{FreeSans}
\usepackage{biblatex}
\addbibresource{TestBib.bib}
\begin{document}
\cite{silberstein}\cite{goldberg}
\printbibliography
\end{document}
When the following commands are executed in the Terminal:
> cd ~
> lualatex Test
> biber Test
> lualatex Test
the file ~/Test.pdf
is generated. When opened in a PDF viewer, the file displays as follows.
If now the two commented lines are uncommented, and the .tex
file is recompiled as above, the resulting .pdf
file displays as follows.
(Note that Hebrew is a right-to-left language.)
Is it possible to set things up in such a way that bibliographic entries whose langid
field is Hebrew would be right aligned with right-to-left text flow, whereas bibliographic entries whose langid
field is English would be left aligned with left-to-right text flow?
For comparison, a similar effect to what I'm after can be accomplished easily using the bidi
package (which requires the xelatex
compiler) as follows.
\documentclass{article}
\usepackage[rldocument]{bidi}
\begin{document}
\begin{thebibliography}{99}
\bibitem LLea Goldberg. \emph{An Apartment for Rent}. 1959
\begin{LTRbibitems}
\bibitem SShel Silverstein. \emph{The Giving Tree}. 1964
\end{LTRbibitems}
\end{thebibliography}
\end{document}
This is a similar question to mine, but the answer given there uses two separate bibliographies, whereas I'm interested in one continuous bibliography.
P.S.
It can be assumed that those bibliographic entries with langid
equal to hebrew
are in Hebrew, and not in English as in the example above. I'm not looking to recreate the right-to-left text flow effect on English text as in the bidi
+xelatex
example above.
I have added an enhancement request to the biblatex
bug tracking so that the issue described in this post can be dealt with easily, flexibly, and naturally by biblatex
.
biblatex
bug tracker. It may be a bug inbabel
rather than inbiblatex
, I'm not sure. I discovered this bug by observing the output of Cicada's code in their answer below, and noticing that it was not as I'd expected.