# TikZ or symbol eyes for difficulty of examples/exercises

In this time, very busy from June, I'm creating my book of Physics and I'm using some options of the structure.tex of The Legrand Orange Book. I have occurred of your precious help if possible. Into my old MWE (year 2007) with macros, I can put to add my eyes (erre.69, erre.70 etc.) in format .eps files. You can see picture below,

with my source,

\documentclass[a4paper,italian,10pt]{article}
\usepackage{babel}

%occhietti
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\input epsf
\def\ob{\epsfxsize=.28cm\epsfbox{erre.69}}
\def\os{\epsfxsize=.28cm\epsfbox{erre.72}}
\def\od{\epsfxsize=.28cm\epsfbox{erre.73}}
\def\oa{\epsfxsize=.28cm\epsfbox{erre.74}}
\def\oc{\epsfxsize=.28cm\epsfbox{erre.75}}
\def\ov{\epsfxsize=.28cm\epsfbox{erre.76}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

Different typology of examples or exercises with macros
$\ob,\os, \od,\oa,\oc,\ov$

\end{document}


But I would like to have the same eyes (created with TikZ - I don't remember that exists a symbol for these eyes!) without to use images in .pdf or .eps. format. Infact into my book I'm using many reduce figures only in .pdf. The code below is the same into Legrand Orange Book to create "examples" (for example) is:

\newenvironment{example}{\begin{exampleT}}{\hfill{\tiny\ensuremath{\blacksquare}}\end{exampleT}}.

Is the possibility to create a best \newenvironment {example} and \newenvironment {exercise} exactly to have the same eyes created with TikZ, same size, same command (\ob,\os,\oa, etc.)?

• You don't need a tikz command for the square : \square will do. Aug 27 '17 at 9:13

## 2 Answers

It is very simple to do.

If you get the idea, you can create the other few you want.

## The code

\documentclass[12pt]{standalone}
\usepackage{tikz}
\newcommand\straightEye[1][1.2ex]
{%
\begin{tikzpicture}[scale=#1/1cm]
\draw (0,0) circle (.5);
\fill (0,0) circle (.25);
\end{tikzpicture}%
}
\newcommand\downwardsEye[1][1.2ex]
{%
\begin{tikzpicture}[scale=#1/1cm]
\draw (0,0) circle (.5);
\fill (0,-.25) circle (.25);
\end{tikzpicture}%
}
\newcommand\rightEye[1][1.2ex]
{%
\begin{tikzpicture}[scale=#1/1cm]
\draw (0,0) circle (.5);
\fill (.25,0) circle (.25);
\end{tikzpicture}%
}
\begin{document}
\straightEye \downwardsEye \ look at me \rightEye\rightEye
\end{document}


Or like this :

## The code

\documentclass[12pt]{standalone}
\usepackage{tikz}
\newcommand\sideEye[2][1.2ex]
{%
\begin{tikzpicture}[scale=#1/1cm]
\draw (0,0) circle (.5);
\fill (#2:.25) circle (.25);
\end{tikzpicture}%
}
\begin{document}
\foreach \ang in {0,30,...,360} {\sideEye{\ang}}
\end{document}

• Thanks. Don't know about your downvote. I disagree with it and upvoted you in reaction. (Maybe someone thought it was not difficult enough to do for you to ask ?) Aug 27 '17 at 20:16
• @Sebastiano You can maybe add a little bit of space between both eyes if you want to have exactly what you posted. Maybe a \hspace{2pt} or so, or a \, or another default space. Aug 27 '17 at 20:23
• Your job was beautiful. I did not know some commands and learned something new. I believe that someone should have a pinch of humility and understanding the difficulties of others often when it hurries like me. Aug 27 '17 at 20:25
• This is not the case. It's perfect for your work and I put it in my structure.tex. I also gave you the green check. Aug 27 '17 at 20:26

I like the answer of marsupilam. For the completeness sake: my idea of reducing the number of images embedded into the pdf file would be to embedd it only once.

Basically save each kind of eyes using a box, then just use these boxes. My current understanding is that the images would be embedded only once and then referenced again and again in the output file.

Update: I was just told than standard boxes don't work like this, but xsavebox does the trick. Thanks to AlexG.

• No, the content of a standard \savebox is re-inserted on every \usebox, replicating the saved code in the output file (PDF, DVI, PS). To save space, the xsavebox package can be used. Aug 30 '17 at 6:47
• I haven't understood, but thanks for your answer. I have voted you. Sep 1 '17 at 20:13
• The idea is to call a macro once, to save the image in the output file. Then you use other macro, that only references the same image. This is not the standard behavior, normally on each call of a macro a new image is embedded. Sep 1 '17 at 20:28