I think this works:
\makeatletter
\AtEveryCitekey{%
\blx@langsetup\abx@field@hyphenation%
\blx@hyphenreset%
}
\makeatother
In \abx@field@hyphenation
is hyphenation value. Probably it needs some testing, if it is set.
edit:
Some time ago, I was looking at biblatex language switching because of problem with my citation style[1]. I didn't understand this code at all, so I ended with ugly hack[2].
But when I looked yesterday on biblatex's patch of babel you posted, I have found line
\blx@langsetup\languagename\select@language
Function \blx@langsetup
uses edef
to define \blx@languagename
, which is used by macro \blx@hyphenreset
to load hyphenation patterns, and then loads localization strings for given language. So in fact, instead of
\blx@langsetup\abx@field@hyphenation%
it is possible to use just
\edef\blx@languagename{\abx@field@hyphenation}%
Then there is problem with French language. When used as the main document language, instead of
... (Fis-
el 1985)...
there is
...(FISCHEL
1985)...
I think there is issue only with French, I tried Czech, Russian and Spanish and they worked correctly.
With babel
, we can solve this issue with
\select@language\abx@field@hyphenation%
but, polyglossia
in xelatex has same issue and this trick is there not working, I don't know how to fix that.
Anyway, if you don't need French with polyglossia
, this is the current solution
\makeatletter
\AtEveryCitekey{%
\ifcsdef{abx@field@hyphenation}{%
\edef\blx@languagename{\abx@field@hyphenation}%
\select@language\abx@field@hyphenation%
\blx@hyphenreset%
}{}%
}
\makeatother
[1] Biblatex - using two languages in one reference entry
[2] Biblatex - using two languages in one reference entry
Here's a way, but I don't think this can really be useful for long texts.
\documentclass{article}
\usepackage[dutch,ngerman,english]{babel}
\makeatletter
\newcommand{\declarelanguage}{\@dblarg\@declarelanguage}
\def\@declarelanguage[#1]#2{%
\long\@namedef{#2}{%
\edef\@temp{\string#1}%
\ifx\@temp\languagename
\expandafter\@firstofone
\else
\expandafter\@gobble
\fi}%
}
\makeatother
\declarelanguage{dutch}
\declarelanguage[ngerman]{german}
\declarelanguage{english}
\begin{document}
English
\dutch{some dutch text here}
\english{some english text here}
\german{some german text here}
\bigskip
\hrule
\bigskip
German
\selectlanguage{ngerman}
\dutch{some dutch text here}
\english{some english text here}
\german{some german text here}
\bigskip
\hrule
\bigskip
Dutch
\selectlanguage{dutch}
\dutch{some dutch text here}
\english{some english text here}
\german{some german text here}
\end{document}
This will use the active language (according to babel
rules). The \declarelanguage
has an optional argument: a string that matches the babel
language name. Using this it's immaterial what name you use; for example you could say
\declarelanguage[english]{EN}
and use \EN{English text}
for inserting the English text. Take your pick; for German it's necessary.
Note: there's a strange babel
feature: the language string maintained by \languagename
has its first character of category code 12, that's the reason for the mysterious \edef\@tempa{\string#1}
, which make your given string agree with babel
's opinion on the matter.
Best Answer
The bibliography style
natdin
lets users cite and reference pieces according to the German standard "DIN 1505, Parts 2 and 3" (citing from the header ofnatdin.bst
). As such, it shouldn't come as a surprise that you get the German connector particle "und" rather than, say, "and". Changing parameters such as\harvardand
will have no effect whatsoever since thenatdin
bibliography style doesn't use that macro.Assuming you want to stick with
natdin
as your bibliography style and all you want to do is change the connector particle from "und" to "and", you could proceed as follows:Find the file
natdin.bst
on your computer and make a copy, to be called, say,mynatdin.bst
. (Never edit an original file that's part of the TeX distribution directly.)Open
mynatdin.bst
in your favorite text editor and search for the BibTeX function namedund
. (It's on line 181 in my copy of this file.) Given your description, this function is probably set up asChange it to
Next, search for the function
ua.etal
(probably just a few lines up from theund
function). Change it so that it saysSave the file
mynatdin.bst
, either in the directory where your main tex file is located or in a directory that's searched by your TeX distribution. If you choose the latter option, you will probably also need to update/refresh the TeX filename database in an appropriate way.Start using the new bibliography style my issuing the command
in your main tex file. Be sure run LaTeX, BibTeX, and LaTeX twice more to fully update the work of BibTeX and LaTeX.