5

this is again a noob question, and I guess a very generic one. In my French text, I use French quotation marks (the opening one is followed by a non-breaking space, the closing one is preceded by one).

My issue is that those non-breaking spaces are used as regular blank spaces, to adjust the width of a line, which results in uneven spaces between the quotation marks (guillemets) and the quoted text, which is really ugly:

enter image description here

Is there a way to force LaTeX to make those 2 non-breaking spaces the same width at least for a single pair of quotation marks?

EDIT:

I have manually inserted non-breaking spaces at relevant places around punctuation marks:

 les deux jeunes «~Picards~» Michel et Guibert

What bothers me is that those spaces are stretched unevenly. I have to use XeLaTeX,

6
  • 3
    If you use babel french option it should take care of the space around punctuation without you adding any spaces by hand. As you have shown no code it is hard to know what you have done here. – David Carlisle May 7 at 19:29
  • OK, I am not using babel, I am looking it up but it seems incompatible with XeLaTex, which I have to use... I am using polyglossia and inputenc in UTF8. I did not know about automatic spacing for French punctuation, so I inserted a non-breaking space after / before the relevant marks. The spaces are there, it's how those spaces are strecthed unevenly that bothers me – user1940642 May 7 at 19:49
  • 3
    You still have not shown your document or how you have set up french. babel is not incompatible with xelatex, it is the standard latex language support system. but polyglossia is an alternative. Either way you should not be inserting no breaking spaces. – David Carlisle May 7 at 19:57
  • 1
    as Bernard says ~ is the wrong space in any case but all ~ on a line will stretch by the same amount Your image looks like you have a space next to one of the ~ but as you have not provided any code that reproduces the problem, it is hard to say. In any case you should let latex add the spaces. – David Carlisle May 7 at 20:51
  • 2
    note also you should not use inputenc with xelatex (it does nothing other than generate a warning saying that it should not be used) – David Carlisle May 7 at 21:27
10

You can tell babel-french to use «» for the guillemets, but there is also a “command form”.

Note that whether you use spaces after « or before » is immaterial; however, remember “backslash-space” after \fg if you want a space when you use the command form.

\documentclass[a4paper]{article}
\usepackage[french]{babel}
\usepackage{fontspec}

\frenchsetup{og=«,fg=»}

\begin{document}

les deux jeunes «Picards» Michel et Guibert

les deux jeunes « Picards » Michel et Guibert

les deux jeunes \og Picards \fg\ Michel et Guibert

\end{document}

enter image description here

Or you can use polyglossia instead of babel, but in this case there is no “command form”.

\documentclass[a4paper]{article}
\usepackage{fontspec}
\usepackage{polyglossia}

\setmainlanguage{french}

\begin{document}

les deux jeunes «Picards» Michel et Guibert

les deux jeunes « Picards » Michel et Guibert

\end{document}

For completeness, here's with pdflatex.

\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}

% use « and » for guillemets
\frenchsetup{
  og=«,
  fg=»,
}


\begin{document}

les deux jeunes «Picards» Michel et Guibert

les deux jeunes « Picards » Michel et Guibert

les deux jeunes \og Picards \fg\ Michel et Guibert

\end{document}
4
  • Thank you, is it compatible with XeLaTeX (which I have to use)? I am trying to implement the example but I keep getting "! Package babel Error: You haven't defined the language [ yet." (although I have) – user1940642 May 7 at 19:50
  • 1
    @user1940642 I edited to match the XeLaTeX requirement. – egreg May 7 at 20:11
  • Thanks, problem solved! I had all the right things in the preamble, but my manually inserted non-breaking spaces were messing things up! Now that I have deleted them, it looks as it should. – user1940642 May 7 at 20:49
  • The syntax to switch languages in polyglossia isn't compatible with that of babel. Very likely the error you are getting is because of that, because babel works with the 3 main engines (pdf/xe/lua). – Javier Bezos May 15 at 7:49
5

The csquotes package provides the command \enquote that should be of interest to you.

enter image description here

% !TEX TS-program = xelatex
\documentclass{article}
\usepackage{polyglossia} % load 'fontspec' automatically
\setmainlanguage{french}
\usepackage[french=guillemets]{csquotes}

\begin{document}
les deux jeunes \enquote{Picards} Michel et Guibert
\end{document}

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.