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 .

  • 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 – David Carlisle Feb 14 '23 at 01: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 '23 at 02:12
  • Have you considered replacing \text{def} in the first argument of \stackrel with \text{\tiny def}? – Mico Feb 14 '23 at 07:13
  • @gildux A font that self-advertises itsself as a clone of Times, a replacement for Times, or Times-like. Examples are NewTX and TeX Gyre Termes. –  Feb 14 '23 at 08:33
  • @Mico Essentially, same issue with \text{\tiny def} as with \textsmaller[2]{def}. –  Feb 14 '23 at 08:39
  • Another useless symbol… Why not “⟨thing to be defined⟩ stands for ⟨definition⟩”? – egreg Feb 14 '23 at 09:08
  • 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 '23 at 10:53
  • 1
    @M.Logic Put simply, use as few symbols as possible. – egreg Feb 14 '23 at 11:23
  • Yes, few symbols as possible, and when on has to use symbols always favor well established one (maths is already full of symbols that make things confused but for few fellows.) However, I see this question more like a fun challenge than a useful stuff. Oh, and thanks Albert. – gildux Feb 14 '23 at 15:18
  • @egreg I see it differently. Given enough maths/comp.sci stuff to typeset, you will inevitably sooner or later wish to use a symbol “equals/equivalent to by definition” instead of lengthy saying “We define … as follows …” I'm not saying that you'd ALWAYS prefer a single symbol, I'm saying that you will sooner or later find yourself in a situation where you'd rather use a single symbol than a lengthy sentence. An example for a likely place would be a glossary or margin notes. –  Feb 14 '23 at 23:38
  • @egreg Another example would be NewNotation1 ≝ Term2 = Term3 = Term4 or NewNotation1 ⇔^{def} Term2 ⇔ Term3 ⇔ Term4, i.e., a series of equalities or equivalences, in which the first one introduces new notation and the remaining ones are term conversions. Often (though surely not always) such a definition is unambiguous and clear. –  Feb 14 '23 at 23:53
  • @AlbertNash given that between us egreg and I have something like 70 years of TeX experience and have never felt a need for ≝ are you sure that "you will inevitably sooner or later wish to use a symbol ..." ??? – David Carlisle Feb 15 '23 at 20:20
  • @DavidCarlisle You are more mathematicians than computer scientists. Also, you're old-school, which is O.K., and which also means that you're accustomed to particular traditional styles of writing. I cannot post what we typeset verbatim due to legal reasons (only some generic snippets, which may or may not satisfy you), and in the German book I typeset, we use NewNotation≝Term in the sense of „we define NewNotation as Term“ (in German) quite often, both in the main text and in the glossary. –  Feb 16 '23 at 14:01
  • @DavidCarlisle Similarly, we use “NewPredicate ⇔^{def} Formula” … Do you really think I would ask for it if I were not convinced that it's useful? –  Feb 16 '23 at 14:03
  • @AlbertNash No harm in asking but no point asking here you'd need to ask that it be added to Unicode – David Carlisle Feb 16 '23 at 15:28
  • @DavidCarlisle Fair enough. In this post, I ask only how to make ≝ more similar to ⇔^{def} (while still taking the former from a .ttf or an .otf or otherwise ensuring that it appears as U+225D in the PDF text layer). I might prefer that ⇔^{def} also gets into Unicode, and, as you rightfully say, this would be off-topic here (and probably a lengthy process). –  Feb 16 '23 at 15:45

1 Answers1

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.

M. Logic
  • 4,214
  • Fine except you don't get ≝ in the text layer of the PDF (i.e., searchable/copyable). The best scaling+stacking version is, IMHO, https://tex.stackexchange.com/a/35409/282514 anyway. Related: https://tex.stackexchange.com/questions/674648/a-better-long-%E2%89%9D-defining-equals-equals-to-by-definition-without-bumps . –  Feb 14 '23 at 08: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 '23 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. – David Carlisle Feb 14 '23 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 '23 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. – David Carlisle Feb 14 '23 at 14:52
  • if the goal is to get a three line "isomorphic def" or a "left right def arrow" in to Unicode, I'd say it wasn't worth persuing as it would be a multi-year endeavour with high probability of failure. (I realise all these comments are really for @AlbertNash not M.Logic but easier to comment here:-) – David Carlisle Feb 14 '23 at 15:03
  • @DavidCarlisle So it's not necessary to pursue such a goal. Also, there is Index of Symbols for readers to look up the meaning of an unfamiliar symbol in the good books. – M. Logic Feb 14 '23 at 15:08
  • @DavidCarlisle It's better to have a possibility to search for “≝” in the PDF than not to have this possibility. Searching for “def=“ or “def =“ leads to zero results if you don't use the Unicode symbol. As for introducing a new Unicode symbol “left-right double definition arrow” or “equivalent to by definition”, it has already been proposed in http://unicode.org/L2/L2006/06127-n3088.pdf . The Unicode committee simply has to revive this suggestion. –  Feb 14 '23 at 23:40
  • @AlbertNash getting new characters in to Unicode is a lot of work (I've done it) and I don't see how it would help search. I can't think of many interfaces where it's easier to search for than def and even if a def-arrow was added you would still need to search for def as the corpus of exsting douments, and existing generators would not change. U+225D is a Unicode 1 character inherited from some pre-unicode enoding. I'd be amazed if a new character encapsulating an English abbreviaton would be accepted. – David Carlisle Feb 15 '23 at 00:56
  • @DavidCarlisle I'm unable to do any work on improving Unicode myself (and, viewing my participation on tex.SE, you'd notice that I'm even unable to do any work on LaTeX except asking questions), and at the same time I can still vote (in the sense of showing interest) for the inclusion of a new symbol. At least one more person (completely unrelated to me) showed interest and made a suggestion a long time ago. –  Feb 15 '23 at 19:39
  • @DavidCarlisle For existing pre-{xe|lua}latex corpora, searching for math symbols in a PDF is a pointless task anyway, unrelated to ≝ and ⇔^{def}. For new documents, the ability to search for ⇔^{def} (similarly to ≝) would make a difference. Searching for “def” would give you also unrelated stuff (e.g., due to hyphenating "def-amation"), and if you think differently, notice that the document language need not be even English. We see U+225D already in the original 2-byte Unicode standard. Still, to me, it doesn't matter how or when the symbol U+225D appeared in Unicode. –  Feb 15 '23 at 19:44
  • @AlbertNash it matters to the process. Unicode 1 has many characters inherited from pre-unicode encodings that would not be added now. If U+225D had been added when the main math block was added in Unicode 3.x it would indcate it was acceptable, but U+225D is Unicode 1. You could try but I would be very surprised if any new def characters would be accepted. if you search for def as word, it's going to be far more useful than searching for ≝. – David Carlisle Feb 15 '23 at 19:57
  • The document you link to is explicitly a document of characters rejected from Azzeddine's otherwise succesful applicaton to add arabic math symbols to Unicode. – David Carlisle Feb 15 '23 at 20:03
  • @DavidCarlisle He was the author, and he has shown interest; cf. http://www.ucam.ac.ma/fssm/rydarab/doc/unicode/msl.pdf . As for what is better to search for, you can still search for “def” even if your document has ≝ and ⇔^{def} as symbols. In this case, you'd even be able to distinguish between “def” in normal text and “def” over “=” or “⇔”. In sufficiently large documents (huge books, collected works), you'd get positive counts for both. –  Feb 16 '23 at 13:42