2

In this thread we learned how to create our own math symbol. Now the question is how we force it to scale appropriately when used in sub- or superscript:

See the following example:

\documentclass[12pt]{article}%, border=2pt]{standalone}
\usepackage{graphics}

\DeclareRobustCommand{\triangleLeft}{\ensuremath{\includegraphics{triangleLeft}}}

\begin{document}
$\triangleLeft_{x}$
$X_{\triangleLeft_{x}}$

\begin{figure}
\caption{$\triangleLeft_{x}$ test}
\end{figure}

\end{document}

As we see in the result. The image is equally big in the subscript but it should be scaled down a little bit.

Do you have any ideas how I can fix this?

Kind regards and Thanks, Max

1 Answer 1

3

The features of scalerel can accomplish this.

\documentclass[12pt]{article}%, border=2pt]{standalone}
\usepackage{MnSymbol}
\usepackage{sansmath}
\usepackage{stackengine, amsfonts,scalerel} %
\newcommand{\leftharpoontriangleX}{\mathord{\ensurestackMath{%
  \stackinset{c}{0pt}{c}{-0.3ex}{\scriptstyle\leftharpoonup}%
  {\largetriangleup}}}}
\newcommand{\rightharpoontriangleX}{\mathord{\ensurestackMath{%
  \stackinset{c}{0pt}{c}{-0.3ex}{\scriptstyle\rightharpoonup}%
  {\largetriangleup}}}}
\newcommand{\leftharpoontriangle}{%
  \scalerel*{\leftharpoontriangleX}{\largetriangleup}}
\newcommand{\rightharpoontriangle}%
  {\scalerel*{\rightharpoontriangleX}{\largetriangleup}}
\begin{document}

\sansmath
 $ \rightharpoontriangle_{\!x}\quad\leftharpoontriangle_{\!x}$

 $ x_{\rightharpoontriangle}\quad x_{\leftharpoontriangle}$

 $ y_{ x_{\rightharpoontriangle}\quad x_{\leftharpoontriangle}}$
\end{document} 

enter image description here

You must log in to answer this question.

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