Tag Info

New answers tagged

2

I’m not sure if this is what you are after, but here is my try using expl3. \documentclass{article} \usepackage{tikz,xparse} \ExplSyntaxOn \NewDocumentCommand \nG { m m m } { \node[opacity=0, text~opacity=1, minimum~size=10mm, anchor=base] at (#1, #2) {#3}; } \NewDocumentCommand \writeSep { m m m } { \martin_writesep:nnn { #1 } { #2 } { #3 } } ...


1

\StrChar of package xstring is not expandable and cannot be used in calculations. But it provides an optional argument to store the result: \StrChar{#4}{\x}[\mynum] Then the number can be used in calculations, e.g.: \pgfmathsetmacro\myresult{\mynum * 2} Then, \myresult can be used in macro \nG. In case of simple calculations with integers, \numexpr ...


3

TeX expands \thisrow{col2} to -2, so what's eventually seen is -2^2 which is, according to the usual conventions, -4. The same in the other cases. Adding parentheses, as follows, \documentclass{standalone} \usepackage{pgfplots} \usepackage{pgfplotstable} \begin{filecontents}{data.dat} col1 col2 -1 -2 0 -2 2 -3 \end{filecontents} ...


3

pgfplots uses library fpu for better precision by default, which has a different internal number format. Therefore \pgfresult is not 1 or 0 anymore and \ifnum cannot be used. \tikzset{fpu} \pgfmathparse{int(0)}\show\pgfmathresult \pgfmathparse{int(1)}\show\pgfmathresult The lines show 0Y0 for zero and 1Y1 for one. In this case, the whole math can be put ...


4

The result of the calculation can be directly assigned to a macro using \pgfmathsetmacro. Table cells are local groups, therefore the following definition of \allan first performs the calculations, defines a macro for the table rows with the expanded calculation results and calls the macro to actually set the rows: \newcommand{\allan}{ ...


5

You are not doing anything wrong. It's just that you are using the default sample number and the default domain. Adjusting them gives you the result. \begin{tikzpicture}[ declare function={func(\x)=(\x>0.8)*(0.6*\x)+and(\x>0.6,\x<=0.8)*(2/3*\x)+(\x<=0.6)*(\x*0.75);} ] \begin{axis}[xmin=0,xmax=1,samples=351,domain=0:1, ...


5

If your purpose is to calculate the angle between a line defined by two points (m1)--(m4) and the horizontal axis, then you have two options according to your needs. First, you can use pgf math engine with the command \pgfmathanglebetweenpoints used for this purpose. Second option is to use the tkz-euclide package (internally loads tikz), but then you need ...



Top 50 recent answers are included