2

I wish to tag an equation with a rescaled hieroglyph (most custom symbols from hieroglf are way too tall for my liking). However, when I compile

\documentclass{book}

\usepackage{amsmath,graphicx,hieroglf,cleveref}

\begin{document}
    \begin{equation}\label{eq:Einstein}
        E=mc^2\tag{\scalebox{0.6}{\textpmhg{\Ha}\!}}
    \end{equation}
    As we see from \cref{eq:Einstein}, 
\end{document}

I get the following bad error messages:

Use of \label@optarg doesn't match its definition. \end{equation}

Argument of \Gscale@box has an extra }. \end{equation}

Paragraph ended before \Gscale@box was complete. \end{equation}

etc. This confuses me greatly, because I do not see an immediate fix of this... protecting the tag with a group {} does not work. Can you help me?

5
  • Which TeX distribution do you employ? I ask because I don't experience any problems when I compile your code -- nice MWE, by the way! -- on my machine (MacBook Air M2, MacOS 14.1.2 "Sonoma", and MacTeX2023 with all updates installed).
    – Mico
    Dec 2, 2023 at 17:41
  • It is an older distribution, probably MacTeX2017... how may I check the exact year?
    – giobrach
    Dec 2, 2023 at 17:45
  • Check the first line in the log file. Mine says: This is pdfTeX, Version 3.141592653-2.6-1.40.25 (TeX Live 2023) (preloaded format=pdflatex 2023.11.25) 2 DEC 2023 18:38. Note the substring "TeX Live 2023". MacTeX is TeXLive, with the added bonus of some visual utilities.
    – Mico
    Dec 2, 2023 at 17:57
  • For me, it reads: This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018) (preloaded format=pdflatex 2018.8.2) 2 DEC 2023 19:16. (I should specify that I am not able to update my distribution as of now, because it would probably destroy some important documents that I need to be correctly compiled very shortly. I will think about switching to MacTeX during the holidays...)
    – giobrach
    Dec 2, 2023 at 18:16
  • 1
    there is no error in an up to date texlive 2023, but possbly in older releases use \tag{\foo} with \DeclareRobustCommand\foo{\scalebox{0.6}{\textpmhg{\Ha}\!} Dec 2, 2023 at 18:31

1 Answer 1

2

Make the command robust and scale using \fontsize.

\documentclass[twocolumn]{article}

\usepackage{amsmath,graphicx,hieroglf,cleveref}

\makeatletter
\newcommand{\hiersize}{\fontsize{\fpeval{0.6*\f@size}}{0}\selectfont}
\makeatletter

\NewDocumentCommand{\hier}{m}{\textpmhg{\hiersize#1\!}}

\begin{document}

\begin{equation}\label{eq:Einstein}
E=mc^2\tag{\hier{\Ha}}
\end{equation}
As we see from \cref{eq:Einstein},

\end{document}

enter image description here

Will your readers know how to read that symbol?

If you only plan to use hieroglyphs at that size, it makes sense to load the fonts already scaled down.

\documentclass[twocolumn]{article}
\usepackage{amsmath}
\usepackage{hieroglf}
\usepackage{cleveref}

\DeclareFontFamily{OT1}{pmhg}{}
\DeclareFontShape{OT1}{pmhg}{m}{n}{ <-> s*[0.6] pmhg }{}
\DeclareFontFamily{T1}{pmhg}{}
\DeclareFontShape{T1}{pmhg}{m}{n}{ <-> s*[0.6] pmhg }{}

\NewDocumentCommand{\hier}{m}{\textpmhg{#1\!}}

\begin{document}

\begin{equation}\label{eq:Einstein}
E=mc^2\tag{\hier{\Ha}}
\end{equation}
As we see from \cref{eq:Einstein},

\end{document}
2
  • +1 for "Will your readers know how to read that symbol?" :-)
    – Mico
    Dec 2, 2023 at 19:02
  • 1
    @Mico Amazingly, yes! :)
    – giobrach
    Dec 3, 2023 at 20:50

You must log in to answer this question.

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