How to add a custom symbol to LaTeX?

As TH mentioned, you can create a graphic in an external program and include it as a picture. Preferably you would use a vector drawing software such as adobe illustrator or the (free) software inkscape. This way scaling the image will not change the quality (don't use raster graphics such as jpg).

Of course you can also use a code based approach e.g. with the tikz or pstricks package

\documentclass{scrartcl}

\usepackage{tikz}

\newcommand{\foo}[1]{%
\begin{tikzpicture}[#1]%
\draw (0,0) -- (1ex,1ex);%
\draw (0.5ex,0) -- (1.3ex,0.8ex);%
\end{tikzpicture}%
}
\begin{document}
Some text and the symbol \foo{} or scaled \foo{scale=2}
\end{document}

enter image description here


Simplest way would be to save it as a pdf (or eps if you're using latex) and then define

\newcommand*\foobar{\includegraphics{crazycustomsymbol}}

Yet another way of including custom symbols is by composing new ones through superimposing glyphs, which is demonstrated in the symbols-a4 manual on page 103.

Here's an example:

\newcommand{\starcup}{$\sqcup$\kern-0.58em{$\star$}}

Which gives:

starcup is an all new glyph

As Martin Scharrer points out, the use of ex or em as a unit for kerning respects the font size. You can also use (as I did in the first revision of this example) points for absolute positioning.

Tags:

Symbols

Macros