3

I'm trying to use planetary and zodiacal symbols in mathematical formulae and tikz diagrams. I found a useful code online on how to declare the characters of the starfont package as mathematical symbols:

\documentclass{article}
\usepackage[starfontserif]{starfont}
\usepackage{amsmath}

\DeclareSymbolFont{starfontsym}{OT1}{sts}{m}{n}
\DeclareMathSymbol{\mathSun}{\mathord}{starfontsym}{115}
\DeclareMathSymbol{\mathMercury}{\mathord}{starfontsym}{102}
\DeclareMathSymbol{\mathVenus}{\mathord}{starfontsym}{103}
\DeclareMathSymbol{\mathTerra}{\mathord}{starfontsym}{76}
\DeclareMathSymbol{\mathMoon}{\mathord}{starfontsym}{100}
\DeclareMathSymbol{\mathMars}{\mathord}{starfontsym}{104}
\DeclareMathSymbol{\mathJupiter}{\mathord}{starfontsym}{106}
\DeclareMathSymbol{\mathSaturn}{\mathord}{starfontsym}{83}


\begin{document}


\begin{align}
    & \mathSaturn : g_\mathSaturn, \quad \mathTerra : g_\mathTerra
\end{align}

\begin{align}
    &\frac{\Delta m_\mathSaturn}{m-m_\mathTerra} = \left( 1 - e^{-\frac{\Delta v_\mathSaturn}{I_{\mathrm{sp}}g_\mathTerra}} \right)
\end{align}

\end{document}

The issue I have is that although this example code is very insightful, it does not specify where the compiler got the symbol numbers from for starfont to allow us to add other characters like zodiacal signs to the list of declared symbols. The starfont documentation is also not helpful in that it does not give the codes for each character. There is a pdf table of all the available symbols in the font available with the starfont package, but the numbers don't correspond to the ones the compiler of the above code used.

Does anyone know where I can get the full list of numbers for each symbol in the starfont package from?

8

1 Answer 1

2

The font comes with the table of characters in its documentation. But even if there wasn't you can make it.

\documentclass{article}
\usepackage[starfontserif]{starfont}

\usepackage{fonttable}

\begin{document}

\xfonttable{OT1}{sts}{m}{n}

\end{document}

The table this produces shows the code points in octal, hexadecimal and decimal.

enter image description here

If you look for 115 in the table, you find

enter image description here

Of course you want to first find the symbol you need and then read the number next to it that will be fed to \DeclareMathSymbol.

Alternative way that doesn't need font table lookup

You can also retrieve the number without looking up the font table, but just the symbol names in the package.

It turns out that the package does the equivalent of

\newcommand{\Sun}{{\stchar 115}}

so you just want to have an automatic translation.

Here's how.

\documentclass{article}
\usepackage[starfontserif]{starfont}
\usepackage{amsmath}

\DeclareSymbolFont{starfontsym}{OT1}{sts}{m}{n}

\ExplSyntaxOn
\NewDocumentCommand{\DeclareStarSymbol}{m}
 {
  \coenraad_starsymbol:cN { math\cs_to_str:N #1 } #1
 }
\cs_new_protected:Nn \coenraad_starsymbol:NN
 {
  \DeclareMathSymbol{#1}{\mathord}{starfontsym}{\exp_after:wN \tl_tail:n #2}
 }
\cs_generate_variant:Nn \coenraad_starsymbol:NN {c}
\ExplSyntaxOff

\DeclareStarSymbol{\Sun}
\DeclareStarSymbol{\Mercury}
\DeclareStarSymbol{\Venus}
\DeclareStarSymbol{\Terra}
\DeclareStarSymbol{\Moon}
\DeclareStarSymbol{\Mars}
\DeclareStarSymbol{\Jupiter}
\DeclareStarSymbol{\Saturn}

\begin{document}

\begin{align}
    & \mathSaturn : g_\mathSaturn, \quad \mathTerra : g_\mathTerra
\end{align}

\begin{align}
    &\frac{\Delta m_\mathSaturn}{m-m_\mathTerra} = \left( 1 - e^{-\frac{\Delta v_\mathSaturn}{I_{\mathrm{sp}}g_\mathTerra}} \right)
\end{align}

\end{document}

enter image description here

4
  • see the OP's comment under my comment where I also pointed at this table, he needs advice on how to read the layout Commented Jun 23 at 15:17
  • @DavidCarlisle Well, with fonttable the code point in decimal format is there just to be read.
    – egreg
    Commented Jun 23 at 15:23
  • 2
    ah true. maybe I need instructions on how to read this version of the font table layout:-) Commented Jun 23 at 15:25
  • Thank you! That's very helpful! Commented Jun 24 at 8:15

You must log in to answer this question.

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