5

In the following code I have created a bullseye symbol. What I want to do is to allow its size to change dynamically both globally (document class option say 10pt, 11pt or 12pt) or locally by using \small, \large, and any command that declares size. That is if in the options of the document class you have 10pt as an option then the symbol will have a size of 10pt if used in the document unless enclosed in {\small} or the sort in which case its size will adjust dynamically to the document settings.

\documentclass[10pt]{article}
\usepackage{tikz}
\usepackage{amsmath}
\usepackage{graphicx}

\newcommand{\bullseye}{%
\tikz{%
\filldraw (0,0) circle (0.6em);
\filldraw[white] (0,0) circle (0.4em);
\filldraw (0,0) circle (0.2em);
}
}
\begin{document}
{\small\bullseye  sample text} sample text % as you can see no change.
\end{document}
yo'
  • 51,322
azetina
  • 28,884
  • 1
    Use .6em, .4em and .2em – egreg Feb 27 '13 at 18:48
  • Yeah @egreg since it is a horizontal length working with em is better as it is with ex with height right? – azetina Feb 27 '13 at 18:50
  • There's no rule for this. Use the one that gives the best results; it mostly depends on how you want the symbol to stick above the baseline with respect to the surrounding text (ex) or you prefer the horizontal dimension (em). – egreg Feb 27 '13 at 19:02

1 Answers1

6

You can use font dependent units instead of pt

enter image description here

\documentclass[10pt]{article}
\usepackage{tikz}
\usepackage{amsmath}
\usepackage{graphicx}

\newcommand{\bullseye}{%
\tikz{%
\filldraw (0,0) circle (.6em);
\filldraw[white] (0,0) circle (.4em);
\filldraw (0,0) circle (.2em);
}
}
\begin{document}
{\small\bullseye  sample text} sample text % as you can see no change.


{\bullseye  sample text} sample text % as you can see no change.


{\large\bullseye  sample text} sample text % as you can see no change.

\end{document}
David Carlisle
  • 757,742