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'm using several macro's to quickly draw points in a figure (I have to realy draw a lot). For example I use:

\newcommand{\punt}[3]{\draw[fill,scale=1]#1 coordinate(#2)circle(0.5pt)node[#3]{$#2$};}

to quickly draw a point and it's name, as well as give it the correct coordinate.

My problem is that as I'm drawing I might later decide to scale the entire picture (using scale). This results in larger dots that depict the points. I don't want this because I might scale one picture to 2 times it's size and another one to 0.5 it's size and this leads to a discrepancy in dot sizes throughout my document.

An even greater problem arises when I use xscale or yscale which leads to deformed circles.

Is there a way I can tell my macro to ignore all other scaling? As you can see I tried putting scale=1 in the draw options but this didn't help...

share|improve this question

2 Answers 2

up vote 9 down vote accepted

You can use the shift only key. From the manual:

This option does not take any parameter. Its effect is to cancel all current transformations except for the shifting. This means that the origin will remain where it is, but any rotation around the origin or scaling relative to the origin or skewing will no longer have an effect.

This option is useful in situations where a complicated transformation is used to “get to a position,” but you then wish to draw something “normal” at this position.

The following command first places a coordinate node at the desired location with scaling in effect and then places a circle around that node without scaling:

\newcommand{\punt}[3]{
    \draw #1 coordinate (#2);
    \fill[shift only] (#2) circle (0.5pt) node[#3] {$#2$};
}
share|improve this answer
    
I didn't know that key.. even though I have been going over and over the Tikz manual to find a solution. Always good to have the extra knowledge thanks! –  romeovs Jan 31 '11 at 12:33

The following doesn't really answer the actual question, but it does solve your problem. (And I, for one, would be interested in knowing how to solve the actual question.)

\documentclass{minimal}

\usepackage{tikz}
\newcommand{\punt}[3]{\draw[fill,scale=1]#1 coordinate(#2) node[circle,fill,inner sep=1pt] {} node[#3]{$#2$};}

\begin{document}

\begin{tikzpicture}
\begin{scope}
\punt{(0,0)}{a}{above}
\end{scope}
\begin{scope}[scale=5]
\punt{(0,-1)}{a}{above}
\end{scope}
\begin{scope}[scale=2]
\punt{(0,-2)}{b}{below}
\end{scope}
\end{tikzpicture}
\end{document}

This works because the scaling doesn't apply to the shape of nodes, so by drawing the circle using the node syntax, the scaling doesn't get applied to the circle size.

share|improve this answer
    
yes this is what I did now.. it works perfectly! –  romeovs Jan 31 '11 at 12: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.