Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I work on a document (XeLaTeX), where many mixed language collections are cited. Using biblatex I can make use of the hyphenation field to switch between different languages (although the babel-option doesn't work completely with the polyglossia package, but that's another story).

However, due to the publishing guidelines I need both information: the language of the article itself as well as the language of the collected work. Therefore I add an inheritance rule to biblatex.

\DeclareDataInheritance{collection}{incollection}{
   \inherit{hyphenation}{bookhyphenation}}%

This rule is correctly transferred into the "biblatex control file" (bcf):

<bcf:inherit>
  <bcf:type_pair source="collection" target="incollection"/>
  <bcf:field source="hyphenation" target="bookhyphenation"/>
</bcf:inherit>

I then want to look for different field values with \iffieldundef. In order to show the problem I tried to create an example by adding a \newbibmacro and modifiying the bibliography driver.

\newbibmacro*{printhyphenation}{%
   \iffieldundef{bookhyphenation}{No book hyphenation field}{Book hyphenation: \printfield{bookhyphenation}}%
   \addcomma\space
   \iffieldundef{hyphenation}{No hyphenation field}{Hyphenation: \printfield{hyphenation}}%
}

\DeclareBibliographyDriver{incollection}{%
   \usebibmacro{bibindex}%
   \usebibmacro{begentry}%
   \usebibmacro{author/translator+others}%
   \setunit{\labelnamepunct}\newblock%
   \usebibmacro{title}%
   \addcomma\space
   \usebibmacro{printhyphenation}
}

As you can see from the resulting PDF the book hyphenation field is always empty, so no complex if-clauses etc. are possible.

Does anyone have an idea how to solve my problem?

\begin{filecontents}{\jobname.bib}
   @collection{A,
      title = {Title},
      editor = {Y, X},
      hyphenation = {english}
   }
   @incollection{B,
      crossref = {A},
      title = {Title},
      author = {B, A},
      hyphenation = {german}
   }
\end{filecontents}

\documentclass{scrbook}
\usepackage{polyglossia} %XeLaTeX document
\setdefaultlanguage{english}
\setotherlanguage[spelling=new,latesthyphen,babelshorthands]{german}

\usepackage[autostyle,babel]{csquotes}
\usepackage[style=authoryear-comp,babel=other,backend=biber]{biblatex}
% Add an inheritance rule
\DeclareDataInheritance{collection}{incollection}{
\inherit{hyphenation}{bookhyphenation}}%

\addbibresource{\jobname}

\newbibmacro*{printhyphenation}{%
   \iffieldundef{bookhyphenation}{No book hyphenation field}{Book hyphenation: \printfield{bookhyphenation}}%
   \addcomma\space
   \iffieldundef{hyphenation}{No hyphenation field}{Hyphenation: \printfield{hyphenation}}%
}

\DeclareBibliographyDriver{incollection}{%
   \usebibmacro{bibindex}%
   \usebibmacro{begentry}%
   \usebibmacro{author/translator+others}%
   \setunit{\labelnamepunct}\newblock%
   \usebibmacro{title}%
   \addcomma\space
   \usebibmacro{printhyphenation}
}    

\begin{document}
foo \cite{B} bar \cite{A}

\printbibliography
\end{document}
share|improve this question
3  
bookhyphenation isn't a field in biblatex's data model. Recognized fields are listed in the manual's database guide. You could use hyphenation or one of the custom fields (e.g. usera, userb, etc.) instead. –  Audrey May 2 '12 at 13:26
    
I might be mad, but I thought that if one was trying to have some record of the language which would be used in output, the "correct" thing was to place that in the language datafield (which is a list, I think, and can therefore accommodate collections with multiple languages). Hyphenation is intended to assist internally in setting a particular entry's details, not for external consumption. If your collections are mixed language, you surely need a field that can accommodate more than one language. –  Paul Stanley May 2 '12 at 15:40
2  
Yes, it will appear in the .bcf but biber will ignore it when processing inheritance because bookhyphenation is not a valid biblatex data field. You could inherit it as usera etc. and check it there though. In the future, the data model will be user-definable. This is already possible in biber which uses a modular data model already internally. biblatex will get an interface to this soon. –  PLK May 2 '12 at 16:28
    
@PaulStanley The language field sums up the used languages of a work, but for getting different lanuage-dependent terms like "editor" vs. "Herausgeber" or "volume" vs. "Band" the hyphenation field is used via the babel-option. Therefore I tried to use "bookhyphenation" to continue this concept. I will now try "usera" as suggested. –  Martin May 3 '12 at 8:17
    
@Martin I see. But that may be trickier, because you'll not only need to inherit that field, but also tell biblatex how to use it. So you'll need to fiddle with internals to tell biblatex to use the hyphenation language for some purposes, and usera for others. If most language-specific stuff usually comes from the book, not the component sub-part, you may be better off setting hyphenation from the main book, since usera may well be only really important in titles and names. –  Paul Stanley May 3 '12 at 10:50
show 2 more comments

1 Answer

@Audrey @PLK Using usera instead of bookhyphenation indeed fixes the problem.

Thank you very much.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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