Text FormattingAutomatic Insertion of unbreakable Space after Guillemets

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Automatic Insertion of unbreakable Space after Guillemets

Post by Johannes_B »

Ok, you made me curious and i have to admit: the documentation of polyglossia could be better for french. But in the introduction it says:
polyglossia wrote:Adjusting some typographical conventions according to the current language (such as afterindent, frenchindent, spaces before or after punctuation marks, etc.)
I updated my example, and Im pretty sure everything works as expected. Change the length-value and take look at the behaviour of the punctuation symbols.

Code: Select all

\documentclass{book}

\usepackage{fontspec}
\usepackage{polyglossia}
\setmainlanguage{french}
\usepackage{csquotes}

\begin{document}
\fbox{\parbox{4.10cm}{
This is a \enquote{Test sentence} : My french is a bit rusty.\\
This is a Test sentence: My french is a bit rusty. \\
This is a «Test sentence»: My french is a bit rusty.
}}
\end{document}
Just for completion, the (almost) same with babel for use with pdflatex:

Code: Select all

\documentclass{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage{csquotes}
\begin{document}
\fbox{\parbox{4.00cm}{
This is a \enquote{Test sentence} : My french is a bit rusty.\\
This is a Test sentence: My french is a bit rusty. \\
This is a «Test sentence»: My french is a bit rusty.
}}
\end{document}
Please note the difference in the third line, babel/pdflatex does not insert those white spaces inside the quotation marks like polyglossia/xelatex does.


Just for comparison:
This is XeTeX, Version 3.1415926-2.4-0.9998 (TeX Live 2012)
polyglossia.sty 2012/04/29 v1.2.1 Babel replacement for XeLaTeX
csquotes.sty 2011/10/22 v5.1d context-sensitive quotations
Last edited by cgnieder on Sat Jun 08, 2013 3:05 pm, edited 1 time in total.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

AleCes
Posts: 286
Joined: Sat Nov 13, 2010 9:54 pm

Automatic Insertion of unbreakable Space after Guillemets

Post by AleCes »

You don't have to bother with babel because it has a wonderful implementation of French typography, which is very quirky and different than the others (the most relevant issues are the special format of footnotes and the insertion of unbreakable spaces before colon, semicolon, interrogation mark and exclamation mark).

As for polyglossia, again, are you sure those spaces are unbreakable? Is there a way to check it? Please, let me know. I tried with copy/paste from the pdf to LibreOffice Writer and I couldn't see the peculiar grey colour which is the hallmark of unbreakable spaces.
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Automatic Insertion of unbreakable Space after Guillemets

Post by Johannes_B »

I just checked the language definition file gloss-french.ldf:

Code: Select all

    \XeTeXinterchartoks \french@punctguillend \french@punctthick = {\nobreakspace}% "»:" -> "» :"
Things like that ensure the right typesetting done by XeTeX. And as you can see, there clearly is a \nobreakspace.

But this really has nothing to do with copying from pdf to something else.
@all: Please correct me if I'm wrong.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
AleCes
Posts: 286
Joined: Sat Nov 13, 2010 9:54 pm

Automatic Insertion of unbreakable Space after Guillemets

Post by AleCes »

Johannes_B wrote:I just checked the language definition file gloss-french.ldf:

Code: Select all

    \XeTeXinterchartoks \french@punctguillend \french@punctthick = {\nobreakspace}% "»:" -> "» :"
Things like that ensure the right typesetting done by XeTeX. And as you can see, there clearly is a \nobreakspace.

But this really has nothing to do with copying from pdf to something else.
@all: Please correct me if I'm wrong.
OK Johannes, good to know, thanks for your help. But I thought by copying/pasting from a pdf, unbreakable spaces would be lost in the process.
Post Reply