17

I am writing some text using the \calligra font and there are some specific instances where I want to manually reduce the kerning between letters.

See the MWE below. I have reduced the kerning between the N and a letters using \kern-0.2em.

\documentclass{article}
\usepackage{calligra}
\usepackage[T1]{fontenc}
\begin{document}
\calligra 
Insert Name\vspace{.2cm}

Insert N\kern-0.2em ame
\end{document}

enter image description here

Is there a way to make this automatic? So I don't have to type \kern after every N?

I have seen this question which shows automatic kerning rules can be done using a macro defined in the preamble. But, this case was for one specific combination of characters. I want to make it general for every character that follows an N. I am not sure how to do this.

2 Answers 2

20

To complement Phelype's answer: if you are using pdftex, you may achieve the same result by adding the following lines to the preamble:

\usepackage[kerning=true]{microtype}
\DeclareMicrotypeSet*[kerning]{calligra}{encoding = T1, family = calligra}
\SetExtraKerning{encoding = T1, family = calligra}{N = {,-200}}
0
17

If you can use XeTeX, then you can use \XeTeXinterchartoks (idea by ShreevatsaR).

First you create a "character class" for the letter N (and for any other you wish):

\newXeTeXintercharclass \mycharclassN
\XeTeXcharclass `\N \mycharclassN

then you say that XeTeX is supposed to insert \kern-0.2em between N and any other character (class 0):

\XeTeXinterchartoks \mycharclassN 0 = {\kern-0.2em}

then you only need to activate the inter-character tokens with:

\XeTeXinterchartokenstate = 1

enter image description here

\documentclass{article}
\usepackage{calligra}
\usepackage[T1]{fontenc}

\newXeTeXintercharclass \mycharclassN
\XeTeXcharclass `\N \mycharclassN

\XeTeXinterchartoks \mycharclassN 0 = {\kern-0.2em}

\begin{document}
\calligra

\parskip=0.2cm

Insert Name

Insert N\kern-0.2em ame

\XeTeXinterchartokenstate = 1

Insert Name

Na Nb Nc Nd Ne Nf Ng

Nh Ni Nj Nk Nl Nm

Nn No Np Nq Nr Ns Nt

Nu Nv Nw Nx Ny Nz

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .