[Tex/LaTex] Different alphabet with \alph

alphabetlanguagesnumbering

My language (Slovenian) uses a different alphabet that starts with a, b, c, č, d. I have the correct babel settings but \alph{} numbering still gives me a, b, c, d.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[slovene]{babel}

\renewcommand\thesection{\alph{section}}

\begin{document}

\section{}
\section{}
\section{}
\section{}

\end{document}

Best Answer

The following example redefines \alph/\Alph according to the Slovene alphabet. The original definition of the internals \@alph and \@Alph can be found in the LaTeX kernel (source documentation).

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[slovene]{babel}

\renewcommand\thesection{\alph{section}}

\makeatletter
\renewcommand*{\@alph}[1]{%
  \ifcase#1\or a\or b\or c\or\v c\or
    d\or e\or f\or g\or h\or i\or j\or
    k\or l\or m\or n\or o\or p\or r\or s\or\v s\or
    t\or u\or v\or w\or x\or
    y\or z\or
    \v z\else\@ctrerr\fi
}
\renewcommand*{\@Alph}[1]{%
  \ifcase#1\or A\or B\or C\or\v C\or
    D\or E\or F\or G\or H\or I\or J\or
    K\or L\or M\or N\or O\or P\or R\or S\or\v S\or
    T\or U\or V\or W\or X\or
    Y\or Z\or\v Z\else\@ctrerr\fi
}
\makeatother

\begin{document}

\section{\Alph{section}}
\section{\Alph{section}}
\section{\Alph{section}}
\section{\Alph{section}}

\end{document}

Result

Remarks:

  • Instead of č the definition uses the form \v c, which is called the LaTeX internal character representation (LICR). It has the advantage that it works independent on the input encoding.

  • I would recommend \usepackage[T1]{fontenc} with \usepackage{lmodern} instead of the old OT1 font encoding with Computer Modern fonts, where the accented letters are constructed of the base character with the accent. T1 encoding contains slots for the accented characters and the Latin Modern fonts extends the Computer Modern fonts with many accented characters as single glyphs.