Suppose I need some crazy custom symbol for personal use.

e.g. when I write \foobar, LaTeX should show the symbol.

How do I achieve this?


3 Answers 3


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

  • 1
    save what as a pdf? Mar 16, 2011 at 9:36
  • 2
    @MachineCharmer: Your "crazy custom symbol."
    – TH.
    Mar 16, 2011 at 9:38
  • Will it work if I use crazycustomsymbol.png instead of crazycustomsymbol.pdf? Mar 16, 2011 at 10:01
  • 4
    You may need to add this line: \newcommand*\foobar{\vcenter{\hbox{\includegraphics{xxxx.png}}}} so that the new symbol is aligned with text. May 19, 2015 at 4:24
  • 3
    In addition to answer 1: make your symbol adjust to font size by setting width or height of the included graphics to a multiple of em or ex: \newcommand*\foobar{\includegraphics[width=.8em]{crazycustomsymbol}}
    – Ute
    Feb 2, 2016 at 4:47

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



\draw (0,0) -- (1ex,1ex);%
\draw (0.5ex,0) -- (1.3ex,0.8ex);%
Some text and the symbol \foo{} or scaled \foo{scale=2}

enter image description here

  • I'm glad you mentioned this. I was going to, but as I don't actually know TikZ or pstricks, I figured I'd let someone else.
    – TH.
    Mar 16, 2011 at 10:05
  • I do exactly this! I have customised \Implies and \Iff to make them a bit larger and longer for presentations. Mar 16, 2011 at 10:31
  • 2
    I gues that tikz will re-compute the symbol each time you use it. Is it possible to "evaluate" the tikzpicture once and then reuse it? Mar 16, 2011 at 11:11
  • Yes it will. You can of course create a pdf picture from your tikz drawing and include it. Also tikz has a externalize library that will evaluate the picture once, creates a pdf from it and inlcudes the pdf-picture in future compiling processes. I guess this would be a bit much for a symbol, so if you like tikz, create the symbol in an extra document and use pdfcrop to trim the resulting pdf.
    – Martin H
    Mar 16, 2011 at 11:19
  • 3
    Now the real question: how to respect the current font size? Without creating a custom font, that is … Mar 16, 2011 at 13:38

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:


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.

  • 3
    You could use ex or em as unit for the \kern to get font size relative kerning. Also \rlap could be used to simply lap the second symbol over the first. Mar 16, 2011 at 10:51
  • @Martin Scharrer: Thanks, I have updated my answer to use proportional units. I attempted to use \rlap but for some reason the glyphs were set on different lines. Moreover, the glyphs were (predictably) left-aligned and thus the star was off-centre and in need of kern. As such I am not sure that \rlap constitutes a better method. Mar 16, 2011 at 11:04
  • Yes, \rlap alone only works well when the symbols have approximately the same width. See this answer of mine where I use a box to center one symbol on top of another one. Mar 16, 2011 at 11:10
  • @Martin Scharrer: would using muskips be better/worse? Mar 16, 2011 at 11:13
  • 1
    @Bruno: in general, using relative units in the same mode or direction is always a good idea. so, in math, mu, in horizontal text mode, em, and in vertical text mode, ex. then they will scale properly when you change the base size. Mar 16, 2011 at 12:53

You must log in to answer this question.

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