[Tex/LaTex] Automatic non-breaking spaces in proper name initials


I need to use non-breaking spaces in proper name initials, e.g.


Any way to make LaTeX replace regular spaces with non-breaking ones for such cases? Or would I better preprocess my tex files with some regexp/script?

Best Answer

I added support for initials to my package luavlna. This package uses luatex node processing callbacks for language dependent insertion of non-breaking spaces after one letter words and initials.


\usepackage[czech, english]{babel}
D. E. Knuth, Ch. Somebody. \selectlanguage{czech} A. Dvořák, 
name in horizontal box \hbox{Č. Zíbrt}, Ř. Jelen \preventsingleoff C. Někdo, 
\preventsingleon Ř. Jelen, Ch. Josef, CH. Thisworkstoo


enter image description here

You can see that Ch is used as one letter in Czech. If you don't want language sensitive processing, set default language with \preventsinglelang{languagename} and rules for given language will be used in the whole document.

You can turn off the processing with \preventsingleoff and resume it latter with \preventsingleon

luavlna isn't on CTAN yet, I have to make language detection more robust, so you can download it from github and install in to your local TEXMFHOME dir if you want to use it.

Related Question