# [Tex/LaTex] Can TeX do ugly typesetting (with poor kerning)

tex-coretypography

This is from my series of questions "Can TeX do weird stuff?"

Today I want to know if TeX can simulate bad typography. I'm not talking about ugly templates, like wordlike or (god forgive me for this) abntex2, these are easy and not ugly enough.

I'm talking about nightmare-inducing poorly-kerned typography. I have seen lots of documents that the letters overlap each other and have irregular spacing, but could not find them for this question.

The closest thing I could find was (behold!) this:

and this:

I tried \letting and \deffing \kern and \glue to \relax and to a fixed amount, but none of these worked.

Is it possible to disable, or even better, completely messing up TeX's inter-letter spacing? Random inter-letter spacing would be perfect!

An approach with XeTeX and \XeTeXinterchartoks (i.e. compile the below with xelatex):

\documentclass{article}
\usepackage{lipsum}
\input{random}

\newcount\randnum
\newcommand{\randkern}{%
\setrannum{\randnum}{-30}{30}%
\kern \dimexpr(\randnum pt/10)\relax
}

\XeTeXinterchartokenstate = 1
\XeTeXinterchartoks 0 0 = {\randkern}

\begin{document}
\lipsum[1]
\end{document}


You can make the range smaller if you'd like less aggressive miskerning, e.g. changing {-30}{30} to {-10}{20} gives:

The idea is simply to insert a random kern between any two characters. For example, if we typed something like:

L\kern 0.4pt o\kern 1.3pt r\kern -1.0pt e\kern -0.4pt m


and so on, we'd have the result from the image above. The above code just does this, with two shortcuts:

• Defines a \randkern, using package random to generate random numbers, and the \dimexpr primitive introduced in e-TeX).
• Uses \XeTeXinterchartoks (documented in the XeTeX reference guide). Setting \XeTeXinterchartoks 0 0 to \randkern inserts the token \randkern between any two characters of class 0 (most characters are of class 0 by default). For example, when our text contains the character L followed by the character o, XeTeX treats it as if you had typed the token \randkern between them (like typing L\randkern o).