Questions tagged [tikzmath]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
3
votes
1answer
93 views

Can't use “if” in tikzmath - undefined control sequence “ifpgfmathfloatparseactive”

MWE (copied from TikZ manual): \documentclass{article} \usepackage{tikz} \usetikzlibrary{math} \begin{document} \begin{tikzpicture} \tikzmath{ int \x; for \k in {0,10,...,350}{ if \k&...
4
votes
2answers
129 views

\text{ } subscript size in tikzmath macro is not correct

This question is related to this earlier TeX-SE question of mine I would like to have a proper text subscript using the \text{} command. It does not seem to work with the tikzmath macros. Please ...
1
vote
2answers
77 views

Creating tikz commands, automatically drawing labelled square

So I want to create a macro that I can use to automatically generate a rectangle in TikZ. I would like to specify text (an equation) that should be placed in the middle and automatically generate ...
2
votes
0answers
24 views

In tikzmath the “random” puts “.0.0” if want negative random number [duplicate]

Here is a MWE: \documentclass{article} \usepackage{pgf} \usepackage{pgfplots} \usetikzlibrary{math} \begin{document} \tikzmath{ int \foo; \foo = random(-16,10); print {Foo value: \foo.}; } \...
8
votes
5answers
336 views

Test of integers? Or, round the number if the first two decimal numbers are sufficiently close to 0 or 1?

The following is a MWE, which explains my intention. \documentclass{article} \usepackage{tikz} \usetikzlibrary{math} \begin{document} \tikzmath{ \integer = 4/2; \decimal = 5/3; \integerB=1/3*3; } $\...
1
vote
1answer
75 views

3D Piecewise Plot with varying bounds in Tikz/PGF

The function to be plotted reads as In it, these constrains hold true: If plotted it looks like Please excuse the different symbols, I will explain: p/p_0 is equivalent to \Pi and \gamma is ...
2
votes
0answers
75 views

Why do the three small triangles not coincide exactly? They are unexpectedly shifted (tikz math library recursive function calls) [duplicate]

It is probably some silly error on my part, but I am trying to understand why the three green triangles do not coincide exactly -- instead, they are unexpectedly shifted. (The original intent was to ...
5
votes
2answers
442 views

Tikzmath, ERROR: Missing \endcsname inserted

I'm trying to use tikzmath to draw lines between a set of points, however I've an error ERROR: Missing \endcsname inserted. on the line \ni=\i+1;. Any idea why? \documentclass{article} \usepackage{...
1
vote
1answer
246 views

\input inside \newcommand and macro parameters

I would like to divide a list of parameters for a series of tikz graphics into a bunch of separate, named tex files. Specifically: each parameter file should be loaded by an \input command which in ...
1
vote
0answers
167 views

Change element in pgf math array

I want to change the element of an pgf math array within a multido environment where a random element is incremented by 1: \def\list{0,0,0,0,0,0,0,0,0,0,0} \multido{\i=0+1}{20}{ \pgfmathsetmacro{\...
2
votes
3answers
216 views

Conditional tests on string variables in tikzmath library

Is it possible to test for strings in the tikzmath library? (E.g. if <variable>=<string expression> then foo) I tried a naive test and it returned this error: Package PGF Math Error: ...
9
votes
4answers
702 views

Tikzmath: use array

I'd like to use arrays in tikzmath. I'd like to be able to manually define an array, with the equivalent of the python code myarray = [1,0,0,1,1], and I also would like to be able to access it in ...
1
vote
1answer
55 views

tikzmath: strange replacement

I don't know why, but I tried to print some code in a tikzmath file, and the result is really strange, it looks like that tikzmath tries to substitute texts even if does not begin with a backslash... ...
4
votes
2answers
141 views

Compound Pathway Problem with holes

The picture below is what I am trying to create. I have asked a similar question before, and I got an excellent answer, but it's still not 100% what I am looking for. I know that I have to use \...
3
votes
0answers
61 views

Conflict in the Key Values in Nested Tikz Enviroments

I am developing some Tikz commands with pgfkeys, and I want to use the commands that I developed earlier in my new commands. This creates nested Tikz and Tikz math enviroments as shown in the MWE ...
1
vote
1answer
285 views

How to specify the units of a variable in \tikzmath or argument of a \newcommand that uses pgfkeys

I would like to specify the units of an argument of a \newcommand that uses pgfkeys and that goes into a \tikzmath enviroment as a variable as follows: \documentclass[12pt]{article} \usepackage{tikz} ...
4
votes
1answer
668 views

pgfplots on tikzmath function with conditionals returns an error

Plotting with pgfplots a function defined using the tikzmath function syntax does not seem to work. The error message : ! Illegal unit of measure (pt inserted). <to be read again> ...
7
votes
2answers
632 views

How do I draw on images embedded with \includeimage in TikZ with pixel accuracy?

I want to draw on an image which I embedded using \includeimage: \documentclass[tikz]{standalone} \begin{document} \begin{tikzpicture} \node[anchor=south west,inner sep=0] (image) at (0,0) {\...
1
vote
1answer
60 views

splitting maths in two lines in a node

I have the following code: \documentclass[border=2mm]{standalone} \usepackage{tikz} \usetikzlibrary{shapes.misc} \usetikzlibrary{calc} \tikzset{cross/.style={cross out, draw=black,ultra thick, ...
1
vote
1answer
433 views

Error when compiling using tikzmath

I am trying to learn how to use Tikz and its library Tikzmath to make graphics. I am trying to practice by drawing a series of circles along a line. My code is as follows: \documentclass[tikz]{...
4
votes
2answers
557 views

leading zero in \foreach of a TikZ calendar

The calendar TikZ library creates for each day a node called (<name>-<year>-<month>-<day>). But there is a leading zero for <day> from 1 to 9, that is, to use the node of ...
9
votes
1answer
427 views

Double rounded curves in Tikz

I am trying to do a graph with tikz, and I would like your help for some details and technicalities. I am trying to do something resembling the following : Here are my problems. 1) I am currently ...
2
votes
0answers
2k views

Unable to use tikzlibrary packages [closed]

UPDATE: Solved. See my comment below for the fix. I've been trying for the life of me to figure out how to use the math tikzlibrary (\usetikzlibrary{math}), and no code works. I fear that it has ...
12
votes
1answer
593 views

Is print in TikZ's math, useless?

In the manual of TikZ 3.0.0, the section about the math library, we can read (p. 635): Unlike the print keyword, the brace notation can be used in functions so that tikz path commands can be safely ...