Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm having an issue with French babel. Whenever I use any of the 1\ier{}, 2\ieme{} and so on constructs (to obtain 1er, 2e, etc.), the spacing following it behaves very strangely.

So, for example, if I use:

  • 1\ier asdf then the output in the PDF will be: "1erasdf" (notice the missing space between "er" and "asdf")
  • 1\ier~asdf then the output in the PDF will be: "1er asdf" (with a protected space in between)
  • 1\ier~ asdf then the output in the PDF will be: "1er asdf" (there are two spaces between "er" and "asdf", one protected and one normal; can't display properly here because of SE formatting limitations)

I don't want to use ~ every time I need these constructs (2nd and 3rd examples above), so my question: Is the first example above a bug or a user error? And what is the proper way to avoid such output glitches?

I'm using TeX Live 2009 on Ubuntu 12.04 (with LyX).

share|improve this question
2  
You should: if "premier" precedes a word, it should remain attached to it. –  egreg Feb 23 at 14:20
    
@landroni I've moved my comment. "Hard space" is indeed the same as "non-breaking space" in English (our "espace insécable", ~ in TeX), or at least I've learnt it so. As a side effect, ~ avoids any gobbled space that instead may happen between both words. But I don't understand your last remark: in his comment, egreg is suggesting exactly the same thing as me. –  fpast Feb 23 at 15:24
1  
@fpast Right! @ egreg wasn't explicit in his comment. I mistakenly took it to understand that the first example in the question was correct; he was suggesting that the second was correct, with the protected space (as you did). –  landroni Feb 23 at 15:27
    
@landroni I think you should report it to the french package maintainer. It would be a wise thing to at least use xspace so that a normal space is inserted when there is no punctuation immediately following the superscript. You would still need to write explicit ~ characters based on context when you need a non-breaking space. But as others said, the output you get is the normal TeX behaviour – but babel French is quite user friendly, and I would not expect this as its normal behaviour (but I use custom commands, so I hadn't noticed it). –  ienissei Feb 23 at 16:44
1  
@ienissei See me answer: Daniel Flipo (maintainer of frenchb) recommands to add xspace package in order to handle correctly the space in such case. –  ppr Feb 23 at 17:51

3 Answers 3

up vote 3 down vote accepted

You should add \usepackage{xspace}.

According to the manual of frenchb:

Il est recommandé de profiter des avantages offerts par l’extension xspace (il suffit d’ajouter \usepackage{xspace} dans le préambule) : les espaces suivant les commandes \ier,. . ., \ieres, \ieme, \iemes, \fg et \dots seront respectés sans avoir à les forcer par des {} ou des \ .

share|improve this answer
    
Thanks. Apparently xspace is being discouraged in some circles: tex.stackexchange.com/questions/86565/drawbacks-of-xspace . –  landroni Feb 23 at 17:51
    
Also, it seems that the two recommended usage forms, which avoid unexpected consequences, are: \ier{} or \ier{}~, as appropriate given the context. –  landroni Feb 23 at 18:01
1  
@landroni xspace tries to avoid human errors (to forget \ or {}). And you are right to point out that, in some case, this useful tool could break some code (because it is not easy for an computer to know when you actually doing a mistake). However plenty of packages are coded with the need of xspace package ; frenchb is one of them. To sum up: if you want to use frenchb, you should use xspace also (because frenchb needs xspace to do a good job) : if you do not use any package which needs xspace it is better to not use it. –  ppr Feb 23 at 18:06
1  
@landroni About the recommended usage forms, the manual of frenchb says p.5 "on dispose aussi de \ier \iere \iers \ieres \ieme \iemes pour 1er, 1re, 1ers, 1res, 2e, 2es.". So according to the manual, the recommended formating is 1\ier. Of course, this recommendation assumes you use xspace. If you don't, you should prefer 1\ier{} but it is not what is recommended by the author package. –  ppr Feb 23 at 18:13

In French, you should always use a hard space between an abbreviation and the following word. For example, have a look at "Petites leçons de typographie" by Jacques André, page 34. As such, your second case is the right one: "1er asdf" (with a protected space in between).

The two others are the normal behavior of such (La)TeX commands.

share|improve this answer
    
The TeX FAQ link suggests using 1\ier{} asdf to avoid a "gobbled" space, as does wikibooks. Does this mean that the default definition of \ier{} is incorrect and does NOT take into account the protected, non-breaking space (~) required by French typesetting conventions? –  landroni Feb 23 at 15:38
1  
@landroni Yes and no. No, it does not take into account our typographical conventions. But it can be useful in peculiar cases. For example, in such expressions as le 1\ier{} de la classe, no protected space is required following our conventions, to the contrary of la 1\iere~fois, le 1\ier~jour, etc, but any gobbled space must be avoided all the same. The hard space is necessary only when the abbreviated word refers to the following word. –  fpast Feb 23 at 15:46
    
Ouch! Could you include this last comment in the answer? It seems that the two recommended usage forms are 1\ier{} asdf or 1\ier~asdf, depending on the context; but NOT 1\ier asdf. –  landroni Feb 23 at 15:56
    
@landroni Yes, it's what I meant :-). However, it must be said that the contexts where the non-breaking space is necessary happen much more frequently! So my comment was a complement of my anwer, and as such more fit (I think) as a comment. –  fpast Feb 23 at 16:01
1  
@landroni As you said, it depends on the context. I would say that you should use 1\ier~asdf when asdf's meaning is directly related to 1\ier, and 1\ier{}in all other cases where a space is required directly after 1\ier. –  fpast Feb 23 at 16:22

Changed: Add this to your preamble:

\usepackage{etoolbox} 
\apptocmd{\ier}{~}{}{}
\apptocmd{\iere}{~}{}{}

and similarly for each abbreviated french ordinal. Curiously, frenchb lacks commands for the abbreviations of second(e)(s).

share|improve this answer
    
No xspace please, it's such a pain for the editors if they have to edit your work at any time! Even the package author is not at all happy about its existance. –  tohecz Feb 23 at 14:41
    
I suspect that second(e)(s) are covered by 2\ieme{} and 2\iemes{}. See en.wikibooks.org/wiki/LaTeX/Internationalization#French . –  landroni Feb 23 at 14:42
    
@tohecz: But what to do then? Anyway Frenchb.ldf uses it, but for some reason it has no effect. Isn't it more painful for an editor to have lots of ~ in the document body? –  Bernard Feb 23 at 14:53
1  
1  
@landroni: "Second" and "deuxième" are not synonyms: Writing "second" implies there is no "third". –  Bernard Feb 23 at 15:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.