Text Formatting ⇒ Automatic Insertion of unbreakable Space after Guillemets
Re: Automatic Insertion of unbreakable Space after Guillemet
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
- Stefan Kottwitz
- Site Admin
- Posts: 10360
- Joined: Mon Mar 10, 2008 9:44 pm
Automatic Insertion of unbreakable Space after Guillemets
With pdfLaTeX:
Code: Select all
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\begin{document}
«~Text~»
\end{document}
With XeLaTeX:
Code: Select all
\documentclass{article}
\usepackage{fontspec}
\begin{document}
«~Text~»
\end{document}
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Automatic Insertion of unbreakable Space after Guillemets
Code: Select all
% !TeX program = xelatex
\documentclass[11pt,a4paper]{article}
\usepackage{fontspec}
\usepackage{polyglossia}
\setdefaultlanguage{french}
\setmainfont[Ligatures=TeX]{XITS}
\setsansfont[Ligatures=TeX,Scale=MatchLowercase]{Cantarell}
\setmonofont[Ligatures=TeX]{Inconsolata}
\setmathfont[Ligatures=TeX]{XITS Math}
\begin{document}
«Text»: «Text»;
\end{document}
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Automatic Insertion of unbreakable Space after Guillemets
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Automatic Insertion of unbreakable Space after Guillemets
Hm, from a French keyboard I would think that it has keys to produce these characters directly. On my Linux system I just need to hold "Alt Gr" and hit "x" to produce "«". For "»" it's "Alt Gr" together with "y". Doesn't your editor allow a setup to insert these French quote characters directly by replacement?AleCes wrote:[…] But the main issue here is: how do I type them time-effectively into my text, provided that, as you probably know, the French layout does not contain a key for them? […]
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Automatic Insertion of unbreakable Space after Guillemets
Code: Select all
\newcommand{\og}{«}
\newcommand{\fg}{»}
- Johannes_B
- Site Moderator
- Posts: 4182
- Joined: Thu Nov 01, 2012 4:08 pm
Automatic Insertion of unbreakable Space after Guillemets
If this really is common orthography, then there will already be a solution.
And now please consider the following MWE:
Code: Select all
\documentclass{book}
\usepackage{fontspec}
\usepackage{polyglossia}
\setmainlanguage{french}
\usepackage{csquotes}
\begin{document}
This is a \enquote{Test sentence}: My french is a bit rusty.
\end{document}
Code: Select all
\documentclass{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage{csquotes}
\begin{document}
This is a \enquote{Test sentence}: My french is a bit rusty.
\end{document}
Automatic Insertion of unbreakable Space after Guillemets
OK, I'm sorry, you know I'm a rookie, my understanding of Latex is very limited.Johannes_B wrote:Please note something: I had french in school, but this is a long long time ago. I don't know about Stefan or Thorsten. And tough I actually learnt the language. i can't remember for the life of me about the Punctuation rules of the french language. I guess it's the same about the others.
If this really is common orthography, then there will already be a solution.
And now please consider the following MWE:Code: Select all
\documentclass{book} \usepackage{fontspec} \usepackage{polyglossia} \setmainlanguage{french} \usepackage{csquotes} \begin{document} This is a \enquote{Test sentence}: My french is a bit rusty. \end{document}
EDIT: I just read the thread from the beginning, and altough you mentioned french typography your problem description was completely wrong.Code: Select all
\documentclass{book} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage[french]{babel} \usepackage{csquotes} \begin{document} This is a \enquote{Test sentence}: My french is a bit rusty. \end{document}
Now,
\enquote
is could be useful because polyglossya
doesn't make any allowance for French-style quotes but if you use babel
, you won't need it as it enables the commands \og
and \fg
, which respectively open and close the angle quotes and places an unbreakable space respectively after and before the said quotes. The unbreakable space is mandatory in French, does \enquote
do so? Otherwise it won't be any good.- Johannes_B
- Site Moderator
- Posts: 4182
- Joined: Thu Nov 01, 2012 4:08 pm
Re: Automatic Insertion of unbreakable Space after Guillemet
If enquote adds he mandatory space? Try clicking on my given example.
Automatic Insertion of unbreakable Space after Guillemets
I've already done so, of course, before answering you. The problem is, is the space a normal one or an unbreakable one? How can I tell it?Johannes_B wrote:enquote changes the quotes acccording the language.
If enquote adds he mandatory space? Try clicking on my given example.