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 have a picture in TikZ and I'd like to change the basic units of the coordinates I specify. I know I could just scale the picture, but I don't want to do that. For any given coordinate, I can write (1cm,1cm) etc for each coordinate, but I'd rather specify the "units" I want to use separately... Or for example make (1,1) mean (5ex,10ex)...

Is there a way to do this?

share|improve this question
    
See my answer, you can use x=..., y=.... and it's possible to use macro to adjust x=\myx, y=\myy –  Alain Matthes Jun 6 '11 at 15:11
add comment

1 Answer

up vote 13 down vote accepted

By default yes but you can compare the next results

\begin{tikzpicture}
  \draw(0,0)--(1,1);
\end{tikzpicture} 

\begin{tikzpicture}[x=2cm,y=-1cm] 
  \draw(0,0)--(1,1);    
\end{tikzpicture}  

\begin{tikzpicture}[x=5,y=5] 
  \draw(0,0)--(1,1);
\end{tikzpicture} 

\begin{tikzpicture}[x=28.45274,y=28.45274] 
  \draw(0,0)--(1,1);
\end{tikzpicture}

In the last code, we can see that without unit x and yare defined with pt

To complete the answer :

\begin{tikzpicture}
  \draw (0,0)--(600,0);
\end{tikzpicture}

Latex Error: ... Dimension too large. The unit is the cm.

\begin{tikzpicture}[x=0.01 cm]
  \draw (0,0)--(600 cm,0);
\end{tikzpicture}

again Latex Error: ... Dimension too large because 600 cm is a length and TeX uses only lengths < 575 cm.

\begin{tikzpicture}[x=0.01 cm]
  \draw (0,0)--(600,0);
\end{tikzpicture}  

This is correct ! 600 < $2^{31}-1$ . 600 is a integer and not a length and now 600 gives 6 cm

share|improve this answer
1  
I see, I was trying to be too clever: I was trying things like [canvas cs:x=1cm,y=cm] but that gave me errors. I didn't think to just try x=... Thanks! –  Seamus Jun 6 '11 at 18:55
add comment

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.