[Tex/LaTex] Russian and Japanese and biblatex oh the

babelbiblatexcjklanguagesxetex

I'm trying to typeset a book with bibliography entries in English, Russian and Japanese. Getting the bibliography to work right is driving me mad. I have got pretty close (I think) by cobbling together various answers from tex.se, but I'm still a little way away.

I think I have to use biblatex for this. biblatex doesn't support polyglossia so I have to use babel. No problem there. There is some support for Japanese in Babel as per http://oku.edu.mie-u.ac.jp/~okumura/texwiki/?Babel

This is as far as I've got:

\documentclass{article}
\usepackage{xltxtra}
\usepackage[strict,autostyle]{csquotes}
\usepackage[russian,japanese,english]{babel}
\usepackage[babel=other,backend=biber,style=authoryear-icomp]{biblatex}
\usepackage{xeCJK}
\usepackage{fontspec,xunicode}
\defaultfontfeatures{Mapping=tex-text}
\newfontinstance\greekfont{Gentium Plus}
\xeCJKsetup{CJKglue=\hspace{0pt}}
\setCJKmainfont[Scale=MatchUppercase]{Hiragino Mincho Pro}
\setromanfont{Gentium Plus}
\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@article{Bohan1928,
        Author = { ボハン, デ},
        Title = { 過去及び現在に於ける英国教会と正教会 },
        Journal = { 正教時報 },
        Volume = { 17 },
        Edition = { 9 },
        Year = { 1928 },
        Pages = { 5-9 },
        Keywords = {primary},
    Hyphenation = { japanese },
    Language = { japanese }
        }

@article{Dubrovin1906,
        Author = { Дубровин, А. И },
        Title = { Открытое письмо Председателя Главного Совета Союза Русского Народа А. И. Дубровина от 2 декабря 1906 года митрополиту Санкт-Петербургскому Антонию, Первенствующему члену Священного Синода },
        Journal = { Вече },
        Volume = {  },
        Edition = { 97 },
        Year = { 1906 },
        Month = { 7 дек. 1906 },
        Pages = { 1-3 },
        Keywords = {primary},
    Hyphenation = { russian },
    Language = { russian }
        }

@article{Brumbaugh1947,
        Author = { Brumbaugh, Thoburn T },
        Title = { The Protestant Handicap in Japan. },
        Journal = { Christian Century },
        Volume = 64,
        Edition = 23,
        Year = { 1947 },
        Month = { 4 June 1947 },
        Pages = { 708-709 },
        Keywords = {primary},
    Hyphenation = { english },
    Language = { english }
        }
                }
\end{filecontents}

\addbibresource{\jobname.bib}
\begin{document}
\nocite{*}

\printbibliography

\end{document}

Which outputs

References
Brumbaugh, Thoburn T (Apr. 1947). “The Protestant Handicap in Japan.” In: Christian Century 64, pp. 708–709.
Дубровин, А. И (июл. 1906). «Открытое письмо Председателя Главного Совета Союза Русского Народа А. И. Дубровина от 2 декабря 1906 года митрополиту Санкт-Петербургскому Антонию, Первенствующему члену Священного Си- нода». Русский. В: Вече, с. 1—3.
ボハン, デ (1928). ?過去及び現在に於ける英国教会と正教会? japanese. In: 正教時報 17, pp. 5– 9.

There is no support for Japanese in csquotes, so my quotes don't work. Also biblatex seems intent on putting the language tag into the body of the citation, which I don't want, and the auxilliary text ("In:", "pp.") in the Japanese entry is still in English.

Can I get any better than this?

Best Answer

I assume the OP has finished his book by now, but I found a solution and thought I'd share it anyway. With the csquotes package, a custom quote style can be declared with \DeclareQuoteStyle. The undesired "In: " can be removed from all citations using \renewbibmacro{in:}{}, and the page numbers can be omitted only for Japanese entries using the following:

\AtEveryBibitem{%
\iffieldequalstr{langid}{japanese}
      {\DeclareFieldFormat{pages}{#1}} % if true
      {} % if false
}

The output and full code are below.

enter image description here

% !TEX TS-program = xelatex
% !BIB TS-program = biber

\documentclass{article}
\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX}
\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguages{russian}
\usepackage{xeCJK}
\xeCJKsetup{CJKglue=\hspace{0pt}}
\setCJKmainfont[Scale=MatchUppercase]{Hiragino Mincho Pro}
\newfontfamily{\cyrillicfont}{Minion Pro}

\usepackage[strict,autostyle=true]{csquotes}
\DeclareQuoteStyle{japanese}
  {「}
  {」}
  {『}
  {』}
\setquotestyle{japanese}

\usepackage[
    backend=biber,
    language=auto,
    autolang=langname,
    style=authoryear-icomp,
    ]{biblatex}
\renewbibmacro{in:}{} % removes "In:"
\AtEveryBibitem{%
\iffieldequalstr{langid}{japanese}
      {\DeclareFieldFormat{pages}{#1}} % if true
      {} % if false
}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{Bohan1928,
        Author = { ボハン, デ},
        Title = { 過去及び現在に於ける英国教会と正教会 },
        Journal = { 正教時報 },
        Volume = { 17 },
        Edition = { 9 },
        Year = { 1928 },
        Pages = { 5-9 },
        Keywords = {primary},
    langid = { japanese },
%    Language = { japanese }
        }

@article{Dubrovin1906,
        Author = { Дубровин, А. И },
        Title = { Открытое письмо Председателя Главного Совета Союза Русского Народа А. И. Дубровина от 2 декабря 1906 года митрополиту Санкт-Петербургскому Антонию, Первенствующему члену Священного Синода },
        Journal = { Вече },
%        Volume = {  },
        Edition = { 97 },
        Year = { 1906 },
        Month = { 7 дек. 1906 },
        Pages = { 1-3 },
        Keywords = {primary},
    langid = { russian },
%    Language = { russian }
        }

@article{Brumbaugh1947,
        Author = { Brumbaugh, Thoburn T },
        Title = { The Protestant Handicap in Japan. },
        Journal = { Christian Century },
        Volume = 64,
        Edition = 23,
        Year = { 1947 },
        Month = { 4 June 1947 },
        Pages = { 708-709 },
        Keywords = {primary},
    langid = { english },
%    Language = { english }
        }
\end{filecontents}

\addbibresource{\jobname.bib}
\begin{document}

\nocite{*}
\printbibliography

\end{document}