Wikipedia mentions a ligature for NB (nota bene), however I can't seem to find any reference to this in the latex literature. Is there a way to use this ligature in my latex document?
2 Answers
To the best of my knowledge, there are no fonts out there (not even Junicode!) that provide a ready-made NB ligature.
It's actually not too difficult to create a composite NB
glyph (not to be confused with a "true" ligature) by inserting a negative kern between N
and B
. However, for many font families the N-B
composite is quite unattractive. It's a vivid reminder, IMNSHO, of the fact that creating a good-looking ligature requires a lot more work than just "snugging up" two or more glyphs.
The following screenshot shows possible NB candidates for 4 serif fonts and 3 sans-serif fonts. (If you wanted to use this in "real work", be sure to omit the \textcolor{red}{...}
wrapper in the definition of \NB
.)
\documentclass{article}
\usepackage{xcolor} % for '\textcolor' macro
\newcommand\NB[1][0.3]{N\kern-#1em\textcolor{red}{B}} % default kern amount: -0.3em
\usepackage{fontspec}
\begin{document}
\setmainfont{Latin Modern Roman}
\NB --- Latin Modern Roman
\setmainfont{Times Roman}
\NB[0.265] --- Times Roman
\setmainfont{EB Garamond}
\NB[0.275] --- EB Garamond
\setmainfont{Trajan Pro}
\NB[0.385] --- Trajan Pro
\setmainfont{Latin Modern Sans}
\NB[0.27] --- Latin Modern Sans
\setmainfont{Helvetica}
\NB[0.24] --- Helvetica
\setmainfont{Futura}
\NB[0.295] --- Futura
\end{document}
-
2
-
3It might be worth noting that this is the same workaround which is also used on the linked Wikipedia page: The "ligature" is
$\mathrm{N}\!\!\mathrm{B}$
which should be the same as\NB[0.33333]
with Computer Modern Roman. Apr 7, 2019 at 11:23 -
-
One way to improve this might be to clip the
N
glyph where theB
begins to avoid the N poking out from the bottom like in Garamond or Futura. No idea whether that's possible though (although it's LaTeX, so arbitrary vector graphics operations on arbitrary font glyphs should be no problem, from what I've seen so far).– JoeyApr 8, 2019 at 7:35 -
@Joey - Feel free to post a new answer in which you implement the ideas outlined in your comment. :-)– MicoApr 8, 2019 at 15:39
Even among commercial fonts with many unusual ligatures, this ligature is rare. The only one in my large collection is found in P22 Hoy Pro, and it hasn’t been made readily accessible through any defined feature:
\documentclass{article}
\usepackage{fontspec,luacode}
\setmainfont{P22 Hoy Pro}[
Contextuals=Alternate,
Ligatures=Rare]
% https://tex.stackexchange.com/a/120762:
\begin{luacode}
documentdata = documentdata or { }
local stringformat = string.format
local texsprint = tex.sprint
local slot_of_name = luaotfload.aux.slot_of_name
documentdata.fontchar = function (chr)
local chr = slot_of_name(font.current(), chr, false)
if chr and type(chr) == "number" then
texsprint
(stringformat ([[\char"%X]], chr))
end
end
\end{luacode}
\def\fontchar#1{\directlua{documentdata.fontchar "#1"}}
\begin{document}
\fontchar{N_B}: This is P22 Hoy Pro.
\end{document}
-
2
-
1I've taken the liberty of inserting some meta-code to pretty-print the Lua code chunk. Feel free to revert if it's not to your liking.– MicoApr 7, 2019 at 15:15
-
1
-
1I inserted the directives
<!-- language: lang-lua -->
and<!-- language: lang-tex -->
on lines by themselves, not indented by four spaces. (I can’t remember off-hand who taught me this trick — I certainly didn’t come up with it on my own.)– MicoApr 7, 2019 at 16:24 -
@Thérèse My upvote also for the comment into a my recent question. :-) When you read it, I'll delete this message. Greetings. Jun 26, 2019 at 10:52