Tag Info

New answers tagged

1

After Mark Wibrows answer i found 3 possible (easy) solutions for my problem: % 1. \node [minimum width=(\col{1})*1cm] {}; % 2. \newcommand{\helper}[1]{(#1)*1cm} \node [minimum width=\helper{\col{1}}] {}; % 3. \tikzset{% minimum widthCM/.style={minimum width=(#1)*1cm} } \node [minimum widthCM=\col{1}] {};


7

Not 100% sure that I understand the intended application but the following (which defines alternative minimum width keys) may be of use: \documentclass[tikz,border=5]{standalone} \tikzset{% minimum width'/.code={% % Only advisable when x and y are orthogonal \pgfpointxy{#1}{0}% \tikzset{minimum width/.expanded=\the\csname pgf@x\endcsname}% ...


6

Use pgfmath and do like this: \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture}[x=1cm,y=1cm] \pgfmathsetmacro{\mw}{1+1} \node [draw,minimum width=\mw cm] {}; \pgfmathsetmacro{\mw}{2+2} \node [draw,minimum width=\mw cm,yshift=1cm] {}; \end{tikzpicture} \end{document} This is for the edit: ...


3

One option is \edef\mw{\number\numexpr 1+1\relax} as in: \documentclass[tikz]{standalone} \begin{document} \begin{tikzpicture}[x=1cm,y=1cm] \edef\mw{\number\numexpr1+1\relax} \node [minimum width=\mw cm] {}; \end{tikzpicture} \end{document} \edef stands for expandable macro definition, therefore the contents is expananded as \mw is defined. ...


4

Each table cell forms a group, so your definition of \PercentColor is lost by the time it reaches \ApplyGradient. If you make the definition \global (I've done so using \global\edef or, equivalently, \xdef) it works as expected: \documentclass{article} \usepackage[usenames,dvipsnames,svgnames,table]{xcolor} \usepackage{pgfplots} \pgfplotsset{compat=1.10} ...


0

Also the final code looks like this, for someone to facilitate his work: \def\Sx{-2} \def\Sy{-3} \def\Sz{2} \pgfmathsetmacro\Sρ{"sqrt((\Sx)^(2)+(\Sy)^(2)+(\Sz)^(2))"} \pgfmathsetmacro\Sθ{ifthenelse(\Sx==0&&\Sy==0&&\Sz==0,0,"acos(\Sz/(sqrt((\Sx)^(2)+(\Sy)^(2)+(\Sz)^(2))))")} ...


2

The expression \pgfmathsetmacro\polar{ ifthenelse(\Sx=0 \AND \Sy=0 \AND \Sz=0, 0, acos(\Sz/(sqrt(\Sx^(2) + \Sy^(2) + \Sz^(2)))))} has several errors. The ifthenelse keyword implemented by pgf has a different syntax from the \ifthenelse macro from the ifthen package. You seem to be trying to mix the two, hence the issue. For the ifthenelse ...



Top 50 recent answers are included