TransWikia.com

How to define operators which contain pluses or minuses only in their symbols, or that have arguments at both side of their names?

TeX - LaTeX Asked on July 15, 2021

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

3 Answers

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 $3Incr=4$

where $nIncr$ actually emph{redefines}

of the form $aDiff b$ where

end{document}

enter image description here

Correct answer by egreg on July 15, 2021

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.

Answered by vonbrand on July 15, 2021

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

Answered by Davislor on July 15, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP