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.

Perhaps I made a mistake with the syntax but I think I found a problem.

\documentclass[11pt]{scrartcl}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[x = {(sin(-60) cm,-cos(-60) cm)},
                    y = {(0.866 cm,-0.5 cm)},
                    z = {(0cm,1cm)},
                    scale = 4]  
 \draw[->] (0,0,0) -- (1,0,0);
 \draw[->] (0,0,0) -- (0,1,0);
 \draw[->] (0,0,0) -- (0,0,1); 
 \draw circle (1);   
\end{tikzpicture} 

\end{document} 

I can use cos(60) for the second coordinate but I can't use sin(60) for the first one.

The question is how to work around this problem. What is the better way ?. I can use something like \xcoord with \pgfmathsetmacro\xcoord{sin(-60)} but perhaps there is a better way.

share|improve this question
1  
use extra curly braces: {sin(20)} –  Marco Daniel Apr 2 '12 at 19:36
1  
x = {({sin(-60)},{-cos(-60)})} works but I can't manage to put cm next to them. I think \pgfmathparse is the robust way of doing it. I can also see that a nice answer is coming :) –  percusse Apr 2 '12 at 19:51
    
@MarcoDaniel Yes I try the extra curly braces but I can't manage to put cm like percusse –  Alain Matthes Apr 2 '12 at 20:31

1 Answer 1

up vote 5 down vote accepted

As Marco Daniel points out, you can make TikZ parse the expressions by enclosing them in curly braces. To interpret the result as centimetres, you can multiply your expression by * 1cm:

\documentclass[11pt]{article}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[x = {({sin(-60)*1cm},{-cos(60)*1cm})},
                    y = {(0.866 cm,-0.5 cm)},
                    z = {(0cm,1cm)},
                    scale = 4]  
 \draw[->] (0,0,0) -- (1,0,0);
 \draw[->] (0,0,0) -- (0,1,0);
 \draw[->] (0,0,0) -- (0,0,1); 
 \draw circle (1);   
\end{tikzpicture} 

\end{document} 
share|improve this answer
    
How to explain this behavior ? Why the problem appears only on the first coordinate? I see this problem in another answer but I can't find it. –  Alain Matthes Apr 3 '12 at 8:15

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.