4

I'm trying to understand why the following code does not work:

\documentclass[12pt]{book}
\usepackage{polyglossia}
\setdefaultlanguage{french}
\setotherlanguage{english}
\def\col{\begin{english}:\end{english}}
\usepackage{filecontents}

\begin{filecontents*}{library.bib}
@article{Bara2006,
  author = {Bara, Judith},
  title = {{English Citation: entry}},
  year = {2006},
  journal = {Journal of Space},
  pages = {20\col1--20\col12},
}
@article{Baranov2001,
  author = {Jacques, Paul},
  title = {{Citation française : espace}},
  year = {2001},
  journal = {Comptes Rendus sur les Espaces},
  pages = {20:1--20:12},
}
\end{filecontents*}
\usepackage[bibencoding=auto,backend=biber,autolang=other]{biblatex}
\addbibresource{library.bib}
\DefineBibliographyStrings{french}{
    inseries = {dans},
    in = {dans}
}
\begin{document}
\textsc{url:} www. \\
\begin{french}
\textsc{url:} www. \\
\end{french}
\textsc{url:} www. \\
\textsc{url\col} www. \\
C'est un essai. \parencite{Bara2006,Baranov2001}
\printbibliography
\end{document}

If I comment the line \printbibliography, everything runs as expected.

  • 1
    Your \edef\col{...} is no different from \def\col{\begin{english}:\end{english}} – egreg Jan 6 '15 at 9:47
  • I switched to \def, but the problem is still there. – BigDawg Jan 6 '15 at 9:52
4

You want to define \col as a character that's not influenced by the interchar token state; you also want that the English citation is typeset using English rules, that's obtained by setting the hyphenation field.

\documentclass[12pt]{book}
\usepackage{polyglossia}
\setdefaultlanguage{french}
\setotherlanguage{english}

\newcommand\col{\mbox{\XeTeXinterchartokenstate=0 :}}

\usepackage{filecontents}

\begin{filecontents*}{\jobname.bib}
@article{Bara2006,
  author = {Bara, Judith},
  title = {{English Citation: entry}},
  year = {2006},
  journal = {Journal of Space},
  pages = {20\col1--20\col12},
  hyphenation={english},
}
@article{Baranov2001,
  author = {Jacques, Paul},
  title = {{Citation française : espace}},
  year = {2001},
  journal = {Comptes Rendus sur les Espaces},
  pages = {20\col1--20\col12},
}
\end{filecontents*}
\usepackage[bibencoding=auto,backend=biber,autolang=other]{biblatex}
\usepackage{csquotes}
\addbibresource{\jobname.bib}
\DefineBibliographyStrings{french}{
    inseries = {dans},
    in = {dans}
}
\begin{document}
\textsc{url:} www. \\
\begin{french}
\textsc{url:} www. \\
\end{french}
\textsc{url:} www. \\
\textsc{url\col} www. \\
C'est un essai. \parencite{Bara2006,Baranov2001}
\printbibliography
\end{document}

enter image description here

  • The problem with this answer is that here, the bibliography is typeset in French, and so In: should also read Dans :. – BigDawg Jan 6 '15 at 10:12
  • @BigDawg Then don't use hyphenation={english}. – egreg Jan 6 '15 at 10:14
  • Sorry, I was not precise enough. If I simply do this, now an English sentence English Citation: entry, is typeset in French. What I would like is English Citation: entry". Dans : – BigDawg Jan 6 '15 at 10:43
  • @BigDawg Catch 22. Use English Citation\col\ entry in the .bib file. When I say that I dislike French rules for punctuation I know why. – egreg Jan 6 '15 at 10:45

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.