Text FormattingAutomatic Insertion of unbreakable Space after Guillemets

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
AleCes
Posts: 286
Joined: Sat Nov 13, 2010 9:54 pm

Automatic Insertion of unbreakable Space after Guillemets

Post by AleCes »

Hi there,

I use the following shortcut in order to get French guillemets.

Code: Select all

\newcommand{\og}{\guillemotleft~}
\newcommand{\fg}{~\guillemotright}
But, I'd like to refine the settings of the right guillemet so that an unbreakable space is added after colons and semicolons.

Minimal working example:

Code: Select all

\documentclass[a4paper, 12pt, openany, draft]{book}
\usepackage{a4wide}
\usepackage{fontspec}
\usepackage{paralist}
\defaultfontfeatures{Mapping=tex-text}
\setmainfont{Tinos}
\usepackage{polyglossia}
\setmainlanguage{french}
\setotherlanguages{dutch, english, german, latin, italian, spanish}
\setotherlanguage[variant=ancient]{greek}
\usepackage{xunicode}
\usepackage{xltxtra}
\usepackage{bookmark}
\setcounter{tocdepth}{1}
\raggedbottom
\usepackage{soul}
\newfontfamily\greekfont[Script=Greek]{Tinos}
\newcommand{\og}{\guillemotleft~}
\newcommand{\fg}{~\guillemotright}
\usepackage{enumitem}
\setenumerate{nolistsep}
\setitemize{nolistsep, label=$-$}
\usepackage{footmisc}


\makeatletter
	\long \def \@makefntext #1%
		{%
			\noindent 
			\makebox [25pt][r]{\@thefnmark.\,}#1%
      	}
\makeatother

\renewcommand*\thesection{\arabic{section}}
\usepackage{fancyhdr}


\renewcommand{\sectionmark}[1]{\markright{#1}}

\usepackage{titlesec}
\setcounter{secnumdepth}{4}
\renewcommand*{\thesection}{\arabic{section}}
\renewcommand*{\thesubsubsection}{\alph{subsubsection}}
\titleformat{\subsection}[runin]{\normalfont\bfseries}{\thesubsection}{0.5em}{}[\quad]
\titleformat{\subsubsection}[runin]{\normalfont\bfseries}{\thesubsubsection)}{0.5em}{}[\qquad]

\usepackage{tocvsec2}

\usepackage{chngcntr}

\begin{document}

Bla bla bla \og bla bla bla \fg: bla bla bla \og bla bla bla \fg; bla bla bla.

\end{document}
Thanks for your help.

Recommended reading 2024:

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

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

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Automatic Insertion of unbreakable Space after Guillemets

Post by localghost »

Your example is far from being minimal. It contains much code that is for sure not necessary to reproduce the problem. So just don't call it an MWE then, as other users might learn wrong requirements regarding proper minimal examples.

Furthermore with a4wide you are still using an obsolete package. Users who copy this code (especially beginners) will use bad code and spread it without knowing. And this package is also not necessary to reproduce the misbehaviour. As a side note, migrating a document to the geometry package is no sorcery. You have been told so in many former posts. So you better report back with a proper minimal example.


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

Automatic Insertion of unbreakable Space after Guillemets

Post by AleCes »

OK, sorry for my laziness. :? Now that you're telling me I remember we discussed the issue of abandoning a4wide in favor of geometry but I cannot remember exactly where. Whatever. The proposed migration had stalled because geometry does not support by default wider margins, I know I could insert them manually but it kind of defeats the purpose of migration if things get harder rather than easier.

Back to the minimal example, I thought inserting all of the code could be useful in order to detect likely conflicts with other packages.

However, what about that?

Code: Select all

    \documentclass[a4paper, 12pt, openany, draft]{book}
    \usepackage{fontspec}
    \defaultfontfeatures{Mapping=tex-text}
    \setmainfont{Tinos}
    \usepackage{xunicode}
    \usepackage{xltxtra}

    \begin{document}

    Bla bla bla \og bla bla bla \fg: bla bla bla \og bla bla bla \fg; bla bla bla.

    \end{document}
Regards
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Automatic Insertion of unbreakable Space after Guillemets

Post by localghost »

[…] The proposed migration had stalled because geometry does not support by default wider margins, I know I could insert them manually but it kind of defeats the purpose of migration if things get harder rather than easier. […]
As you have also been told earlier, simply reading the package manual will show you how to do this. And if you need help with migration, just ask targeted questions (of course in a separate thread) instead of beating around the bush.
AleCes wrote:[…] Back to the minimal example, I thought inserting all of the code could be useful in order to detect likely conflicts with other packages. […]
This reveals that you didn't read any of the explanations that are given on the sites I linked in my previous post(s) not only here. These links were not supposed to be only decoration for my posts.
AleCes wrote:[…] However, what about that?[…]
Together with the definitions for the commands \gf and \og in the earlier code snippets it comes quite close.

Regarding your problem, I don't have the impression that your code reproduces the problem with just one single line of output where there is no line break. That's one more point on the list of reasons why this is not a proper minimal example. At the moment you don't enable us to help you efficiently. I installed the Tinos font and I'm not able to comprehend the problem.

Furthermore the title of the topic and your problem description in the initial post seem to contradict. The title is about unbreakable space after the guillemets. The body text of your initial post talks about these unbreakable spaces after colons or semicolons. That's a fundamental difference and causes confusion. So you should clarify what is desired finally.
AleCes
Posts: 286
Joined: Sat Nov 13, 2010 9:54 pm

Automatic Insertion of unbreakable Space after Guillemets

Post by AleCes »

About the migration to geometry:
Beating around the bush? Hey, you started blaming me for using an obsolete package. And yeah, I read the manual through but I didn't manage to find some quick option that might give me the same layout rendering as a4wide. But, please don't answer this here, I've opened a new topic about this so that we can finally solve it.

About the minimal example:
You're right, I cut down too much:

Code: Select all

\documentclass[a4paper, 12pt, openany, draft]{book}
\usepackage{fontspec}
\defaultfontfeatures{Mapping=tex-text}
\setmainfont{Tinos}
\usepackage{xunicode}
\usepackage{xltxtra}

\newcommand{\og}{\guillemotleft~}
\newcommand{\fg}{~\guillemotright}

\begin{document}
  Bla bla bla \og bla bla bla \fg: bla bla bla \og bla bla bla \fg; bla bla bla.
\end{document}
About the explanation of the problem:
I'm sorry if my explanation was confusing, but, no, the accent is not on the unbreakable, but rather on the space itself. In French typography an (unbreakable) space is mandatory after colons and semicolons, so, while having a line break is good because it shows that the colons "stick" to the guillemet, the real issue is having this space added at all after the guillemet, that this space must be insecable is just a detail. The core issue is having LaTeX understand the combination \fg: and \fg; must be rendered as \fg~: and \fg~;

Hope it may help. Thanks for your patience, I know I'm a lazy user of LaTeX, but, hey, that's forums are for, to help rookies.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Automatic Insertion of unbreakable Space after Guillemets

Post by localghost »

AleCes wrote:[…] I'm sorry if my explanation was confusing, but, no, the accent is not on the unbreakable, but rather on the space itself. In French typography an (unbreakable) space is mandatory after colons and semicolons, so, while having a line break is good because it shows that the colons "stick" to the guillemet, the real issue is having this space added at all after the guillemet, that this space must be insecable is just a detail. The core issue is having LaTeX understand the combination \fg: and \fg; must be rendered as \fg~: and \fg~; […]
Perhaps I'm missing something, but your new commands do absolutely nothing in regard to unbreakable spaces after a colon or semicolon. They only provide you with spaces inside guillemets so that \og quote \fg renders to « quote » in the output. An unbreakable space after a colon or semicolon would simply mean to type :~Continung text \ldots or ;~Continung text \ldots in the source to obtain ; Continuing text … or ; Continuing text … respectively.

Regarding automatism, is there nothing like \frenchspacing described in the polyglossia manual? I didn't search for that yet so I don't know at the moment.
AleCes wrote:[…] Thanks for your patience, I know I'm a lazy user of LaTeX, but, hey, that's forums are for, to help rookies.
That's true, but forums are not supposed to support laziness.
AleCes
Posts: 286
Joined: Sat Nov 13, 2010 9:54 pm

Automatic Insertion of unbreakable Space after Guillemets

Post by AleCes »

Perhaps I'm missing something, but your new commands do absolutely nothing in regard to unbreakable spaces after a colon or semicolon. They only provide you with spaces inside guillemets so that \og quote \fg renders to « quote » in the output. An unbreakable space after a colon or semicolon would simply mean to type :~Continung text \ldots or ;~Continung text \ldots in the source to obtain ; Continuing text … or ; Continuing text … respectively.
Indeed, it doesn't. That's why I asked for your help. But please notice that the insecable space is to be put after the guillemet, not after the colon/semicolon.
Regarding automatism, is there nothing like \frenchspacing described in the polyglossia manual? I didn't search for that yet so I don't know at the moment.
Yes, it does but not after guillemets. As a matter of fact, polyglossia doesn't even provide for guillemets in French; generally speaking, it is severely lacking as far as French support is concerned, I had to ask around for somebody to extract from babel the code supporting guillemets (the one we're talking about), French-style lists and footnotes.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Automatic Insertion of unbreakable Space after Guillemets

Post by localghost »

AleCes wrote:[…] Indeed, it doesn't. That's why I asked for your help. But please notice that the insecable space is to be put after the guillemet, not after the colon/semicolon.[…]
This is why I am confused (see my remarks about the contradiction between topic title and problem description). It should read that you want this space between the (closing) guillemets and the colon or semicolon. If so, you just have to modify your command definitions.

Code: Select all

\newcommand{\og}{~\guillemotleft}
\newcommand{\fg}{\guillemotright~}
For your source code this means that you have to type \fg;, but \fg ; should also do.
AleCes
Posts: 286
Joined: Sat Nov 13, 2010 9:54 pm

Automatic Insertion of unbreakable Space after Guillemets

Post by AleCes »

localghost wrote:
AleCes wrote:[…] Indeed, it doesn't. That's why I asked for your help. But please notice that the insecable space is to be put after the guillemet, not after the colon/semicolon.[…]
This is why I am confused (see my remarks about the contradiction between topic title and problem description). It should read that you want this space between the (closing) guillemets and the colon or semicolon. If so, you just have to modify your command definitions.

Code: Select all

\newcommand{\og}{~\guillemotleft}
\newcommand{\fg}{\guillemotright~}
For your source code this means that you have to type \fg;, but \fg ; should also do.
The title reads "Automatic Insertion of unbreakable Space after Guillemet", I couldn't add "after colon/semicolon", because I'd exhausted the number of words that can fit in the title.
Default command definitions cannot be changed because, for instance, \fg. (guillement+point) must not be followed by an (insecable) space, but while we're at it, I realize that interrogation and exclamation marks behave exactly as colons and semicolons.
Now, I know I could manually type \fg ; \fg\ ? or \fg~!, but I'm accustomed not to insert that space, even after normal words bla; bla, that's how it works with babel or even in LibreOffice, the word processor thinks about it, I don't want to do it every time, it's too boring. I want LaTeX to insert that insecable space automatically.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Re: Automatic Insertion of unbreakable Space after Guillemet

Post by localghost »

Too bad. So I see no other solution than manual intervention.
Post Reply