I have some figures, for e.g., finite graphs, lattices or knots, that I have drawn in eps (or pdf) format. I would ideally love to have maps indexed by these figures. However, these figures are not part of the usual LaTeX symbol set(s). Is there a way to incorporate this? For example, if I have drawn a trefoil knot and I want to write something like $f_{trefoil}$ (or perhaps a more complicated code) which upon processing this should look like what I want, what do I need to do?

P.S. Feel free to retag this question as you see fit.

  • Thanks for all the great answers. I'll perhaps try out all of them at some point of time. Oct 16, 2011 at 7:02

4 Answers 4


Assuming that the trefoil picture is in the file trefoil.pdf (the extension can be any accepted by the engine you're using), you can define the symbol at various sizes


Then $f_{\trefoil}+\trefoil$ will do. Adjust the heights to what seems best to you.

It should be noted that \includegraphics builds a box that can be used everywhere, not only inside figure environments. You can see also the adjustbox package for more options related to positioning the picture.

  • Why can't use this in section environment? @egreg
    – Andrea Leo
    Jan 4, 2018 at 10:59
  • @AndreaLeo \protect\trefoil when in a moving argument; or replace \newcommand with \DeclareRobustCommand
    – egreg
    Jan 4, 2018 at 12:19

You could create your own symbol font as described in Create a symbol font from SVG symbols. For this you can draw these symbols as pictures first and have them placed one per page using the preview package. Afterwards turn them into SVG format using a suitable converted like e.g. with InkScape using inkscape --export-svg file.svg file.pdf.

When you have the font you can just define named macros for every symbol and use these macros in the equations.


(I wanted to post a picture so need to use the "answer" rather than "comment" section, but this is really just a comment.)

I'm not sure how this would look. I just tried it with a trefoil and found that f_{\trefoil} was quite hard to see that it was a trefoil.

trefoil as subscript

However, if that is good enough - it's certainly clear that that's a knot and would be distinct from, say, a figure 8 (though not from the other trefoil) - then I did the above using TikZ and it wouldn't be hard to figure out some stylised symbols that at least bore some resemblance to the original diagrams.

But it might be easier simply to scan through the unicode symbols and choose some that looked at least vaguely similar.

  • Thanks but the trefoil was perhaps a bad example on my part as I have figures of graphs that are typically not, to the best of my knowledge, part of the unicode symbols. Oct 13, 2011 at 18:08
  • @SomnathBasu: The trefoil is not in the unicode list as far as I can tell. What I did above was take a drawing that I have of the trefoil and reproduce it as a subscript to the f. So I was trying exactly what you described. It was really just a comment to say, "Are you sure that this is what you want to do?". It is, as egreg says, perfectly possible, but I'm questioning the advisability. That's why this was really meant as a comment, not an answer. Oct 13, 2011 at 18:26
  • @ Andrew - Sorry for the misunderstanding! I get what you're saying now. But the figures I have are really objects which are not listed in unicode. Other than what you did (or what egreg suggested), what else can I do? Oct 13, 2011 at 18:33
  • @SomnathBasu: My unicode suggestion was meaning not to find exact correspondences but just suggestive ones. Really just a more complicated version of "Let (a) represent the trefoil, the (f_a = ...)". I just think that unless the drawings are quite simple, it's going to be hard to tell what they are. But maybe the pictures are sufficiently different that it'll be obvious that this squiggle means the trefoil and that squiggle means the figure 8 - I don't know! How are you generating these figures? With TikZ then any of the others' ideas would work. Oct 13, 2011 at 18:48

This answer takes some of the ideas of other answers already posted.

I have used autotrace in the past to convert a rasterized image (like JPEG, BMP, PNG, ...) into a vector-based image (like SVG, EPS, AI, FIG, ...). For high-quality rasterized images, the output can be quite good. Of course, this depends on the type of graphic. Moreover, it is a free and quick tool, and is available for online conversion. So, you don't have to install a separate application to render a vector-based graphic file. Once you have your EPS output, you can include it using a command definition using graphicx (like in @egreg's answer).

You must log in to answer this question.

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