# [Tex/LaTex] How to use a custom, scalable, symbol in LaTeX

fontssvgsymbols

I want to use a custom symbol in my document that is treated like any other letter or math symbol by LaTeX. I do not want to superimpose existing symbols in order to create a new one but rather create one from scratch.

Is there a way to just create the symbol using, say, Inkscape and tell LaTeX to print that when I call a specific macro? There is of course the possibility of using \includegraphics[height=1em], but I imagine that that is not a very effective approach. Can I let LaTeX use my symbol like any other math symbol?

Do I have to create an entire font (consisting of only one character) or is it possible to this in a simpler manner?

This solution demonstrates how an \includegraphics approach could be made to work conveniently.

If the new symbol should conform to the vertical extent of an existing glyph, then this approach will work handily. In the MWE, I make the symbol \schtreber conform to the height of a "b" and then a "g", respectively. It will scale with math style.

If the symbol is a relation or operator, the definition could include a \mathrel or \mathop.

\documentclass{article}
\usepackage{scalerel}
\begin{document}
\def\schtreber{\scalerel*{\includegraphics{schtreber}}{b}}

$ab\schtreber c \scriptscriptstyle ab\schtreber c$

$y = x^{\schtreber}$

\def\schtreber{\scalerel*{\includegraphics{schtreber}}{g}}

$ab\schtreber c \scriptscriptstyle ab\schtreber c$

$y = x^{\schtreber}$

\end{document}


If the vertical extent is to be arbitrary, a \rule may be used for the target size, where \LMpt (local-mathstyle pts) or \LMex (local-mathstyle ex's) are used to define the dimensions of the rule. Here I place the image in a \savebox initially, in the event that some flavors of TeX don't save a local copy from \includegraphics.

\documentclass{article}
\usepackage{scalerel}
\newsavebox\schtreberbox
\savebox\schtreberbox{\includegraphics{schtreber}}
\def\schtreber{\scalerel{\usebox{\schtreberbox}}{\rule[-2\LMpt]{0pt}{8\LMpt}}}
\begin{document}
$ab\schtreber c \scriptscriptstyle ab\schtreber c$\par
$y = x^{\schtreber}$
\end{document}


The advantage of the former, rather than the latter approach is that the method will also work in both text and math mode, as expected:

\documentclass{article}
\usepackage{scalerel}
\newsavebox\schtreberbox
\savebox\schtreberbox{\includegraphics{schtreber}}
\def\schtreber{\scalerel*{\usebox{\schtreberbox}}{b}}
\begin{document}
$ab\schtreber c \scriptscriptstyle ab\schtreber c$\par
$y = x^{\schtreber}$

In text\schtreber, \LARGE text\schtreber.
\end{document}