The language setting for my document is Catalan babel. The Catalan alphabet includes a letter called ela geminada, spelled with two lower-case l separated by the interpunct · (i.e. "cel·la" or "pel·lícula". More information at http://en.wikipedia.org/wiki/Interpunct#Catalan).

I would like to input l·l from the keyboard rather than writing \lgem, which is the command given by the babel package in the catalan mode. However, when I type l·l, the spacing is too big, and I would like it to look as the output of the original command.

An image to clarify this:

-
Almost a year ago, in the CervanTeX mailing list Javier Bezos (who's now the supporter of the babel package) posted about the ela geminada. The answer of Ignasi was part of that thread. I hope you can read it in the feed of the list or somewhere else. I think can be useful for you. –  Aradnix Jan 2 at 5:31

Some time ago, one of my university colleagues gave me next code to use the punt volat (Shift+3 on a spanish keyboard) as an active character. Some times I use it but I don't have it on any 'official' style file, then it's easier for me to use "l or \lgem{}.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[catalan]{babel}
\usepackage{lmodern}

%Definició de la ela geminada per tal que accepti el punt volat del teclat
\def·#1{%
\ifmmode
\cdot #1
%\csname normal@char\string"\endcsname l%
\else%
\def\argument{#1}%
\if\argument l%
\leftllkern=0pt\rightllkern=0pt\raiselldim=0pt%
\setbox0\hbox{l}\setbox1\hbox{l\/}\setbox2\hbox{.}%
\leftllkern=-.25\wd0%
\rightllkern=-.25\wd0%
\allowhyphens\discretionary{-}{l}%
{\hbox{}\kern\leftllkern\raise\raiselldim\hbox{.}%
\kern\rightllkern\hbox{l}}\allowhyphens%
\else
\if\argument L%
\leftllkern=0pt\rightllkern=0pt\raiselldim=0pt%
\setbox0\hbox{L}\setbox1\hbox{L\/}\setbox2\hbox{.}%
\leftllkern=-.125\wd0%
\rightllkern=-\wd0%
\divide\rightllkern by 6%
\allowhyphens\discretionary{-}{L}%
{\hbox{}\kern\leftllkern\raise\raiselldim\hbox{.}%
\kern\rightllkern\hbox{L}}\allowhyphens%
\else
#1
\fi
\fi
\fi
}

\begin{document}
cel·la
CEL·LA
\end{document}


The result is:

-
Thanks @Ignasi, I will use it in all my personal and local catalan documents, and the babel commands as egreg commented in the other ones. Gràcies. –  JnxF Nov 4 '12 at 22:07
@Ignasi for some reason this code fails when · is in \section{}, \subsection{} and so on (e.g, \section{Oscil·ladors}). Any clue? –  Alfredo Hernández Feb 13 at 22:01
@AlfredoHernández: You can use \section{\protect Oscil·ladors} but it will fail composing table of contents. I think Javier's solution is better. Here you can read the thread in CervanTeX mentioned by Aradnix –  Ignasi Feb 14 at 8:06
I had tried it before and I didn't understand \newbox\LL\hbox{l·l L·l l·L L·L}. Nonetheless I deleted that line and the code works flawlessly, thanks both ;) –  Alfredo Hernández Feb 14 at 16:59

You have several options available.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[catalan]{babel}
\usepackage{newunicodechar}
\newunicodechar{Ŀ}{\L.}
\newunicodechar{ŀ}{\l.}

\begin{document}
CE\Lgem A -- ce\lgem a

CE\L.LA -- ce\l.la

CE"LA -- ce"la

CEĿLA -- ceŀla

\end{document}


The last uses the Unicode characters (and requires UTF-8), the first three work in any input encoding.

-
Be aware that ĿL is a bad way of writing L·L. See the 2nd point in bloc.totssom.cat/2012/11/21/… –  Oriol Jan 2 at 1:45
@Oriol I've found nothing at unicode.org saying that U+013F is deprecated. Can you add official information? What I think of it is that Catalan made the wrong choice: it should have been chosen ly (on the ny model) or lh (like Portuguese) for ll, and ll for ĿL. It's too late now, of course. –  egreg Jan 2 at 9:00
It seems ĿL is not deprecated and l·l.cat is wrong, as explained b-j.cat/teclats/#4.3. But it is true that unicode says (page 4 of unicode.org/charts/PDF/U0100.pdf) that the preferred representation of U+0140 (ŀ) in Catalan is U+006C (l) U+00B7 (·). And I agree we made the wrong choice. –  Oriol Jan 2 at 15:35

An alternative solution, based on the previous one. Redefining directly · is not a good idea (problems with TOC, for example), and the proper way is redefining the LICR object \textperiodcentered. I even consider impossible cases, like l·L. I wrote it long ago and posted to the list es-tex (CervanTeX), and here I just copy and paste it:

\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage[catalan]{babel}

\def\xgem{%
\ifmmode
\csname normal@char\string"\endcsname l%
\else
\leftllkern=0pt\rightllkern=0pt\raiselldim=0pt
\setbox0\hbox{l}\setbox1\hbox{l\/}\setbox2\hbox{.}%
\leftllkern=-.25\wd0%
\rightllkern=-.25\wd0%
\allowhyphens\discretionary{-}{}%
{\kern\leftllkern\raise\raiselldim\hbox{.}%
\kern\rightllkern}\allowhyphens
\fi
}
\def\Xgem{%
\ifmmode
\csname normal@char\string"\endcsname L%
\else
\leftllkern=0pt\rightllkern=0pt\raiselldim=0pt
\setbox0\hbox{L}\setbox1\hbox{L\/}\setbox2\hbox{.}%
\leftllkern=-.125\wd0%
\rightllkern=-\wd0%
\divide\rightllkern by 6
\allowhyphens\discretionary{-}{}%
{\kern\leftllkern\raise\raiselldim\hbox{.}%
\kern\rightllkern}\allowhyphens
\fi
}

\newbox\LL\hbox{l·l L·l l·L L·L}

% No lo uso, pero es como podría guardarse el valor
% anterior:
\expandafter\let\expandafter\saveperiodcentered
\csname T1\string\textperiodcentered \endcsname

% Y aquí está el quid. No hago nada con el argumento, pero
% se podría usar para, por ejemplo, considerar los 4 casos
\DeclareTextCommand{\textperiodcentered}{T1}[1]{%
\ifnum\spacefactor=998
\Xgem
\else
\xgem
\fi#1}

\begin{document}

Por defecto:

\leavevmode\box\LL

\sfcodeL=998

Corregido:

l·l L·l l·L L·L

\end{document}

-
Thank you very much, a really versatile solution. –  JnxF Jan 2 at 18:07
Could you explain what does the \newbox\LL\hbox{l·l L·l l·L L·L}` line make in your preamble? Anyway, thanks for your solution; very handy. –  Alfredo Hernández Feb 14 at 17:00
@AlfredoHernández It just stores some examples to show how · looks by default. –  Javier Bezos Feb 15 at 18:23
@JavierBezos Okay, thanks. –  Alfredo Hernández Feb 16 at 12:17