Letter spacing is a special kind of emphasis often used in combination with blackletter fonts. A letter spaced has 0.125 em spaces between its characters, but some ligatures are preserved. For example: »B ä ck e r ſt r a ß e« How can I get letter spacing with (La)TeX?
4 Answers
With the microtype
package and pdfTeX, you just need to enclose the text which you want to emphasize in a \textls
command. You can adjust the amount of letterspacing (Sperrsatz) globally by adding letterspace=125
to the package options or, alternatively, locally by providing it as an optional argument to the \textls
command (in multiples of 1/1000 em).
\documentclass{article}
\usepackage{yfonts}
\usepackage[letterspace=125]{microtype}
\begin{document}
\frakfamily
\textls{B\"ackerstra\ss e}
\textls[50]{B\"ackerstra\ss e}
\end{document}
If you are not interested in the other features of microtype
such as margin kerning, you can instead load the letterspace
package with the same option.
-
1
-
2Is this any different from
\addfontfeature{LetterSpace=12.5}
?– ToothrotCommented Aug 3, 2017 at 17:10 -
Note: this does not preserve all ligatures. See my question for details. Commented Feb 13 at 23:05
This page from the UniFraktur project goes into detail about letterspacing and shows what to do for XeLaTeX.
You can use the soulutf8 package and its \sodef
command to define a new command to get the desired letter spacing; to mantain a ligature you can use \mbox
inside the argument of the newly defined command:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{soulutf8}
\sodef\Sp{}{.125em}{1em plus1em}{2em plus.1em minus.1em}
\begin{document}
\Sp{Bäcker\mbox{ßt}raße}
\end{document}
-
2The advantage of using the microtype package in the case of letterspacing with Fraktur is that it preserves the special German ligatures automatically. No need to remember to place various letter combinations inside mbox-es.– MicoCommented Aug 17, 2011 at 9:05
LuaLaTeX solution.
\documentclass{article}
\usepackage{fontspec}
\newfontfamily\letterspaced{Latin Modern Roman}[LetterSpace=50]
\begin{document}
Hello world
{\letterspaced Hello world}
Hello world
\end{document}
Output:
There's an alternative solution that does not require defining a font family, but it's much slower.
\documentclass{article}
\usepackage{fontspec}
\begin{document}
\fontspec{Latin Modern Roman} % set the default font https://tex.stackexchange.com/q/643918/250119
Hello world fi
{
\addfontfeature{LetterSpace=50}
Hello world fi
}
{
\addfontfeature{LetterSpace=50,Ligatures={NoCommon, NoDiscretionary}} % https://tex.stackexchange.com/a/103242/250119
Hello world fi
}
Hello world fi
\end{document}
Output:
- First line is normal text,
- second line is LetterSpace,
- third line is LetterSpace with ligatures disabled,
- forth line is back to normal text.
How much slower?
I compare two documents with the following changes:
\csname prg_replicate:nn\endcsname{200}{
{\letterspaced Hello world}
}
versus
\csname prg_replicate:nn\endcsname{200}{
{\addfontfeature{LetterSpace=50} Hello world}
}
The time taken are 0m4.137s and 0m1.254s respectively. So that evaluates to 14ms per usage, or: for every 70 usages of \addfontfeature
, your compilation time slows down by a second.
-
Cool idea! Note that for proper letter spacing in German, only some ligatures are preserved while others are split. Specifically, ligatures ſt, ch, ck, and tz are preserved, others are lost.– FUZxxlCommented Feb 13 at 10:17
soul
package has some features along these lines, but I don't know if it's quite what you are looking for.