I'm trying to create a new symbol that simply combines a number with a triangle, by placing the number inside the triangle. It should work in math-mode (text mode would be nice, but not required).
I've tried the following:
\documentclass{article}
\usepackage{graphicx}
\newcommand{\trinum}[1]{%
\triangle\hspace{-.57em}\raisebox{0.1em}{\scalebox{.5}{#1}}
}
\begin{document}
Works fine in default environment
\[
\trinum{1} \qquad \trinum{2} \qquad \trinum{3}
\]
Slightly shifted when used in Huge environment:
{\Huge
\[
\trinum{1} \qquad \trinum{2} \qquad \trinum{3}
\]
}
Slightly shifted when used in tiny environment:
{\tiny % I know, it's too small to read, but just used as a check
\[
\trinum{1} \qquad \trinum{2} \qquad \trinum{3}
\]
}
Messed up when used as subscript or super script
\[
\trinum{1} \qquad x_\trinum{1} \qquad x^\trinum{1}
\]
\end{document}
As you can see, it doesn't work nicely for scaled text and very badly for superscript and subscript. I was wondering if there is a better way of doing this.


\ooalignis exactly what I was looking for. Unfortunately, sometimes it's hard to find commands if you don't know how they could be called! – JJM Driessen Aug 29 '15 at 11:37Missing } inserted. I can't seem to retrieve the error. It happens whenever I run the script even when the function is only called once (e.g.\trinum{1}). Without using the function, the errors are not triggered. Changing the engine doesn't affect the problem either. – JJM Driessen Aug 29 '15 at 12:05