[Tex/LaTex] Biblatex | list of bibliography doesn’t print year

biblatexbibliographiesbibtexhebrewxetex

I'm writing my final project report in LaTeX and I'm using XeTeX to compile my files, because all the report is in hebrew.

The problem is when I'm trying to print the bibliography (using BibLaTeX, with BibTeX as the backend), the whole bibliography list doesn't contain the year field.

An example

You can see for example that in the 1st reference, after the name Geoff in the first line, I get empty brackets instead of the brackets with the year of the reference inside them.

Compiler: XeTeX
Using also : BiDi, BibLaTeX, BibTeX
Running on Windows 10, using TeXStudio.

Note: The bibliography itself is in English (inside an LTR environment), but the whole report is in hebrew)

document.tex

    \documentclass{report}

% Add XeTeX Packages support for hebrew
\usepackage{polyglossia}
\usepackage{fontspec}
\usepackage{bidi}

% Set BibTeX
\usepackage[backend=bibtex,bibstyle=numeric]{biblatex}
\addbibresource{sources}

% Fonts Support
\setdefaultlanguage{hebrew}
\setotherlanguage{english}
\newfontfamily\hebrewfont[Script=Hebrew]{David}
\let\hebrewfonttt\ttfamily
\setmainfont{David}
\setmonofont{David}
\setsansfont{David}

\title{מסמך בדיקה}
\author{יוצר בדיקה}

\begin{document}
    \maketitle

    \tableofcontents


    % Some Text
    \chapter{בדיקה ראשונה}

    שלום עולם, מה שלום כולם ?
    \nocite{*}


    % References' List
        \begin{LTR}
            \begin{sloppypar}
                \printbibliography[title=Bibliography]
            \end{sloppypar}
        \end{LTR}
\end{document}

sources.bib

@inproceedings{domingos2000mining,
  title={Mining high-speed data streams},
  author={Domingos, Pedro and Hulten, Geoff},
  booktitle={Proceedings of the sixth ACM SIGKDD international conference on Knowledge discovery and data mining},
  pages={71--80},
  year={2000},
  organization={ACM}
}

@article{garcia2010pattern,
    title={Pattern classification with missing data: a review},
    author={Garc{\'\i}a-Laencina, Pedro J and Sancho-G{\'o}mez, Jos{\'e}-Luis and Figueiras-Vidal, An{\'\i}bal R},
    journal={Neural Computing and Applications},
    volume={19},
    number={2},
    pages={263--282},
    year={2010},
    publisher={Springer}
}

Best Answer

This works, but I'm almost sure this is not the way to do it.

\setmainfont, \setsansfont and \setmonofont need to specify the font for English because \normalfontlatin relies on the main document font being a Latin Script (Polyglossia manual, 6).

\newfontfamily\hebrewfont[Script=Hebrew]{Noto Sans Hebrew}
\newfontfamily\hebrewfontsf[Script=Hebrew]{Noto Sans Hebrew}
\newfontfamily\hebrewfonttt[Script=Hebrew]{Noto Sans Hebrew}
\newfontfamily\englishfont[Ligatures=TeX]{Latin Modern Roman}
\setmainfont{Latin Modern Roman}
\setmonofont{Latin Modern Mono}
\setsansfont{Latin Modern Sans}

This may not matter so much if you are using a single font for English and Hebrew, of course.

You need to switch the language to English for the bibliography. This is pretty easy for the entries - just add language=english to Biblatex's options.

\usepackage[backend=biber,bibstyle=numeric,language=english,autolang=langname]{biblatex}

But you need to also ensure this is done for the title of the chapter, if you want that in English.

\printbibliography[title={\textenglish{Bibliography}}]

I also switched the language of the surrounding document to English using

\begin{english}
  ...
\end{english}

However, I had greatest trouble with the numeric labels in the bibliography, which are being taken by default from the Hebrew font. On my machine, this means they are just boxes. To ensure a consistent font for the bibliography, I added

\renewcommand\bibfont{\normalfontlatin}

which is why it matters a lot that this behaves as expected, of course.

I've also added the standard TeX ligatures to the Latin font setup since the bibliography uses things like ``, which won't work otherwise.

The final problem was that \MakeUppercase is then not defined when you switch the language to English. I assume this is a bug in something (Polyglossia?). Anyway, to work around this I created a new command to restore the default definition

\newcommand*\restoreuppercase{%
  \DeclareRobustCommand{\MakeUppercase}[1]{{% from base/latex.ltx
      \def\i{I}\def\j{J}%
      \def\reserved@a####1####2{\let####1####2\reserved@a}%
      \expandafter\reserved@a\@uclclist\reserved@b{\reserved@b\@gobble}%
      \protected@edef\reserved@a{\uppercase{##1}}%
      \reserved@a
    }%
  }%
  \protected@edef\MakeUppercase##1{\MakeUppercase{##1}}%
}

and added \restoreuppercase after starting the english environment and before executing \printbibliography.

The result:

English bibliography in Hebrew document

Complete code:

\begin{filecontents*}{\jobname.bib}
@inproceedings{domingos2000mining,
  title={Mining high-speed data streams},
  author={Domingos, Pedro and Hulten, Geoff},
  booktitle={Proceedings of the sixth ACM SIGKDD international conference on Knowledge discovery and data mining},
  pages={71--80},
  year={2000},
  organization={ACM}
}

@article{garcia2010pattern,
    title={Pattern classification with missing data: a review},
    author={Garc{\'\i}a-Laencina, Pedro J and Sancho-G{\'o}mez, Jos{\'e}-Luis and Figueiras-Vidal, An{\'\i}bal R},
    journal={Neural Computing and Applications},
    volume={19},
    number={2},
    pages={263--282},
    year={2010},
    publisher={Springer}
}
\end{filecontents*}
\documentclass{report}
% % Add XeTeX Packages support for hebrew
\usepackage{polyglossia}% will load fontspec and bidi automatically
% % Set BibTeX
\usepackage[backend=biber,bibstyle=numeric,language=english,autolang=langname]{biblatex}
\addbibresource{\jobname.bib}
% % Font Support
\setdefaultlanguage{hebrew}
\setotherlanguage{english}
\newfontfamily\hebrewfont[Script=Hebrew]{Noto Sans Hebrew}
\newfontfamily\hebrewfontsf[Script=Hebrew]{Noto Sans Hebrew}
\newfontfamily\hebrewfonttt[Script=Hebrew]{Noto Sans Hebrew}
\newfontfamily\englishfont[Ligatures=TeX]{Latin Modern Roman}
\setmainfont{Latin Modern Roman}
\setmonofont{Latin Modern Mono}
\setsansfont{Latin Modern Sans}
\renewcommand\bibfont{\normalfontlatin}
\makeatletter
\newcommand*\restoreuppercase{%
  \DeclareRobustCommand{\MakeUppercase}[1]{{% from base/latex.ltx
      \def\i{I}\def\j{J}%
      \def\reserved@a####1####2{\let####1####2\reserved@a}%
      \expandafter\reserved@a\@uclclist\reserved@b{\reserved@b\@gobble}%
      \protected@edef\reserved@a{\uppercase{##1}}%
      \reserved@a
    }%
  }%
  \protected@edef\MakeUppercase##1{\MakeUppercase{##1}}%
}
\makeatother
\title{מסמך בדיקה}
\author{יוצר בדיקה}

\begin{document}
\maketitle
\tableofcontents
% Some Text
\chapter{בדיקה ראשונה}
שלום עולם, מה שלום כולם ?
\nocite{*}

% References' List
\begin{english}
  \restoreuppercase
  \printbibliography[title={\textenglish{Bibliography}}]
\end{english}
\end{document}

I used Biber, but this may well work with BibTeX as the back-end, if you really don't want to use Biber.

Related Question