Questions tagged [tikzmath]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
42 views

Dimension too large - Tikzmath

I have the following code: \documentclass[tikz,border=5mm]{standalone} \usepackage{tikz} \usepackage{amsmath} \usepackage{xfp} \usetikzlibrary{math} \usepackage{etoolbox} \usepackage{fp} \...
0
votes
0answers
63 views

Manual of tikzmath

I am a strong user of tikzmath to implement several things in the numeric calculus. However, I miss of a complete manual of tikzmath (separate of tikz), where I can to find all its features, functions,...
0
votes
0answers
57 views

Dealing with arrays in Tikzmath

I have the following working code to build the Lagrange Polynom of a given set of points: \documentclass[tikz,border=5mm]{standalone} \usepackage{tikz} \usepackage{xfp} \usepackage{amsmath} \...
2
votes
1answer
37 views

Tikz computes the wrong coordinates

I'm trying to calculate some coordinates to get an accurate tikz figure. I managed to do it by hardcoding some coordinates, but since I have to repeat the process for many of them, I thought it would ...
1
vote
1answer
180 views

Using math functions in a tikzmath coordinate

I am trying to execute the following code where I compute the coordinates using the TikZ math library and then I draw them in TikZ. Why does it output error ! Package pgf Error: No shape named '2*cos(...
3
votes
3answers
53 views

Rectangular table with consecutive integers using foreach

I'd like to have a rectangular table with integers (like a lottery ticket), let's say 4x9, numbers from 1 to 36. I assumed that it is easy with tikz, two foreach loops. Like this: \foreach \i in {0,1,...
2
votes
2answers
52 views

Draw arcs so they are facing each other, starting at a certain point

I am trying to draw two arc sectors whose origin is an arbitrary point. I feel like I am missing something here, because this should work, but, as you can see in the image below, the red arcs are ...
2
votes
1answer
119 views

How can I set a tikz-node's anchor using a variable?

The following code works as expected. \documentclass[tikz,margin=1em]{standalone} \usetikzlibrary{math} \begin{document} \begin{tikzpicture}[scale=3] \draw (0,0) circle [radius=1cm]; \foreach \a in {0,...
0
votes
0answers
75 views

Precision Tikzmath

I have the implementation of Bissection method in tikzmath environment below: \documentclass[tikz,border=5mm]{standalone} \usepackage{etoolbox} \usepackage{tikz} \usepackage{fp} \usepackage{xfp} \...
1
vote
2answers
52 views

Dealing with recurrent sequences

I have the following code to calculate the approximations for arctan(1) recursively: \documentclass[varwidth,border=5]{article} \usepackage{tikz,pgfplots} \usepackage{fp} \usepackage{xfp} \...
0
votes
1answer
132 views

Use tikzmath in between connecting coordinates with the draw function

If I understand correctly, the \draw function allows one to connect points with lines, and then (if the lines come back to the same point) fill the outlined shape. If one uses the -- ( , ) command it ...
1
vote
1answer
126 views

When to evaluate a custom math function in a `tikzpicture` environment using `pgfplots`

I want to draw a custom function using pgfplots, and add an annotation node: \begin{tikzpicture}[ >=stealth, evaluate={ function f(\x) { return cos(2*\x); }; ...
0
votes
0answers
39 views

Is there a \newcommand analogue so the value is saved on definition?

I'm new to this site, sorry if I'm doing something wrong in advance. I need a way to save some command return value to a variable, then the return value can change later in the code, and I don't ...
1
vote
3answers
157 views

How to place evenly spaced nodes in TikZ from (node1) to (node2)?

I have a relatively long and shallow rectangle, on the bottom of which I need to place some nodes. I don't want to manually fit coordinates, and naturally, I don't want to copy the same code several ...
2
votes
1answer
141 views

For loop not working around tikzmath

I am trying to draw the dynamics of a discrete dynamical system using Tikz. I'd like to use a loop to do so, but for some reason it does not perform the \tkzmath operations inside the loop. Here's the ...
3
votes
1answer
394 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
851 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
278 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
49 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
667 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
267 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
101 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
933 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
1k 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
345 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
732 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
5answers
2k 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
95 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
198 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
74 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 ...
2
votes
1answer
704 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} ...
5
votes
1answer
1k 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
1k 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
63 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
502 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
838 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
576 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
809 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 ...