如何从“mathabx”包中仅提取天文符号?

如何从“mathabx”包中仅提取天文符号?

通过分析我的文档,我注意到小于或等于符号leq以不合理的方式打印,因为该mathabx包覆盖了其他数学包。我只需要从mathabx包中提取天文符号(参见以下从包文档中截取的屏幕截图): astrosymbols_from_mathabx

leq这里是我的 MWE,我注意到当包处于活动状态时会产生不同的符号(倾斜等号而不是水平等号)mathabx

\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}

您能否演示如何从mathabxisuch 中仅提取天文符号以避免覆盖其他命令?

答案1

我们mathabx.dcl发现

\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}

好的,现在我们想看看mathb指的是什么,我们在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}

现在只需重构即可将字体用作文本。

\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}

在此处输入图片描述

答案2

正如您所提到的,mathabx以不理想的方式重新定义所有数学符号。您可以:a)mathabx使用另一个不重新定义数学符号且包含天文符号(如wasysymmarvosymstarfont包)的包替换该包 b) 保留mathabx包但使用lualatexxelatex和加载mathabx包后将unicode-math重新定义数学符号。

答案3

如果您可以使用 LuaLaTeX 或 XeLaTeX,则可以从 Unicode 加载大多数这些符号。这里有一个模板,它以相同的名称定义了其中的大多数符号,但采用文本模式。

\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 样本

相关内容