[Tex/LaTex] Creating new characters from existing ones

characterslinguisticssymbolstipatypography

In a nutshell. Is there a relatively easy way of building characters out of parts of existing ones?

Rationale. (La)TeX linguists’ need for a wide palette of characters—for example, ⟨ɳ⟩ (U+0273), ⟨ɲ⟩ (U+0272), ⟨ʁ⟩ (U+0281), ⟨ɱ⟩ (U+0271), ⟨ə⟩ (U+0259)—is generally met by Rei Fukui’s tipa package. However, tipa provides no italic shapes and is limited to Computer Modern. Which causes problems. Publishers very often ask for a font other than Computer Modern, and there is a near universal convention that italics be used for in-text citation. The result is unsatisfying and visually unappealing (and frequently leads to publications in which there is a mishmash of fonts and/or font shapes). (Some publishers do have full sets of italic IPA fonts, but these are frequently specially commissioned and not freely available; e.g., OUP’s Minion set.)

Example. Here is the mixture of fonts and shapes you get by calling for a schwa via \textipa{@}, while using Times Roman:

enter image description here

To get around this, I’ve taken to getting rotating.sty to rotate an e:

\newlength{\schwawidth}
\newlength{\schwaheight}
\newcommand{\x}{%
    \settowidth{\schwawidth}{\it e}%
    \settoheight{\schwaheight}{\it e}%
    \makebox[\schwawidth][r]{%
    \raisebox{\schwaheight}{%
    \turnbox{180}{e}}}%
    }

Notice that this also gets reasonable kerning (which is the reason for defining \schwawidth and \schwaheight rather than using, what’s it called, a rotate box?):

enter image description here

The Question. This approach fails when parts of characters have to be assembled. Consider ⟨ɺ⟩ (U+027A). You can rotate a ⟨r⟩, as for schwa, and superimpose on an ⟨l⟩, but the tail of the ⟨l⟩ sticks out uncomfortably:

enter image description here

What you really need is to lop the top off an ⟨l⟩ and to stick it on the rotated ⟨r⟩ and then to have the result treated as a single character. Is there are simple way of doing this?


Update. The author of expex.sty reminds me of a trick I used to use in Word: covering parts of letters up with white boxes, replicable in TeX with pstricks.sty. Here is how you might get ⟨ɺ⟩ (U+027A) above:

\documentclass[12pt]{article}
\usepackage{rotating,mathptmx,pstricks}

\begin{document}

\newlength{\rwidth}
\newlength{\rheight}
\newcommand{\turnedr}{%
    \settowidth{\rwidth}{\it r}%
    \settoheight{\rheight}{\it r}%
    \makebox[\rwidth][r]{%
    \raisebox{\rheight}{%
    \turnbox{180}{r}}}%
    }
\def\cutr{\leavevmode\hbox{\turnedr}%
    \psframe*[linecolor=white](0,0)(-.15em,1.1ex)%
    \psframe*[linecolor=white](0,-.1ex)(-.24em,.2ex)%
    \psframe*[linecolor=white](0,-.1ex)(-.26em,.1ex)%
    }
\def\turnedlongr{\cutr\kern-.27eml}

\noindent \it 
\verb|\cutr| --- \cutr \\
\verb|\turnedlongr| --- \turnedlongr \\
\verb|\l\turnedlongr d| --- l\turnedlongr d

\end{document}

enter image description here

I doubt this will work for all letters, and I’m sure that purists will need to rinse their eyes after reading this…


Undertaking. If I make progress on this, I’ll start posting whatever characters I create/cobble/frankenstein on (something linked to) my webpage (which you can find by googling my name).

Notes. This question is quite general as:

  1. Many IPA characters are combinations of common characters (⟨j⟩+⟨n⟩=⟨ɲ⟩, ⟨m⟩+⟨j⟩=⟨ɱ⟩, etc.).
  2. The problem of mismatches doesn't just apply to Times italics: it affects italics in Computer Modern and roman in all other fonts.

This question started life as part of this question. Although a work around was found, the broad issue of lopping bits of existing characters (in that case, the crossbar from ⟨f⟩) remains.


\documentclass[12pt]{article}
\usepackage{rotating,mathptmx, tipa}

\begin{document}

\newlength{\schwawidth}
\newlength{\schwaheight}
\newcommand{\x}{%
    \settowidth{\schwawidth}{\it e}%
    \settoheight{\schwaheight}{\it e}%
    \makebox[\schwawidth][r]{%
    \raisebox{\schwaheight}{%
    \turnbox{180}{e}}}%
    }

\noindent \it 
e\x e --- all Times italic\\
e\textipa{@}e --- Times italic with slanted Computer Modern schwa\\
\textipa{e@e} --- all Computer Modern slanted\\
\underline{e \footnotesize\x\ \normalsize\x\ \Large\x}\ \normalsize --- various sizes

\newlength{\rwidth}
\newlength{\rheight}
\newcommand{\turnedr}{%
    \settowidth{\rwidth}{\it r}%
    \settoheight{\rheight}{\it r}%
    \makebox[\rwidth][r]{%
    \raisebox{\rheight}{%
    \turnbox{180}{r}}}%
    }
\ \\
$\turnedr + l \stackrel{_?}{=} \turnedr\kern-.265eml$

\end{document}

Best Answer

it's always better to use "precomposed" characters rather than trying to cobble something together. this may involve some work with font tools, and others on this list are better able to address that than i.

however, many fonts created for use within linguistics environments are available from sil international, and i suggest looking there before trying to "roll your own".

update: a further question, "Accessing IPA characters when using Charis SIL" was answered by egreg to say that ipa characters can be used directly, provided the file is encoded as utf-8 and \usepackage{fontspec} is specified. that question, answer and comments provide other useful information, and with this, the op reports that everything is now working fine.