4

I am trying to implement this code taken from https://mathoverflow.net/q/64544/101848:

\usepackage{mathabx,epsfig}
\def\acts{\mathrel{\reflectbox{$\righttoleftarrow$}}}

so that G\acts X yields

2

The problem is that loading mathabx has the side effect of importing all symbols from mathabx. For example, it changes the default LaTeX \to, which is enter image description here, to the symbol enter image description here. A similar change happens to the default LaTeX \mapsto and it also changes the default LaTeX \in.

How could I have what the \acts command does without loading the rest of the mathabx symbols?

1
  • 1
    Be aware that epsfig only exists for compatibility of 25+ year old documents. Don't load it in new documents.
    – egreg
    Commented Jul 8, 2021 at 16:53

3 Answers 3

4

The importing code can be improved to use the font at any size. Also the definition of \acts can be improved to make a symbol that correctly scales in subscripts and superscripts.

\documentclass{article}
\usepackage{amsmath,graphicx}

\DeclareFontFamily{U}{mathb}{}
\DeclareFontShape{U}{mathb}{m}{n}{
     <-5.5> mathb5
  <5.5-6.5> mathb6
  <6.5-7.5> mathb7
  <7.5-8.5> mathb8
  <8.5-9.5> mathb9
  <9.5-11>  mathb10
  <11->     mathb12
}{}
\DeclareSymbolFont{mathb}{U}{mathb}{m}{n}
\DeclareMathSymbol{\lefttorightarrow}{3}{mathb}{"FC}
\DeclareMathSymbol{\righttoleftarrow}{3}{mathb}{"FD}

\makeatletter
\DeclareRobustCommand{\looparrow}[1]{%
  \mathrel{\mathpalette\looparrow@{#1}}%
}
\newcommand{\looparrow@}[2]{\reflectbox{$\m@th#1#2$}}
\makeatother

\newcommand{\acts}{\looparrow{\righttoleftarrow}}
\newcommand{\foo}{\looparrow{\lefttorightarrow}}

\begin{document}

$G\acts X$

$X\foo G$

$A_{G\acts X}$

\end{document}

enter image description here

Maybe you don't need the reverse symbol, but it comes almost for free.

Don't use \def and you'll be happier.

5
  • I don't know about the OP, but I would be very unhappy without \def. But thorough, complete answer as usual +1. Commented Jul 8, 2021 at 20:10
  • I don't understand what you mean @StevenB.Segletes . Isn't it the same on this case to either use \def or \newcommand? Commented Jul 9, 2021 at 7:37
  • What is the graphicx package for? Commented Jul 9, 2021 at 7:38
  • 1
    @ElíasGuisado With \def you’re not informed whether the command already exists and you can incur into seroius and weird problems. Since the code uses \reflectbox, the graphicx package is needed. Not epsfig that is obsolete.
    – egreg
    Commented Jul 9, 2021 at 7:45
  • @ElíasGuisado \newcommand does extra checking to make sure the definition does not already exist. If it does, \renewcommand is required. So there are two places where I would miss \def if it did not exist: 1) where I reuse a macro as an intermediate variable. In such cases, I need extra logic to determine whether to use \newcommand or \renewcommand (basically, extra typing to initialize the macro), and 2) for delimited arguments such as \def#1\relax{}, where the argument is not one token nor group, but a set of tokens up to the point where \relax is found. I use that a lot. Commented Jul 9, 2021 at 12:47
1

The ⟳ symbol (Clockwise gapped circle arrow) is also in unicode-math (and the legacy packages stix and stix2) as \cwgapcirclearrow. You can therefore use:

\documentclass{article}
\usepackage{unicode-math}

\setmathfont{STIX Two Math}

\begin{document}
\[ G \cwgapcirclearrow X \]
\end{document}

STIX Two Math sample

To import only this one symbol from a font that has it (such as STIX Two Math, XITS Math or New Computer Modern Math), you can use the range= option of \setmathfont:

\documentclass{article}
\usepackage{unicode-math}

\setmainfont{Erewhon}
\setmathfont{Erewhon Math}
\setmathfont{STIX Two Math}[ range = \cwgapcirclearrow,
                             Scale = MatchUppercase ]

\begin{document}
\[ G \cwgapcirclearrow X \]
\end{document}

Erewhon Math + STIX Two Math sample

0

Mimicking what is done in https://tex.stackexchange.com/a/14388/150120, I have come with the following code for the preamble which solves the problem:

\DeclareFontFamily{U}{mathb}{\hyphenchar\font45}
\DeclareFontShape{U}{mathb}{m}{n}{
      <5> <6> <7> <8> <9> <10> gen * mathb
      <10.95> mathb10 <12> <14.4> <17.28> <20.74> <24.88> mathb12
      }{}
\DeclareSymbolFont{mathb}{U}{mathb}{m}{n}

\DeclareMathSymbol{\righttoleftarrow}{3}{mathb}{"FD}

\def\acts{\mathrel{\reflectbox{$\righttoleftarrow$}}}

The six first lines of code are taken from the mathabx.sty file available at CTAN: https://www.ctan.org/tex-archive/fonts/mathabx/texinputs.

The "FD code for \righttoleftarrow was found looking for it in the mathabx.dcl file (also available in the last link).

I am posting this answer because the six first lines of code above are not exactly the same ones as those from the quoted TSE answer. The ones here are for mathb whereas the ones from the other TSE answer are for matha. I copied at first the code from the other TSE answer and it took me a while before realizing a little change was needed.

1
  • 1
    If you convert your code snippet into a working example, I'm sure you will get more votes. Commented Jul 8, 2021 at 16:50

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