1

We continue How to get two versions of the same math Unicode symbol from different fonts with XeLaTeX or LuLaTeX?, where we found out how to get ≝ in which “=” has roughly the same width as “def” using a math font.

We sometimes use “def“ also over the equivalence symbol. Is there a way to get similar and pleasant look of ≝ (in which “def” and “=” are roughly equally wide) such that it appears in the text layer of the PDF as a single symbol and also looks similar to “def” over “⇔”? Any other font besides Latin Modern Math, perhaps?

Here is some code to play with:

\documentclass{article}
\pagestyle{empty}
\usepackage[math-style=ISO]{unicode-math}
\setmainfont{TeX Gyre Termes}
\setsansfont{TeX Gyre Heros}[Scale=0.88]
\setmonofont{TeX Gyre Cursor}
\setmathfont{TeX Gyre Termes Math}
\newfontface{\latinmodernmath}{latinmodern-math.otf}% thx to Ulrike and egreg!!!
\newcommand*{\definingEquals}{\mathrel{\text{\latinmodernmath ≝}}}% thx to Ulrike and egreg!!!
\newcommand*{\definingEquiv}{\stackrel{\text{def}}{\Leftrightarrow}}
\begin{document}
\begin{align*}
𝑇\quad&\definingEquals\quad\{(𝐽, 𝑀) : 𝐽 ∈ ℤ ∧ 𝑀 ∈ ℕ_+ ∧ 𝑀 ≤ 12\}\\
(𝐽, 𝑀) ⪯ (𝐽′,𝑀′) \quad&\definingEquiv\quad 𝐽 < 𝐽′ ∨ (𝐽 = 𝐽′ ∧ 𝑀 ≤ 𝑀′)
\end{align*}
\end{document}

ouput

As you see, these def symbols don't look well together, but at least the upper one gets into the PDF text layer.

We are reluctant to take “⇔” from a non-main math font (i.e., we don't wish to deviate from TeX Gyre Termes Math much), since then, in a non-minimal document, we'd have to take also the left and right double arrows from that other font for visually pleasant looks, and this would possibly incur changing more and more characters. The publisher's guideline mentions “Times”, and we interpret this as “Times-like”.

What we could hypothetically do is replace “def“ above “⇔” by \textsmaller[2]{def} using the relsize package, though I'm really not sure whether this would be visually the best option: already now “def” above “=” is hardly visible, and we are reluctant to making “def” above “⇔” also hardly visible.

A font with a better ≝ (where “def” is Times-like) would be probably preferred, if it exists.

PS. The best scaling+stacking version so far is, IMHO, https://tex.stackexchange.com/a/35409. Related: A better long ≝ (defining equals, equals to by definition) without bumps .

16
  • The only unicode with def is ≝ so if you want the same look with different symbols don't use ≝ use \stackrel or similar to stack def in the same way for all Feb 14, 2023 at 1:00
  • For my knowledge, what is Times-like and how should that be not hardly visible? (Times font face isn't that easier to read)
    – gildux
    Feb 14, 2023 at 2:12
  • Have you considered replacing \text{def} in the first argument of \stackrel with \text{\tiny def}?
    – Mico
    Feb 14, 2023 at 7:13
  • 1
    @egreg Indeed so, in most cases it could be replaced by = or \Leftrightarrow only if it is put in the definition environment or declared to be defined as follows.
    – M. Logic
    Feb 14, 2023 at 10:53
  • 1
    @M.Logic Put simply, use as few symbols as possible.
    – egreg
    Feb 14, 2023 at 11:23

1 Answer 1

5

Considering of your purpose, I give you the following options.

\documentclass{article}
\usepackage{amsfonts,amssymb,amsmath}
\usepackage{graphicx}%for \scalebox
\usepackage{mathtools}%for \cloneqq

\newcommand{\bedefine}{\stackrel{\scalebox{0.5}{\ensuremath{\mathsf{\,def}}}}{=}}
\newcommand{\eqdefine}{\stackrel{\scalebox{0.5}{\ensuremath{\mathsf{\,def}}}}{\equiv}}
\newcommand{\iffdefine}{\stackrel{\scalebox{0.5}{\ensuremath{\mathsf{\,def}}}}{\Leftrightarrow}}
\newcommand{\simdefine}{\stackrel{\scalebox{0.5}{\ensuremath{\mathsf{\,def}}}}{\sim}}

\newcommand{\bedefinet}{\stackrel{\scalebox{0.4}{\ensuremath{\mathbf{\,def}}}}{=}}
\newcommand{\eqdefinet}{\stackrel{\scalebox{0.4}{\ensuremath{\mathbf{\,def}}}}{\equiv}}
\newcommand{\iffdefinet}{\stackrel{\scalebox{0.4}{\ensuremath{\mathbf{\,def}}}}{\Leftrightarrow}}
\newcommand{\simdefinet}{\stackrel{\scalebox{0.4}{\ensuremath{\mathbf{\,def}}}}{\sim}}

\begin{document}
\huge
\[
\begin{array}{rclcrcl}
f&\bedefine& x+y,&&f&\bedefinet& x+y,\\
f&\eqdefine& x+y,&&f&\eqdefinet& x+y,\\
f&\iffdefine& x+y,&&f&\iffdefinet& x+y,\\
f&\simdefine& x+y,&&f&\simdefinet& x+y,\\
f&\coloneqq& x+y,&&&&\\
f&\triangleq& x+y.&&&&
\end{array}
\]
\end{document}

enter image description here

It's easy to understand \bedefine, \eqdefine, \iffdefine and \simdefine. I think you also see \coloneqq before. While I usually use \triangleq instead and I understand it as: Delta + equality ~ D + equality ~ define + equality ~ is defined to be.

By the way, to make "def" be more visible, the sans serif fonts are better choices than the serif fonts such as Times and so on. Now the font of def on the right side is Computer Modern Bold in default. And if you want def to be Times-like fonts, then you should set the bold fonts of the regular fonts to be Times Bold.

14
  • Fine except you don't get ≝ in the text layer of the PDF (i.e., searchable/copyable). The best scaling+stacking version is, IMHO, tex.stackexchange.com/a/35409/282514 anyway. Related: tex.stackexchange.com/questions/674648/… .
    – user282514
    Feb 14, 2023 at 8:35
  • 1
    @AlbertNash Many math symbols can't be searched in the pdf file except that they have unicodes in the fonts used in the pdf and included in your pc.
    – M. Logic
    Feb 14, 2023 at 10:49
  • @AlbertNash what do you mean by not in the text layer??? the def here is normal text and will be in the pdf just as \frac{a}{b} puts a and b in the pdf. Feb 14, 2023 at 12:10
  • @DavidCarlisle For example, we could search < in the pdf but we could search ≝ because ≝ didn't occurred in the pdf as a whole symbol.
    – M. Logic
    Feb 14, 2023 at 14:41
  • @M.Logic well sure but that's like saying you can not search for ½ if you use \frac{1}{2} but that is very different to saying def is not searchable text. It's not as if it gets coded as a pdf annotation or some other non-content stream, it's just normal text. Feb 14, 2023 at 14:52

You must log in to answer this question.