Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
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
show 1 more comment

1 Answer

up vote 1 down vote accepted

I suggest the following.

In your preamble include TikZ.

\usepackage{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.

share|improve this answer
    
Looks great, I'll make myself familiar with TikZ. –  tstenner Mar 31 '12 at 18:22
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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