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'm using polyglossia and lualatex to compile my source, and I am switching languages back and forth inside my document. It looks like polyglossia (or myself), is not doing what it is supposed to do:

\documentclass[12pt]{book}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{french}
\begin{document}
\textsc{url:} www. \\
\begin{french}
\textsc{url:} www. \\
\end{french}
\textsc{url:} www. \\
\end{document}

First line prints "url: www." in English: OK. Second line prints "url : www." in French: OK. Third line prints "url : www." in English: not OK (there should not be a space before the colon).

Am I doing something wrong ? Thank you.

share|improve this question
1  
This seems to be a bug in the experimental support of Polyglossia in LuaLaTeX. I would stay away from Polyglossia if you plan to use LuaLaTeX. By the way, the behavior is correct with XeLaTeX. –  egreg Jun 23 at 8:55
    
Fortunately, my (much larger) project compiles fine with XeLaTeX and the behavior is indeed correct there. I am all ears for a possible LuaLaTeX fix though, since this seems to me it is the only hiccup in the experimental support. For example, \cref{fig} and \cref{chap} correctly switch back to the correct formatting (fig. in English vs. figure in French and chapter in English vs. chapitre in French). –  BigDawg Jun 23 at 9:01
    
The bug is known:github.com/reutenauer/polyglossia/issues/68. The problem seems to be that the deactivation of the frenchspacing with \directlua{polyglossia.desactivate_frpt()} works but affects the whole current paragraph an so can lead to wrong spacing in french parts of this paragraph. –  Ulrike Fischer Jun 23 at 9:10
    
@UlrikeFischer Can you make that an anwser - issuing that \directlua command at the beginning of the paragraph after the french environment fixes the problem, assumning the poster is prepared to have the text in separate paragraphs rather than using `\` –  Andrew Swann Jun 23 at 10:06

2 Answers 2

up vote 3 down vote accepted

You can reset the "nonfrench"-spacing with a \directlua-call. But it will affect the whole paragraph:

\documentclass[12pt]{book}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{french}
\begin{document}
\textsc{url:} www. 

\begin{french}
\textsc{url:} www. 
\end{french}

\directlua{polyglossia.desactivate_frpt()} 
\textsc{url:} www. 

\begin{french}
\textsc{url:} www.
\end{french}
%affects the preceding french too: 
\directlua{polyglossia.desactivate_frpt()}
\textsc{url:} www. 

\end{document}
share|improve this answer

Use babel instead:

\documentclass[12pt]{book}
\usepackage[french,english]{babel}
\begin{document}
\textsc{url:} www. 

\begin{otherlanguage}{french}
\textsc{url:} www. 
\end{otherlanguage}

\textsc{url:} www. 
\end{document}
share|improve this answer

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.