5

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).

landroni
  • 1,333
  • 2
    You should: if "premier" precedes a word, it should remain attached to it. – egreg Feb 23 '14 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. – Franck Pastor Feb 23 '14 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 '14 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 '14 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 '14 at 17:51
  • Try 1\ier{} asdf or 1\up{er} asdf or use the xspace package. – Paul Gaborit Feb 23 '14 at 21:40

3 Answers3

6

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 \ .

ppr
  • 8,994
  • Thanks. Apparently xspace is being discouraged in some circles: http://tex.stackexchange.com/questions/86565/drawbacks-of-xspace . – landroni Feb 23 '14 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 '14 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 '14 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 '14 at 18:13
3

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.

David Carlisle
  • 757,742
Franck Pastor
  • 18,756
  • 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 '14 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. – Franck Pastor Feb 23 '14 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 '14 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. – Franck Pastor Feb 23 '14 at 16:01
  • @landroni To complete the confusion, you may notice that neither {} nor ~ are required in expressions such as Il y a le 1\ier, et il y a les autres. The presence of the comma makes \ier{} useless and \ier~ nefast as it introduces an undesired space :-) – Franck Pastor Feb 23 '14 at 16:06
  • I hesitate to accept your answer since as it stands it feels incomplete (as per my tastes): the 1\ier{} asdf vs 1\ier~asdf bit is crucial. :) As for 1\ier,, the 1\ier{}, is fine but 1\ier~, will result in a typographical error. So {} is not necessary, but ~ is a mistake.

    In this sense, it seems to me that the only two recommended usage forms should be: \ier{} or \ier{}~. The {} should be used at all times, to avoid unintended behaviour.

    – landroni Feb 23 '14 at 16:11
  • But is that good writing to use an abbreviation as a noun, and moreover, the abbraviation of an ordinal adjective? – Bernard Feb 23 '14 at 16:12
  • 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. – Franck Pastor Feb 23 '14 at 16:22
  • @fpast Other than more typing involved, are there any potential drawbacks with using \ier{}~ instead? – landroni Feb 23 '14 at 16:25
  • @Bernard I don't think so either, and yet it is what the writer desires sometimes (I must often typeset other's texts and follow their whims). In this case I prefer to limit the damages. :-) – Franck Pastor Feb 23 '14 at 16:27
  • @landroni No, but I wouldn't see the point in doing this. – Franck Pastor Feb 23 '14 at 16:31
  • @fpast Well, I was vaguely planning to come up with a LyX module for all these constructs, and I wanted to make sure that \ier{} as a baseline construct is most appropriate, and that adding a protected space \ier{}~ wouldn't break things for users. – landroni Feb 23 '14 at 16:34
  • @fpast I would write Il y a le premier, et il y a les autres. – egreg Feb 23 '14 at 17:10
  • @egreg Me too in fact, but as I said not every French-speaking person is keen to follow « le bon usage de la langue française »… – Franck Pastor Feb 23 '14 at 17:55
1

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).

Bernard
  • 271,350
  • 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. – yo' Feb 23 '14 at 14:41
  • I suspect that second(e)(s) are covered by 2\ieme{} and 2\iemes{}. See https://en.wikibooks.org/wiki/LaTeX/Internationalization#French . – landroni Feb 23 '14 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 '14 at 14:53
  • 1
    @Bernard See http://tex.stackexchange.com/questions/86565/drawbacks-of-xspace – yo' Feb 23 '14 at 15:01
  • 1
    @landroni: "Second" and "deuxième" are not synonyms: Writing "second" implies there is no "third". – Bernard Feb 23 '14 at 15:18
  • @tohecz: I modified my answer to take you remark into account. – Bernard Feb 23 '14 at 15:24
  • Unfortunately this solution breaks things if you use \ier{} or if you have \ier. constructs in your LaTeX source. (See discussion in the other answer.) – landroni Feb 23 '14 at 16:41
  • This is not an correct answer: frenchb works fine, it just needed xspace package. See my answer. – ppr Feb 23 '14 at 17:53
  • @ppr: I know that. It's something I had added first, but I tried to answer to @tohecz's objection to the use of xspace. – Bernard Feb 23 '14 at 18:56