\nonfrenchspacing
has disappeared. What to do? (I'm using XeLaTeX and polyglossia)Text Formatting ⇒ polyglossia | Associate '\nonfrenchspacing' with a Language
-
- Posts: 132
- Joined: Wed Feb 11, 2009 11:38 pm
polyglossia | Associate '\nonfrenchspacing' with a Language
When I change to another language and back, the effect of
NEW: TikZ book now 40% off at Amazon.com for a short time.

polyglossia | Associate '\nonfrenchspacing' with a Language
This seems to work:
Regards
Code: Select all
\documentclass{scrartcl}
\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage{french}
\begin{document}
non french: text. and more text
\textfrench{french: text. and more text}
non french: text. and more text
\begin{french}
french: text. and more text
\end{french}
non french: text. and more text
\end{document}
site moderator & package author
-
- Posts: 132
- Joined: Wed Feb 11, 2009 11:38 pm
Re: polyglossia | Associate '\nonfrenchspacing' with a Langu
I'm not talking about extra space before cola &c. The effect of \nonfrenchspacing is extra space added after full stops, e.g. \xspaceskip=1em plus .4em minus .2em
polyglossia | Associate '\nonfrenchspacing' with a Language
I know that. That's why I added the fullstop in the example. And as I said: it seems to work. You can see it more clearly here:
Code: Select all
\documentclass{scrartcl}
\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage{french}
\begin{document}
\setlength\parindent{0pt}
non french: text. and more text \\
non french: text.\ and more text
\begin{french}
french: text. and more text \\
french: text.\ and more text
\end{french}
non french: text. and more text \\
non french: text.\ and more text
\end{document}
site moderator & package author
-
- Posts: 132
- Joined: Wed Feb 11, 2009 11:38 pm
polyglossia | Associate '\nonfrenchspacing' with a Language
Oh, sorry. Still, I need it to work with \selectlanguage, since I use need the language (and font) automatically to change when a greek character occurs, with something like
Code: Select all
%Languages and fonts
\newcommand\defaultlanguage{danish}
\setdefaultlanguage{\defaultlanguage}
\setotherlanguage[variant=ancient]{greek}
\setotherlanguage{french}
\setotherlanguage{english}
\setotherlanguage[spelling=old]{german}
\setmainfont[
Numbers=Lowercase,
Mapping=tex-text,
ItalicFont={[caslon.it.otf]}
]{[caslon.otf]}
%\newfontface\longs[Numbers=Lowercase, Ligatures=Rare, Mapping=longs]{[caslon]}
%\newfontface\nolongs[Numbers=Lowercase]{[caslon]}
\newfontfamily\greekfont[Numbers=Lowercase]{[Garamond.otf]}
\def\XeTeXcharclasses[#1-#2]#3{
\newcount\c
\c=#1
\XeTeXcharclass\c=#3
\loop\ifnum\c<#2
\advance\c by 1
\XeTeXcharclass\c=#3
\repeat
}
\XeTeXinterchartokenstate=1
\newXeTeXintercharclass\greekchar
\XeTeXcharclasses["0370-"03FF]\greekchar
\XeTeXcharclasses["1F00-"1FFF]\greekchar
\XeTeXinterchartoks 0 \greekchar {\selectlanguage{greek}\nonfrenchspacing}
\XeTeXinterchartoks 255 \greekchar {\selectlanguage{greek}\nonfrenchspacing}
\XeTeXinterchartoks \greekchar 0 {\selectlanguage{\defaultlanguage}\nonfrenchspacing}
\XeTeXinterchartoks \greekchar 255 {\selectlanguage{\defaultlanguage}\nonfrenchspacing}
\XeTeXinterchartoks \greekchar \french@punctguillend {\selectlanguage{\defaultlanguage}\nonfrenchspacing\nobreakspace}
polyglossia | Associate '\nonfrenchspacing' with a Language
Could you make that a compilable
minimal working example which shows the issue so that I (or any other person willing to help) can experiment with it, please?
Regards

Regards
site moderator & package author
-
- Posts: 132
- Joined: Wed Feb 11, 2009 11:38 pm
polyglossia | Associate '\nonfrenchspacing' with a Language
All right. I want the last line to have a space after the period without having to repeat \nonfrenchspacing
Code: Select all
\documentclass{article}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{german}
\xspaceskip=2em
\nonfrenchspacing
\begin{document}
\obeylines
Quick. Fox
\selectlanguage{german}
Brown. Dog
\selectlanguage{english}
Lazy. Bum
\end{document}
polyglossia | Associate '\nonfrenchspacing' with a Language
IMHO the easiest would be to define a new command which selects the language and sets the correct spacing. Since the package xparse has been by loaded by fontspec which in turn has been loaded by polyglossia you can use its commands:
Regards
Code: Select all
\documentclass{article}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguages{german,french}
% s = star
% m = mandatory argument
\NewDocumentCommand\uselanguage{sm}{%
\selectlanguage{#2}%
% if `star' then set \frenchspacing, else \nonfrenchspacing :
\IfBooleanTF{#1}{\frenchspacing}{\nonfrenchspacing}}
\xspaceskip=2em
\nonfrenchspacing
\begin{document}
\obeylines
Quick. Fox
\uselanguage{german}
Brown. Dog
\uselanguage*{french}
Brown. Dog
\uselanguage{english}
Lazy. Bum
\end{document}
site moderator & package author