9

In my .bib-file the language field is filled out in all entries.

As MWE, they all look (as expected) like:

@Collection{Bakker:Grammar,
  editor =   {Egbert J[an] Bakker},
  gender =   {sm},
  title =    {Grammar as Interpretation},
  subtitle = {Greek Literature in its Linguistic Context},
  shorttitle = {Grammar},
  language = {english},
  year =     1997,
  series =   {Mnemosyne. Supplementum},
  number =   171,
  publisher = {Brill},
  location ={Leiden AND New York AND K{\"o}ln}
  }

To print the bibliogeaphy I created this file

\documentclass[paper=a4,twoside,ngerman]{scrartcl}
\usepackage[LGR,T1]{fontenc}
\usepackage[utf8]{inputenc}
\input{ix-utf8enc.dfu}
\usepackage{savesym}
\usepackage{gfsdidot,gfsporson}
\savesymbol{og}
\usepackage[main=ngerman,greek,italian,frenchb,english,british,german]{babel}
\usepackage[GlyphNames,boldLipsian]{teubner}
\savesymbol{breve}
\savesymbol{aa}
\usepackage[osf,sc]{mathpazo}
\restoresymbol{pplj}{breve}
\usepackage{courier}
\usepackage[scaled=.9]{DejaVuSansCondensed}
\Lipsiantrue
\ifFamily{pplj}{porson}
\usepackage{textcase}
\usepackage{textcomp}
\usepackage{xpatch}
\usepackage[pdftex]{hyperref}
\usepackage[style=german, german=guillemets]{csquotes}
\usepackage[style=philosophy-modern, sortlocale=de_DE,
            sorting=nyvt, autolang=hyphen, alldates=terse,
            annotation=true, useprefix=true, language=ngerman,
             datezeros=false,  bibencoding=auto, pagetracker=spread,
             publocformat= loccolonpub, backend=biber, 
             citetracker = constrict, ibidtracker=constrict,
             opcittracker=constrict, idemtracker=constrict,
             relatedformat=parens,  clearlang=true]{biblatex}
\usepackage{moredefs}
\usepackage{lips}
\usepackage{ragged2e}
\usepackage[twothirds,nonegthinspace]{thinsp}
\usepackage[babel]{microtype}
\usepackage{fixltx2e}

After compiling it with biber --bblsafechars mybib and latex mybib.tex I get

Bakker, Egbert J[an]

1997 Hrsg., Grammar as Interpretation. Greek Literature in its Linguistic Context, Englisch, Mnemosyne. Supplementum 171, Leiden, New York und Köln: Brill.

But I don't want LaTeX to print the name of the language ("Englisch" in the example above) but to use it only for hyphenation, and though I've been trying everything I've been trying everything for several months, I only found ways either to put each entry in another otherlanguage-environment (by passing the option babel=other to biblatex) or suppress all infos about the language by putting all known languages in \DeclareRedundantLanguages{ngerman}{german,english,french,italian,british,franconian,vedic,malaysian ...}

Another idea was to change the language-field in the .bib-file to hyphenation, but I still got the name of the language in each entry.

  • biblatex does not use language but hyphenation to determine the hyphenation language, so you need to use the latter field. If you use babel=other, you will have to load the languages in babel though. You might be OK with babel=hyphen. So your best bet is to change the language to hyphenation fields. If you want, there is an automatic solution to map language to hyphenation. – moewe Nov 01 '13 at 19:07
  • On second reading through your post, I'm almost certain that what you want is babel=hyphen and the hyphenation field. Keep in mind that hyphenation takes babel/polyglossia language identifiers such as ngerman, american etc. – moewe Nov 01 '13 at 19:20
  • You are so -- first, I actually wrote babel=hyphen, then biblatex complained and I changed it to autolang=hyphen. But nothing changed, neither with babel=hyphen nor with autolang=hyphen nor after replacing language = with hyphenation = in the .bib-file. So the first step is to map language to hyphenation (how do I do it?), but I don't expect it to solve the problem---at least not even hyphenation instead of language in the (very large: 450 items) .bib-file could prevent Englisch in the example above. – Alexander Wittmann Nov 01 '13 at 19:28
  • In version 2.7 and before you want babel=hyphen, in 2.8 and above it's autolang (though babel still works). The new name for the hyphen field is langid (though, again, the old one should still work). – moewe Nov 01 '13 at 19:36
  • 2
    If you just want to remove the language field, you can do \AtEveryBibitem{\clearlist{language}}. See biblatex remove the eng. from citations – Alan Munn Nov 01 '13 at 19:40
  • Now it works with langid (I didn't know it) for language in the .bib-file! Excellent---but what do I write in the .tex file in order to map the language field to the langid fields in the .tex file? I do not want to rewrite the entire .bib file. – Alexander Wittmann Nov 01 '13 at 19:46
  • There is a way to do that automatically, but one has to be careful with natural language name vs. babel language name. One would normally write language={german}, while it is better to go with hyphenation={ngerman} for new German orthography. – moewe Nov 01 '13 at 20:00
  • I actually wrote language={ngerman} and mapped it to german by writing \DeclareLanguageMapping{german}{ngerman} (I did the same with british and english). How do I automatic mapping??? – Alexander Wittmann Nov 01 '13 at 20:08
  • That's a clever idea! For mapping, see my answer below. – moewe Nov 01 '13 at 20:11

1 Answers1

16

You want biblatex's autolang=hyphen option (formerly known as babel=hyphen). One has to specify the hyphenation language via the langid (formerly [<= 2.7] hyphenation) field.

There is a way to automatically map the language field to the langid field. The following lines in the preamble should be enough to do that.

\DeclareSourcemap{
  \maps{
    \map{
      \step[fieldsource=language, fieldset=langid, origfieldval, final]
      \step[fieldset=language, null]
    }
  }
}

This command will copy the language field into the langid field and will then delete the contents of the language field. The language field will only be deleted if it was successfully copied into the langid field.

The caveats in my comment above still apply: In the language field one can write german or even langlatin and langgerman, while the langid field should take proper babel/polyglossia language identifiers (and only one of those; "The identifier must be a language name known to the babel/polyglossia packages.", §2.2.3, p.24 of the biblatex documentation (v. 2.8)). In particular for entries in new German orthography language should of course be german while langid ought to be ngerman.

See this MWE

\documentclass[ngerman,english]{article}
\usepackage{babel}
\usepackage[autolang=hyphen, backend=biber]{biblatex}
\begin{filecontents}{\jobname.bib}
@Book{vangennep:trans,
  author       = {van Gennep, Arnold},
  title        = {The Rites of Passage},
  year         = 1960,
  translator   = {Vizedom, Monika B. and Caffee, Gabrielle L.},
  language     = {english},
  origlanguage = {french},
  publisher    = {University of Chicago Press},
}
@Book{cicero,
  author       = {Cicero, Marcus Tullius},
  title        = {De natura deorum. {\"U}ber das Wesen der G{\"o}tter},
  date         = 1995,
  editor       = {Blank-Sangmeister, Ursula},
  translator   = {Blank-Sangmeister, Ursula},
  afterword    = {Thraede, Klaus},
  language     = {langlatin and langgerman},
  publisher    = {Reclam},
  location     = {Stuttgart},
  hyphenation  = {german},
}
@book{testbook,
  author        = {Walter Ordsmith},
  title         = {The Work},
  subtitle      = {Subtitle},
  year          = {1983},
  publisher     = {P. Ublisher \& Co.},
  address       = {Townsville},
  language      = {german},
}
@article{testart1,
  author  = {Steven C. Ientist and Paula Rofessor},
  title   = {Thrilling, Intelligent and True Limes of Erudition},
  journal = {Journal of Articles},
  volume  = {20},
  number  = {3},
  year    = {1935},
  pages   = {1--46},
  language= {american},
}
@incollection{ordChap3,
  author     = {Walter Ordsmith and William Riter},
  title      = {A Chapter},
  booktitle  = {The Second Work},
  publisher  = {Academic Press},
  year       = {1977},
  language   = {french},
}

\end{filecontents}

\addbibresource{\jobname.bib}

\DeclareSourcemap{
  \maps{
    \map{
      \step[fieldsource=language, fieldset=langid, origfieldval, final]
      \step[fieldset=language, null]
    }
  }
}

\begin{document}
  \nocite{*}
  \printbibliography
\end{document}

yields enter image description here

moewe
  • 175,683
  • Thank you, but it doesn't work. After the first attempt I even wrote \DeclareSourcemap{ \maps[datatype=biblatex]{ \map{ \step[fieldsource=language, null] \step[fieldset=langid, origfieldval] } } }` I still get Bakker Title, Englisch. Dixsaut, Title, Französisch. – Alexander Wittmann Nov 01 '13 at 20:21
  • @AlexanderWittmann Yep, I missed that, I changed the answer. Does it now do what you want? – moewe Nov 01 '13 at 20:33
  • If I sum it up: If I write langid instead of language, the name of the language is not printed (and the hyphenation rules of the language are probably applied), but neither with the original \DeclareSourceMap ...` code nor with the improved one does anything change. – Alexander Wittmann Nov 01 '13 at 20:33
  • @AlexanderWittmann I made small change again, on my machine it finally does what you want (technically: the files say it does), though I cannot be sure about application of hyphenation rules (I have no proper test cases, I could spot a difference with). – moewe Nov 01 '13 at 20:37
  • Thnkx---one moment. – Alexander Wittmann Nov 01 '13 at 20:40
  • I tried it your example and my file with your code snippe: in your MWE it omits the name of the language (translated into german) only in Ordsmith, The Works (where the language is german). I even changed your code from datatype=bibtextodatatype=biblatexandfieldset=hyphenationtofieldset=langid` (which doesn't work at all), but nothings changes. – Alexander Wittmann Nov 01 '13 at 20:47
  • @AlexanderWittmann datatype=biblatex will not work, it has to be datatype=bibtex (for .bib files at least; since the data file is in BibTeX format). I have included a picture of the output on my machine. I'm running version 2.7a though and not 2.8, so I cannot be sure if the new langid stuff in v. 2.8 breaks any of the above code. I will update the answer as soon as I have tested it with v. 2.8. – moewe Nov 01 '13 at 22:07
  • @AlexanderWittmann I just got my hands on version 2.8 and can assure you that the answer above now does what you want on my PC. – moewe Nov 02 '13 at 08:08
  • Excellent! It does work, no more annoying Deutsch, Englisch, Italienisch ... I don't see whether the hyphenation actually differs from language to language, as nearly no word is broken across the line. You may sell it biblatex – Alexander Wittmann Nov 02 '13 at 17:05
  • The langid is in fact only really used if you specify a non-none value for the autolang option anyway. – PLK Nov 03 '13 at 19:04
  • As, for example, with autolang=hyphen? Is that what you mean? @moewe: BTW: A proof that it sets the entry in the selected language environment without changing the bibliography strings: The string "| in an entry, whose language is english, appears in the pdf! – Alexander Wittmann Nov 03 '13 at 20:24