有些场景,我们希望让图片作为上标出现在公式或者文字上标里,该如何操作,看看下面的例子:
\documentclass{article}
\usepackage{graphicx,scalerel}
\newcommand\mysymbol{\scalerel*{\includegraphics{example-image}}{X}}
\begin{document}
\[
A\mysymbol^2 = e^{-2\mysymbol x}
\]
\end{document}
例子2:
\documentclass{article}
\usepackage{graphicx,scalerel,trimclip}
\newcommand\mysymbol{%
\scalerel*{\clipbox{30pt 0pt 70pt 0pt}{\includegraphics{example-image}}}{X}}
\begin{document}
\[
A\mysymbol^2 = e^{-2\mysymbol x}
\]
\end{document}
选自:https://tex.stackexchange.com/questions/479824/setting-superscript-for-custom-symbol