Skip to main content
Share Your Experience: Take the 2024 Developer Survey
37 votes
Accepted

Fix ugly kerning in equation subscript

In math-mode you should to use \mathit{...} (slanted} or \mathbf{...} (bold) or normal \mathrm{...} for any type of the text into math formula. \documentclass{article} \begin{document} \[C_{\mathit{...
Sebastiano's user avatar
  • 55.4k
34 votes
Accepted

what is \kern good for

A "kern" is a typographic term for a nonbreakable space between two items. These items are usually, but not exclusively, glyphs. \kern is a TeX primitive that serves to insert nonbreakable space. E.g....
Mico's user avatar
  • 511k
23 votes

Why is the distance between plus or minus and the number different?

The reason is that \cee does a different scanning than usual and gets tricked by +, which does have a special meaning inside \ce or \cee, because it's used for reactions. Indeed, if you try putting ...
egreg's user avatar
  • 1.1m
20 votes
Accepted

Automatically apply a kern rule for all characters that follow a specific character

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*[...
Robert's user avatar
  • 14.2k
18 votes
Accepted

Underline part of a word while preserving kerning

If you are using LuaTeX, you can use the new lua-ul package which also allows e.g. nested underlines: \documentclass{article} \usepackage{lua-ul,luacolor} \usepackage{tikzducks,pict2e} \...
Marcel Krüger's user avatar
17 votes
Accepted

What do the commands inside the \LaTeX logo do?

\makeatletter %% access private macros L%% print an L \kern -.36em%% add a negative kern {%% open a group \sbox \z@ T%% load box 0 with a T \vbox to\ht \z@ {%% start a vertical box as high as box ...
egreg's user avatar
  • 1.1m
17 votes
Accepted

Why is the distance between plus or minus and the number different?

+ and - have special meaning within \cee since it relates to charges of atoms/particles and is therefore treated differently. The - visually defaults to a unary minus while + defaults to a binary ...
Werner's user avatar
  • 605k
17 votes

Discretionary hyphen destroys kerning and ligature

By default, the control sequence \- is an abbreviation for \discretionary{-}{}{} (see p. 95 of the TeXbook). The first argument of \discretionary, the prebreak, specifies what gets inserted ...
Mico's user avatar
  • 511k
17 votes

Automatically apply a kern rule for all characters that follow a specific character

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 \...
Phelype Oleinik's user avatar
16 votes

Kerning a particular pair like "(j"

Because XeTeX character classes do not work in math mode (?) the only way to tackle this is by defining the opening parenthesis math active and check whether the next token is j before inserting the ...
Henri Menke's user avatar
14 votes

Kerning with selnolig

A major, and frankly vexing, practical issue when breaking up typographically inappropriate fl and ffl ligatures is how much whitespace (if any) should be inserted between f (or ff) and l. This issue ...
Mico's user avatar
  • 511k
14 votes
Accepted

What do \vec{\mkern0mu x} and \vec{{} x} mean?

\vec is defined as a "math accent", just like \hat and others. A math accent placed on a single character will have its position adjusted horizontally to sit over the visual top-center of ...
Donald Arseneau's user avatar
12 votes

1.5e-10 style scientific notation looks ugly in LaTeX math mode. How can I format it (kerning, etc) more nicely?

Here's a really simple solution, not using any extra packages and looks just fine, in my opinion: $9.54\text{e-}7$ That is, you're writing the "e-" part in normal text.
anaotha's user avatar
  • 221
12 votes
Accepted

LuaLaTeX: Change kerning around "1" to simulate proportional figures

The code below using Arial rather than Helvetica produces the above. The OP confirms that the code worked with teh Helvetica variant in the original question if if(string.find(name,'...
David Carlisle's user avatar
12 votes

LuaLaTeX: Change kerning around "1" to simulate proportional figures

As you seem to want to adjust the spacing only if more numbers are involved, you could change the kernings between two numbers: \documentclass{article} \usepackage{fontspec} \defaultfontfeatures{...
Ulrike Fischer's user avatar
12 votes

mathmode spacing shorter than \quad?

A \quad corresponds to a length of 1em. In math mode, 1em=18mu. Use \mkern<n>mu, where <n> can be either a positive or a negative number, to exert very fine control over spacing. Note: no ...
Mico's user avatar
  • 511k
12 votes

Letters' kerning space so different?

If you run the file \setbox0\hbox{X}\showthe\wd0 \setbox0\hbox{Y}\showthe\wd0 \setbox0\hbox{Z}\showthe\wd0 \bye through (Plain-)TeX on the command line, TeX shows the width of the characters X, Y ...
Marcel Krüger's user avatar
12 votes

What does TeX do to make text more beautiful? (Answer: four things.)

One important difference is that TeX breaks paragraphs into lines using a global algorithm, i.e. one that looks for an optimal solution for the entire paragraph. This is helpful when justifying text, ...
Ralf Stubner's user avatar
  • 2,614
11 votes

Typeset old Spanish abbreviation: center ending over period

Centering is easy; the collision is cured by \/. \documentclass[12pt]{article} \usepackage[T1]{fontenc} \usepackage{ebgaramond} \newcommand{\oa}[1]{% \/{\ooalign{\textsuperscript{#1}\cr\hidewidth....
egreg's user avatar
  • 1.1m
11 votes

How can I add extra kerning around -- (en-dash) in XeTeX

(The OP has asked primarily for a XeLaTeX-based approach. However, he has also encouraged the submission of a LuaLaTeX-based solution.) Here's a LuaLaTeX-based solution. It works with en- and em-...
Mico's user avatar
  • 511k
11 votes
Accepted

Adjusting kerning with LuaTeX and realscripts

The problem is that realscript itself use locally \addfontfeature. And this means that you are actually using two different fonts for the A and the superscript. It works fine if you use for both the ...
Ulrike Fischer's user avatar
11 votes
Accepted

Discretionary hyphen destroys kerning and ligature

\discretionary{f-}{i}{fi} seems to work. You can define a macro to ease the use: \def\dfi{\discretionary{f-}{i}{fi}} \def\VA{\discretionary{V-}{A}{VA}} VA fi\par AD\VA NCE Nar\dfi na \bye Not ideal ...
Manuel's user avatar
  • 27.2k
11 votes
Accepted

Why do I have to put braces around my macro for subscripts / indices?

Well they are missing. Not to worry, though, you can easily add them since you don't need the literal brace characters used for delimiting macro/command arguments, but can use \bgroup and \egroup. \...
Donald Arseneau's user avatar
11 votes

Kerning when coloring single letters

Compiling your document with LuaLaTeX instead of pdfLaTeX and loading the luacolor package solves the kerning issue. If you need to load the xcolor package as well, you should load xcolor before ...
Mico's user avatar
  • 511k
11 votes
Accepted

Fix Kerning Internal to a Unicode Character

The character in question is Ἄ U+1F0C GREEK CAPITAL LETTER ALPHA WITH PSILI AND OXIA and we find, in lgrenc.dfu, \DeclareUnicodeCharacter{1F0C}{\ensuregreek{\accpsilioxia\textAlpha}} % Ἄ and ...
egreg's user avatar
  • 1.1m
11 votes
Accepted

Why are these sentences in Libertine so cramped and what can I do about it?

The mathtools documentation states quite wisely Italic correction is a treacherous area. As Barbara mentioned in her comment, math is bound to be a bit cramped after an italic f. Furthermore, the ...
campa's user avatar
  • 31.3k
10 votes

Is it always best practice to not include text punctuation in inline math mode?

(updated the code to ensure that the Lua function doesn't perform string substitutions inside verbatim-like environments) Here's a LuaLaTeX-based approach. It combines the \kn macro from David ...
Mico's user avatar
  • 511k
10 votes
Accepted

How can I add extra kerning around -- (en-dash) in XeTeX

I don't think that it is possible intercharclass, as the ligature from -- to endash is built later. What you can do is add a thin space through a mapping. E.g. with this mapping you get a small ...
Ulrike Fischer's user avatar
10 votes
Accepted

Disable kerning for math letters / CM fonts incoherent kerning for df and dj

You can use microtype to remove the ligatures and the kerning for this encoding: \documentclass{article} \usepackage{microtype} \DisableLigatures{encoding = OML} \begin{document} \loggingoutput \...
Ulrike Fischer's user avatar
10 votes
Accepted

Make negative spacing between letters and make them darker on the overlapping parts

I made several changes. I made the color for each digit \color{gray!100!white!\intens where \intens is changed for each digit, from 50 to 75 and then (if needed) 100. Also, I present the chapter, ...
Steven B. Segletes's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible