3

Let's say I have the following text (a part of a paragraph):

hello world

I want to be able to typeset a small star/smiley/whatever graphic in between these two words. This graphic should of course be treated like a regular word, in the sense that we get proper spacing around it, just like for regular words.

The graphic should preferably be written right there in some MetaPost/PSTricks-like code, but I can also accept that I have to include it through an external PDF file.

How can I do this?

Edit: Come to think about it, I guess what I may be asking for is a way to create a new character, without actually having to mess with font-related stuff.

1 Answers1

7

Simply draw the graphic or include a graphic. Pstricks should work fine, or tikz:

\documentclass{article}
\usepackage{tikz}
\newcommand\smiley{%
 \begin{tikzpicture}[scale=0.5]
       \fill[fill=yellow,draw=black] (0,0) circle (2ex);
       \draw (210:1.3ex) arc (210:330:1.3ex);
       \draw (210:1.1ex)--(210:1.5ex);
       \draw (330:1.1ex)--(330:1.5ex);
       \draw (135:1.1ex) circle (0.2ex);
       \draw (45:1.1ex) circle (0.2ex);
      \end{tikzpicture}}
\begin{document}

Hello \smiley\  World

\Huge Hello \smiley\ World
\end{document}

Result:

result

Ulrike Fischer
  • 327,261