4

According to the table on page 170 of the TeXbook, binary operators like + and - get a medium space around them when in text or display style, but not in a script style. And they only get that space when acting as a binary operator: when acting as a unary operator (eg. -1) they get no space.

This is great.

However, I have defined a custom binary operator which needs slightly different spacing in script style. In all other styles the default spacing works well, and when my operator acts as a unary operator the default also works well.

But when my custom operator is acting as a binary operator in script style, it needs an additional 1mu of space on either side. How can I achieve this?

As a follow-up question, what if I wanted to make that change global, so it applies to all binary operators in script style, adding 1mu of space on each side?

3
  • Welcome to tex.sx. Commented Nov 11, 2022 at 15:54
  • Please provide a minimal document that the community can use as a foundation to answer your question. It should show the default behaviour of a newly-defined, custom binary operator and show it in some environments where the spacing is okay, and where it's not. Can you do that? Helping the community helps getting you better answers. Commented Nov 11, 2022 at 16:02
  • you can adjust the logic here in luatex but not in classic tex Commented Nov 11, 2022 at 16:34

2 Answers 2

5

Regarding your first question, you can include the 1mu glue in your binary operator and compensate it with a -1mu glue in \nonscript mode:

\def\x{\mathbin x} \def\y{\mathbin{\nonscript\mskip-1mu\mskip1mu x\nonscript\mskip-1mu\mskip1mu}} \halign{$#$\hfil\cr a\x b = d_{a\x b}\cr a\y b = d_{a\y b}\cr} 

However, you must then always use \y as a binary operator and must use \x for the unary version.

enter image description here

Changing the behavior of all existing \mathbins (your second question) sounds like changing the TeX program.

2
  • Thanks for the idea. However, it appears that this approach adds the extra space even when it is used as a unary operator. That is, d_{\y b} puts unwanted space before and after the x. Commented Nov 11, 2022 at 16:41
  • Yes, I overlooked that and have augmented my answer. Commented Nov 11, 2022 at 16:46
5

If you are using LuaTeX then you can set the spacing for each pair of math atoms and for each math style individually. Your task: "to set 1mu around all binary operators in scriptstyle" can be set by:

\Umathordbinspacing\scriptstyle=1mu \Umathbinordspacing\scriptstyle=1mu \Umathordbinspacing\crampedscriptstyle=1mu \Umathbinordspacing\crampedscriptstyle=1mu 

See the section 7.5.2 of the LuaTeX manual for more information.

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.