1

By analyzing my document I noticed that the less or equal symbol leq is printed in undesiderate way becuase the mathabx package overwrites other mathematical packages. I need to extract only astronomical symbols from mathabx package (see following screenshot taken from the package documentation): astrosymbols_from_mathabx

Here is my MWE where I noticed the different symbols (slant equal sign instead of horizontal) produced by leq if the mathabx package is active:

\documentclass[11pt,oneside]{book}
\usepackage[intlimits]{amsmath}
\usepackage{amsfonts}
\usepackage{amsbsy}
\usepackage{fixmath}
\usepackage{mathtools}
\usepackage{empheq}
\usepackage{mathabx} % enable astronomy symbols


\begin{document}

$\leq$

\end{document}

Can you show how to extract only astronomical symbols from mathabx isuch as to avoid to overwrite other commands?

2

3 Answers 3

2

In mathabx.dcl we find

\DeclareMathSymbol{\Sun}           {0}{mathb}{"40}
\DeclareMathSymbol{\Mercury}       {0}{mathb}{"41}
\DeclareMathSymbol{\Venus}         {0}{mathb}{"42}
        \mathabx@aliases\Venus\girl
\DeclareMathSymbol{\Earth}         {0}{mathb}{"43}
\DeclareMathSymbol{\Mars}          {0}{mathb}{"44}
        \mathabx@aliases\Mars\boy
\DeclareMathSymbol{\Jupiter}       {0}{mathb}{"45}
\DeclareMathSymbol{\Saturn}        {0}{mathb}{"46}
\DeclareMathSymbol{\Uranus}        {0}{mathb}{"47}
\DeclareMathSymbol{\Neptune}       {0}{mathb}{"48}
\DeclareMathSymbol{\Pluto}         {0}{mathb}{"49}
\DeclareMathSymbol{\varEarth}      {0}{mathb}{"4A}
\DeclareMathSymbol{\leftmoon}      {0}{mathb}{"4B}
        \mathabx@aliases\leftmoon\Moon
\DeclareMathSymbol{\rightmoon}     {0}{mathb}{"4C}
\DeclareMathSymbol{\fullmoon}      {0}{mathb}{"4D}
\DeclareMathSymbol{\newmoon}       {0}{mathb}{"4E}

OK, now we want to see what mathb refers to, which we find in mathabx.sty

\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}
\DeclareFontSubstitution{U}{mathb}{m}{n}

Now it's just a matter of refactoring to just use the font as a text one.

\documentclass{article}


\DeclareFontFamily{U}{mathb}{}
\DeclareFontSubstitution{U}{mathb}{m}{n}
\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
}{}

\newcommand{\mathbsymbol}[1]{{\usefont{U}{mathb}{m}{n}\symbol{#1}}}
\DeclareRobustCommand{\Sun}{\mathbsymbol{"40}}
\DeclareRobustCommand{\Mercury}{\mathbsymbol{"41}}
\DeclareRobustCommand{\Venus}{\mathbsymbol{"42}}
\DeclareRobustCommand{\Earth}{\mathbsymbol{"43}}
\DeclareRobustCommand{\Mars}{\mathbsymbol{"44}}
\DeclareRobustCommand{\Jupiter}{\mathbsymbol{"45}}
\DeclareRobustCommand{\Saturn}{\mathbsymbol{"46}}
\DeclareRobustCommand{\Uranus}{\mathbsymbol{"47}}
\DeclareRobustCommand{\Neptune}{\mathbsymbol{"48}}
\DeclareRobustCommand{\Pluto}{\mathbsymbol{"49}}
\DeclareRobustCommand{\varEarth}{\mathbsymbol{"4A}}
\DeclareRobustCommand{\leftmoon}{\mathbsymbol{"4B}}
\NewCommandCopy{\Moon}{\leftmoon}
\DeclareRobustCommand{\rightmoon}{\mathbsymbol{"4C}}
\DeclareRobustCommand{\fullmoon}{\mathbsymbol{"4D}}
\DeclareRobustCommand{\newmoon}{\mathbsymbol{"4E}}

\begin{document}

\Sun\Mercury\Venus\Earth\Mars\Jupiter\Saturn\Uranus\Neptune\Pluto\Moon

\leftmoon\rightmoon\fullmoon\newmoon

\end{document}

enter image description here

2
  • Hi @egreg, can you show how to modify your code to use the symbols in math mode? I want to use $\Sun$ instead of \Sun. With the present code, if I type $\Sun$ I get the undesiderate symbol @.
    – g_don
    Nov 20, 2022 at 19:01
  • 1
    @Giuseppe Change into \newcommand{\mathbsymbol}[1]{\text{\usefont{U}{mathb}{m}{n}\symbol{#1}}} and, of course, load amsmath
    – egreg
    Nov 20, 2022 at 21:06
3

As you mentioned, mathabx redefines all math symbols in an undesirable way. You can: a) change the mathabx package with another that does not redefine math symbols and does contain astronomical symbols like wasysym or marvosym or starfont packages b) keeping mathabxpackage but employ lualatex or xelatex and loading after mathabx package unicode-math which will redefine back the math symbols.

2
  • Hi @Miltos P., thank for your answer. I 'd like to keep mathabx astronomical symbols. Can you kindly show an example how to extract a single command (e.g. \Sun) and avoid to load the entire package?
    – g_don
    Nov 18, 2022 at 21:38
  • 1
    No you can't do that (from what I know). You can use xelatex or lualatex instead of pdflatex in this case and then load after the mathabx the unicode-math. Do you want help with that? Have you ever used lualatex or xelatex?
    – miltos
    Nov 18, 2022 at 21:47
1

If you can use LuaLaTeX or XeLaTeX, you can load most of these symbols from Unicode. Here’s a template that defines the majority of them with the same names, but in text mode.

\documentclass{article}
\tracinglostchars=3
\usepackage{fontspec}

\newfontfamily\varearthfont{Libertinus Serif}[Scale=MatchLowercase]
\newfontfamily\astrofont{Everson Mono}[Scale=MatchUppercase] % Actually contains U+1F728.

\newcommand\Sun{{\astrofont\symbol{"2609}}}
\newcommand\Mercury{{\astrofont\symbol{"263F}}}
\newcommand\Venus{{\astrofont\symbol{"2640}}}
\newcommand\Earth{{\astrofont\symbol{"1F728}}} % Could instead substitute \oplus.
\newcommand\Mars{{\astrofont\symbol{"2642}}}
\newcommand\Jupiter{{\astrofont\symbol{"2643}}}
\newcommand\Saturn{{\astrofont\symbol{"2644}}}
\newcommand\Uranus{{\astrofont\symbol{"26E2}}}
\newcommand\Neptune{{\astrofont\symbol{"2646}}}
\newcommand\Pluto{{\astrofont\symbol{"2647}}}
\newcommand\varEarth{{\varearthfont\symbol{"2641}}} % Wukipeia thinks this is for a fictitious planet “Proserpina.”
\newcommand\Moon{{\astrofont\symbol{"263D}}}
\newcommand\leftmoon{{\astrofont\symbol{"263D}}}
\newcommand\rightmoon{{\astrofont\symbol{"263E}}}

\begin{document}
The planets: \Mercury\Venus\Earth\varEarth\Mars\Jupiter\Saturn\Uranus\Neptune\Pluto

Other Celestial bodies: \Sun\leftmoon\rightmoon
\end{document}

Everson Mono/Libertinus Serif sample

You must log in to answer this question.

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