I want to include a simple vector graphic (SVG, 1 circle and a path with 20 nodes) in the text, so it appears like a character.

ifsym does this with metafont, however metafont generates only bitmapped fonts.

My current solution is to create a new font with FontForge, export it as OTF, include it with \newfontface\foo{foo.otf} and include it with {\foo\symbol{1}}.

This works (with XeLaTeX at least), however it is cumbersome and I need to distribute the font file every time I need to send someone the .tex-files.

How can I insert a simple vector graphic as a character into the text?

  • 3
    Convert the SVG into PDF and use \includegraphics. – egreg Mar 31 '12 at 17:07
  • The graphic might be used 200-300 times in the document and I'm not sure if it's included just once in the resulting pdf. – tstenner Mar 31 '12 at 17:24
  • If I understand you correctly you really want to change a character into a graphic. Lets say the 'g'. I would make a Tikz-picture, and make the 'g' an active character that deletes the 'g' and inserts the Tikz-picture. -- If this is not what you want, please explain more thoroughly what you mean/want. – jmc Mar 31 '12 at 17:24
  • 2
    @tstenner It's included only once. If I include a 6KiB PDF file 100 times the PDF file is 13484 bytes; if I include it 500 times it becomes 14658 (pdflatex). With XeLaTeX I get 7186 bytes for 100 times and 10333 bytes for 500 times and – egreg Mar 31 '12 at 17:34
  • 1
    @tstenner In that case I would define a macro which puts a TikZ-picture in the text. That is quite convenient. The pgfmanual (very very good) contains several examples of these inline graphics. – jmc Mar 31 '12 at 17:36

I suggest the following.

In your preamble include TikZ.


Also in the preamble, define a macro, e.g.,

\def\myGraphicChar{\tikz \node[chamfered rectangle, white, fill=red, double=red, draw, very thick]
   {\bf STOP!};

Next, in your text, just write \myGraphicChar where you want your graphic. All inline.

  • Looks great, I'll make myself familiar with TikZ. – tstenner Mar 31 '12 at 18:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.