How to make all i's and j's dotless, glyph substitution

Using XeTeX it's quite easy to substitute all text i and j with ı and ȷ. You can use the powerful Teckit mapping engine.

Create the following file dotless.map (make sure it's UTF-8). This is the default tex-text map file with a dotless conversion added.

LHSName "dotted"
RHSName "dotless"
pass(Unicode)
; replace dotted i and j with dotless versions
"i" > "ı"
"j" > "ȷ"
; ligatures from Knuth's original CMR fonts
U+002D U+002D           <>  U+2013  ; -- -> en dash
U+002D U+002D U+002D    <>  U+2014  ; --- -> em dash

U+0027          <>  U+2019  ; ' -> right single quote
U+0027 U+0027   <>  U+201D  ; '' -> right double quote
U+0022           >  U+201D  ; " -> right double quote

U+0060          <>  U+2018  ; ` -> left single quote
U+0060 U+0060   <>  U+201C  ; `` -> left double quote

U+0021 U+0060   <>  U+00A1  ; !` -> inverted exclam
U+003F U+0060   <>  U+00BF  ; ?` -> inverted question

Compile this to a .tec file with the following command:

teckit_compile -u  dotless.map -o dotless.tec

Now you can load any font which has the dotless glyphs with this mapping file and all the is and js will be dotless. If you load the mathspec package you can also substitute the math i and j too.

% !TEX TS-program = XeLaTeX

\documentclass[12pt]{article}
\usepackage{mathspec}
\usepackage{fontspec}
\setmainfont[Mapping=dotless]{Linux Libertine O}
\newfontfamily\dottedfont{Linux Libertine O}
\setmathfont(Latin)[Mapping=dotless]{Linux Libertine O}
\begin{document}
This is a document in which all the `i' and `j'  characters are dotless. 

This is not a joke or a jibe, so jump in and join the high jinks!

{\dottedfont But if this gives you the jitters you can junk the dotless version.}

You can even do it with math:

\[
i = j
\]

\end{document}

output of code


In LuaTeX you can define your own font feature for that matter. If you want the substitution to only apply in text or math mode, just comment out the corresponding statements in the definition below. I also defined the reverse mapping, so you can recover the dotted versions in dotless mode.

\documentclass{article}
\pagestyle{empty}
\usepackage{luacode}
\usepackage{unicode-math}
\begin{luacode*}
fonts.handlers.otf.addfeature {
    name = "dotlessij",
    type = "substitution",
    data = {
        -- Text mode
        i = "ı",
        j = "ȷ",
        ı = "i",
        ȷ = "j",
        -- Math mode
         = "",
         = "",
         = "",
         = "",
    }
}
\end{luacode*}
\setmainfont{Latin Modern Roman}[RawFeature={+dotlessij}]
\setmathfont{Latin Modern Math}[RawFeature={+dotlessij}]
\begin{document}
i, j, \i, \j

$i, j, \i, \j$
\end{document}

enter image description here

Tags:

Fonts

Xetex