43

This is a followup to Russian and Japanese and biblatex oh my. I've got a lot further now, using the polyglossia-enabled bib latex and writing my own Japanese csquotes and lbx files, but now I'm hitting another problem. It's a bit similar to How to create multilingual (English, Japanese) bibliographies with biblatex, biber and polyglossia, but different.

Japanese and English/Russian bibliography entries have quite different format. Here is an example of what I am trying to achieve:

Aizawa & Kumagai (1983) 相沢英資、熊谷信男編『中新田ハリストス正教会沿革史 開教100周年記念』中新田:中新田ハリストス正教会、1983。

Brower & Lazzerini (1997) Brower, Daniel R. and Edward J. Lazzerini, eds., Russia’s Orient: imperial borderlands and peoples, 1700-1917. Bloomington: Indiana University Press, 1997.

Notice that in the Japanese entry, there is no "and" joining the names (I can manage that in the lbx file) but also that the book title is quoted, and that the authors' names are not reordered or abbreviated but appear in both cases as last-first with no space between them, and no space between the names and "eds." (編)

Can I change the bibliography style on a per-entry basis, and is there anything like a Japanese bibliography style available? (If not, where do I start?)

  • 2
    May be useful: here is a Japanese-style Bibtex BST: keizai.okomeda.net/latex/bib/jep.bst – Simon Cozens Dec 17 '13 at 8:20
  • 4
    Two solutions come to mind – which are both ugly: Just create new entry types (for example japbook and russbook) which can easily be done with biber. Or just have one style where there's a language check for each document type. You will end up with huge a .bbx file but it should be doable this way. – Simifilm Dec 17 '13 at 8:22
  • 1
    At this point I'm pretty sure it's going to be less heartache to typeset the bibitems by hand. – Simon Cozens Dec 18 '13 at 4:34
  • 3
    It is possible to format styles depending on a keyword given in the entry. So, maybe you could use the keywords field and the \ifkeyword{} macro. But, still it will be a lot of work … I tried to do something similar here: tex.stackexchange.com/a/167250/47927 – Jasper Habicht Mar 29 '14 at 19:34
  • 1
    I am interested in finding an answer here. Can you provide more information? For example, the bib-entries for both along with the description what should follow what. You gave the sign for the japanese eds. but that alone is hard for me to find as an untrained reader. – Johannes_B Jun 4 '15 at 15:45
2
+50

General Introduction

This is do-able; but it is not easily doable. So I'm afraid this is not an answer to the question that anyone is going to be able to accept: just a record of the problem. The person to do this would have to understand intimately the conventions of the languages involved, and have at least some idea of how biblatex works, though that isn't any harder than escaping from the Cretan labyrinth -- just follow the thread as it snakes around.

To understand why it's possible, and why it's hard, you need to know a bit about how biblatex works.

At the heart of every biblatex style are three files:

  • One (or more) file(s) with the .lbx extension contain language definitions, such as the appropriate strings for things like "editor", "commentator" (obviously, different in every language), but also macros for producing dates (consider, e.g., the difference between English-English and American-English date conventions).

  • One file .cbx is responsible for generating the in-text citations, such as "[1]" or "(Chuzzlewit 1975)".

  • One file .bbx is responsible for generating the bibliography list.

That is a slight oversimplification, because in some styles there is a close linkage between .cbx and .bbx files, because in some styles the in-text citations are (at least sometimes) more or less identical to the full bibliographical entry. But it's sufficiently accurate to say that the actual printing of the bibliographical data, whether it is done in-text or in a separate bibliography or both, is largely the work of the .bbx files.

For present purposes, let's ignore that complexity. Let's concentrate on the .bbx files.

What a .bbx file looks like

If you look at a .bbx file, you will see a lot of things that look like this:

\DeclareBibliographyDriver{article}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
  \usebibmacro{author/translator+others}%
  \setunit{\printdelim{nametitledelim}}\newblock
  \usebibmacro{title}%
  \newunit
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \newunit\newblock
  \usebibmacro{bytranslator+others}%
  \newunit\newblock
  \printfield{version}%
  \newunit\newblock
  \usebibmacro{in:}%
  \usebibmacro{journal+issuetitle}%
  \newunit
  \usebibmacro{byeditor+others}%
  \newunit
  \usebibmacro{note+pages}%
  \newunit\newblock
  \iftoggle{bbx:isbn}
    {\printfield{issn}}
    {}%
  \newunit\newblock
  \usebibmacro{doi+eprint+url}%
  \newunit\newblock
  \usebibmacro{addendum+pubstate}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \newunit\newblock
  \iftoggle{bbx:related}
    {\usebibmacro{related:init}%
     \usebibmacro{related}}
    {}%
  \usebibmacro{finentry}}

Basically what this does is work systematically through the various "chunks" that make up any bibliographical entry, printing them as appropriate. But note two things. First, the order of those chunks is fixed. And secondly, within each chunk, the driver makes heavy use of \usebibmacro to call subsidiary bits and pieces that deal with the logic within chunks. One of the things they often do is print bibstrings, which are defined in .lbx files: things like "editor" or "translator" or "volume". But where a bibmacro generates output it, like the BibliographyDriver usually does so in an order that is hardwired.

How different languages are handled

Biblatex is able, while sticking with this same driver in every case, to make certain concessions to differences in language: so \bibstring for instance can work out whether to print "editor" or "Herausgeber"; the .lbx files also define some macros which are used to print dates and the like. And it can make (which is really the most important) hyphenation patterns depend on the original language.

But so much is hard baked into the .bbx despatcher system, that the sort of reorganisation that involves fundamentally altering the order of what is printed is tiresome to achieve. There is no "off-the shelf" solution. One can easily say "take your bibstring definitions for Japanese from this file, but your bibstring definitions for English from that one; but you cannot say "take your bibliographic template for English works from this .bbx, but your bibliographic template for Japanese ones from that .bbx. The .bbx files can load others, but in the end there is a single point of entry. From this, the basic structure is hard-baked.

In order to allow the choice of language to have a more than largely superficial effect, therefore, you have to work as follows:

  • Write (or copy) a bibliography driver and/or set of macros for each entrytype and language.
  • Write a mechanism which somehow examines the language and then despatches to the right driver.

I can think of at least two ways to do this, and there are very likely more. One would involve playing with the data before it ever got into Biblatex, while it was in biber, effectively re-writing the entrytypes so that, say, book became book-japanese, and then distinguishing between the book and book-japanese types by providing them with different types. This is suggested in the comments above. There are downsides to that for the user, though, who would have to know and understand the implications, for instance if s/he wanted to have a bibliography divided by type.

The other, which I used when I faced an analogous problem when dealing with cases from different jurisdictions, is to keep a single type, but to make the driver a wrapper whose only job is to examine the relevant field, and then despatch on it, as well as doing bits and pieces of cleanup, leaving it for a set of \bibmacros to do the actual formatting. That produces some rather unlovely code, but it does the job.

But it is key to note, that whichever of these you do, you have to produce a new .bbx, specialised for just the languages you are willing to handle. Even if you just copied definitions from existing and appropriate .bbx file and renamed them as necessary (and I don't know whether, for instance, anyone has even done one for Japanese), you'd still have a great deal of work and testing, because you would find that your source files made heavy use of bibmacros with the same name, but with different definitions, and you'd have to work out which macros were safe to use, and which need specialising, and do all that. Theoretically dull work, but painstaking.

(Often--mostly--the bibmacros are dealing with the sort of obscure corner-cases beloved of those who dictate bibliography rules. They are capable of requiring all sorts of odd little things.)

Could one do this just from Biblatex?

I have nothing to do with maintaining biblatex, but from the outside I don't think one can realistically hold on to one's hat for this to be tidied up in Biblatex in the near future -- even though Biblatex has a really creditable record of being written, as far as possible, to be expandable and adaptable. The problem is that it would not be enough to change drivers by language (that would be fairly simple, I expect): the .bbx files do a lot of work using bibmacros, and those often share names. Some method for putting these macros in different namespaces depending on where they were defined would be needed, when the classic pattern in the existing codebase is for promiscuous redefinition without renaming, and in various ways that approach is cooked in.

Edited to add Also, as moewe points out in the comments, it is hard to conceive of any way of adding this feature that would not cause compatibility problems. A tiny recent change in this direction (designed to remove the parochial assumption that one's first name is also one's given name), simple as it was, hints at the possible problems. And now that Biblatex has a reasonable range of working styles, maintaining compatibility is pretty important.

  • There has been some effort to get a 'multiscript' version of biblatex under way (see github.com/plk/biblatex/issues/416 amongst others). Unfortunately, the project seems to have stalled with the ms branch having received no updates for roughly two years github.com/plk/biblatex/tree/ms. So it seems to be not entirely impossible, but certainly very hard to get this going - from a coding as well as an interface/usability perspective (we can't break backwards-compatibility here). – moewe Mar 19 '17 at 10:09
  • Oh, while we are at it: From time to time it turns out that the current .lbx system alone has great problems with handling certain languages: tex.stackexchange.com/q/356661/35864 So that would also need thorough revision before multiscript can be tackled (again, that is really hard to get right without breaking backwards compatibility). – moewe Mar 19 '17 at 10:12
1

This is to explain how biblatex was used in a cjk TeX system called cwTeX.

First of all, you can see the output here: http://www.econ.ntu.edu.tw/ter/new/index.html?n=2&m=6&l=_c This is a journal published by the Department of Economics, National Taiwan University. Just click on PDF of the first paper (in Chinese), and browse toward the end, you see the section of bibliography in Chinese and English. The bibliography was created by biblatex.

If you are interested, you can take a look at cwTeX here: http://homepage.ntu.edu.tw/~ntut019/cwtex/cwtex.html The system was intended to typeset Chinese, and now is extended to cover cjk, so it can be used to typeset Japanese as well. cwTeX uses pre-processor (written in python) to convert cjk characters, and then use pdflatex to typeset.

For biblatex, we write a pre-processor and also .bbx and .cbx to handle sorting and special requirement of cjk documents. Currently, the .bbx and .cbx is based on authoryear.

We also write pre-processors for index and glossary. cwTeX can also be used with tex4ht. cwTeX was developed by me and my brother. I have used the system to typeset many Chinese textbooks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.