2

I wish to typeset the following two operators:

  1. The increment operator: My naive attempt was \newcommand{\Incr}[1]{ #1\!+\!\!+ }. However, this caused many spacing problems in the sense that the spacing between the two pluses varied in the document, sometimes they were not even ligated. I want a solution that makes the space between the pluses a constant.
  2. The difference relation symbol: What I want should be clear from \newcommand{\Diff}[2]{ #1-\!\!-#2 }. However I face the similar issues here too.

Can you provide a solution to this?


Edit:

The highlighted in the following images are the intended usage. (The screenshots are taken from Tao's Analysis I.)

  1. The increment operator
  2. The difference relation symbol
6
  • 1
    you can use mathord + {#1}{+}{+} Jun 4, 2021 at 17:06
  • @DavidCarlisle Why do you write "mathord + ..."? Do you mean to further make {#1}{+}{+} an ordinary symbol like \mathord{{#1}{+}{+}}? (Is {...} the same as \mathord{...}?)
    – Atom
    Jun 5, 2021 at 2:43
  • Can you please show some examples of intended usage?
    – egreg
    Jul 5, 2021 at 7:52
  • @egreg The double plus operator is used for the increment operator in the Peano axioms. The difference relation symbol is used to denote the equivalence class of the equivalence relation on naturals that is used to create integers.
    – Atom
    Jul 6, 2021 at 2:27
  • @Atom OK, but that’s not what I asked, that is, some examples of usage. Even a sketch, if not code.
    – egreg
    Jul 6, 2021 at 8:12

3 Answers 3

1

The \doubleplus postfix operator seems just an ordinary symbol, so

\newcommand{\Incr}{{+}{+}}

is the simplest way to go.

For \Diff two minus signs with some negative space between them should be good:

\newcommand{\Diff}{{-}\mspace{-9mu}{-}}

Try different values of the negative space until you're satisfied.

In context:

\documentclass{article}
\usepackage{amsmath}

\newcommand{\Incr}{{+}{+}}
\newcommand{\Diff}{{-}\mspace{-9mu}{-}}

\begin{document}

for instance $3\Incr=4$

where $n\Incr$ actually \emph{redefines}

of the form $a\Diff b$ where

\end{document}

enter image description here

2
  • Thanks tons! This resolves my problem! But can you tell why you enclose minuses and pluses in {} in defining the new commands?
    – Atom
    Jul 6, 2021 at 8:57
  • 1
    @Atom That serves to tell TeX to forget the nature of the objects and treat them as ordinary symbols; for instance + is a binary operation symbol, but {+} is ordinary.
    – egreg
    Jul 6, 2021 at 9:08
0

For the difference operator, you can use e.g. $A \smallsetminus B$ (A \smallsetminus B) or $A \setminus B$ (A \setminus B) (both in the amssymb package). In general, for binary math operators use \DeclareMathOperator (it adds required spacing around it), in amsmath.

1
  • 4
    \DeclareMathOperator is definitely not for binary operation symbols.
    – egreg
    Jun 4, 2021 at 17:35
0

For the increment operator, you might try \doubleplus, from unicode-math, stix and several other packages.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .