5

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}
}
24
  • 2
    Welcome, we need to see a minimal working eample to reproduce that.
    – Johannes_B
    Commented Aug 7, 2016 at 9:36
  • 2
    As Johannes says, without an MWE we can resort only to guessing since there are too many variables we don't know about. Please consider adding an MWE to your question. It need not be so long that it reproduces the entire picture above, one or two entries will be more than enough.
    – moewe
    Commented Aug 7, 2016 at 11:54
  • 1
    If the file really is minimal you should be able to just copy the plaintext here, just edit your answer to include it. I'm very wary of zip files on the internet and am not very keen to download the file from some file sharing website.
    – moewe
    Commented Aug 7, 2016 at 15:26
  • 1
    It is not switching languages for the bibliography because it is still trying to use Hebrew. I can tell because I get nothing but boxes since the fonts I have for Hebrew, unlike David, do not include the Latin alphabet.
    – cfr
    Commented Aug 7, 2016 at 20:34
  • 1
    There aren't many hebrew LaTeX users currently, and without nowledge of the script, development is very very slow. You can help other hebrew writers by providing some help to biblatex and poluglossia. It will be appreciated by other hebrew writers. :-)
    – Johannes_B
    Commented Aug 8, 2016 at 6:29

1 Answer 1

1

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.

2
  • You don't need to "Environment" the \printbibliography with "english" because the biblatex does that automatically. Commented Aug 8, 2016 at 6:37
  • 1
    @bar_boko I got the chapter title misaligned when I didn't use the environment, I think. That is, it was right aligned rather than left.
    – cfr
    Commented Aug 8, 2016 at 14:44

You must log in to answer this question.

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