Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make non-breaking spaces (ties) in Org-mode that exports properly to LaTeX

In (La)TeX non-breaking spaces are called ties and they are made by ~. Ties are for instance used after abbreviations so that there is no line break directly after them and so that dots ending abbrevations are not treated as ending sentences. The latter use is important because standardly LaTeX puts a longer space after dots than between words.

When exporting from Org-mode to LaTeX ~ is treated as an explicit character and not as a tie. Ignoring the use of non-breaking spaces is not an alternative because it leads to the wrong spacing (see the second sentence in the example above). One alternative is to force Org-mode to treat ~ as LaTeX with #+BEGIN_LaTeX ~ #+END_LaTeX but it is verbose and export to other formats breaks. Finally, using UTF-8 non-breaking spaces, as suggested in http://comments.gmane.org/gmane.emacs.orgmode/24716, does not work because LaTeX does not treat it as a space. So, how can I use non-breaking spaces in Org-mode that are properly exported to LaTeX?

Here is an example to clarify. The first sentence fails because ~ is treated as an explicit character. The second sentence fails, obviously, because the last dot is treated as ending a sentence by LaTeX. The third sentence exports properly but it is verbose and breaks export to other formats. The fourth line (separated by an UTF-8 non-breaking space which is inserted by C-x 8 Space) fails because it is not treated as a space by LaTeX:

#+title:Title  e.g.~example  e.g. example  #+BEGIN_LaTeX e.g.~example #+END_LaTeX  e.g. example 

This exports (C-x C-e L) to the following LaTeX code:

e.g.\~{}example  e.g. example  e.g.~example  e.g. example 

Which renders as:

LaTeX rendered

I am running Org-mode 7.6 in Emacs 23.3.1.

like image 912
N.N. Avatar asked Feb 16 '12 12:02

N.N.


People also ask

How do you insert a nonbreaking space in LaTeX?

Non-breaking spacesLaTeX uses the '~' symbol as a non-breaking space. You usually use non-breaking spaces for punctuation marks in some languages, for units and currencies, for initials, etc. Note that writing French like this might get really painful.

What is non-breaking space character?

In word processing and digital typesetting, a non-breaking space, , also called NBSP, required space, hard space, or fixed space (though it is not of fixed width), is a space character that prevents an automatic line break at its position.


1 Answers

On http://orgmode.org/manual/Special-symbols.html I found the solution to the double spacing problem:

Org

e.g.\nbsp{}example 

LaTeX

e.g.~example 
like image 60
Marc P. Avatar answered Oct 08 '22 11:10

Marc P.