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.

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}
share|improve this question
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 Answer 1

up vote 5 down vote accepted

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}
share|improve this answer
    
dependent on what? –  David Carlisle Feb 27 '13 at 19:03
    
Say the font size is set to 10pt for the document, is it possible to make the size(height) of the symbol be that without manually setting it? –  azetina Feb 27 '13 at 19:05
    
in that case 1em at \normalsize will be 10pt so just use em units and it will size with [10pt] or [12pt] document options –  David Carlisle Feb 27 '13 at 19:07
    
@DavidCarlisle: 1em and 1ex does not only change with fontsize, but also with family, weight and shape. See my survey made as an answer to “<tex.stackexchange.com/questions/4239/…;”. –  Johan_E Feb 28 '13 at 0:57
    
@Johan_E yes of course they are font parameters so can be set to any values by the font designer, but in the context of this question size is the important feature and if you define in em units the symbol will change with both font size changes like \large and document options like [12pt] –  David Carlisle Feb 28 '13 at 8:32

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.