Questions tagged [tikzmath]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
2 answers
27 views

Problems with using \tikzmath to draw ellipses

\documentclass{article} \usepackage{tikz} \usetikzlibrary{positioning} \usetikzlibrary{arrows} \usetikzlibrary{arrows.meta} \usetikzlibrary{patterns} \usetikzlibrary{patterns.meta} \usepackage{...
user avatar
2 votes
0 answers
46 views

Maximum and argmaximum in Tikzmath [closed]

tikzmath are several math functions. However, I would like to find the maximum number in a given array and the index where the maximum occurs. How can I do this in tikzmath? Could anyone provide a ...
user avatar
0 votes
0 answers
45 views

Messing up data declared using tikzmath: is there a size limit?

For chemistry, I need to rewrite many periodic tables showing different kinds of data for each chemical element. I'm trying to declare all values using \tikzmath in order to access the values easily, ...
user avatar
4 votes
1 answer
120 views

Decimal places in fixed point arithmetic with negative numbers

I have the code: \documentclass[tikz,border=5]{article} \usepackage{tikz} \usepackage{xfp} \usepackage{amsmath} \usetikzlibrary{math} \usepackage{fp} \usetikzlibrary{fixedpointarithmetic} \begin{...
user avatar
0 votes
0 answers
63 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} \...
user avatar
0 votes
0 answers
168 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,...
user avatar
0 votes
0 answers
73 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} \...
user avatar
2 votes
1 answer
88 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 ...
user avatar
  • 2,775
1 vote
1 answer
576 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(...
user avatar
3 votes
3 answers
75 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,...
user avatar
2 votes
2 answers
56 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 ...
user avatar
  • 488
2 votes
1 answer
242 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,...
user avatar
3 votes
2 answers
83 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} \...
user avatar
0 votes
1 answer
202 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 ...
user avatar
1 vote
1 answer
189 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); }; ...
user avatar
  • 101
0 votes
0 answers
40 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 ...
user avatar
1 vote
3 answers
221 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 ...
user avatar
2 votes
1 answer
197 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 ...
user avatar
  • 23
3 votes
1 answer
519 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&...
user avatar
  • 1,678
4 votes
2 answers
1k 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 ...
user avatar
  • 1,108
1 vote
2 answers
357 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 ...
user avatar
  • 48
2 votes
0 answers
52 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.}; } \...
user avatar
  • 1,411
8 votes
5 answers
744 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; } $\...
user avatar
  • 153
1 vote
1 answer
316 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 ...
user avatar
2 votes
0 answers
103 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 ...
user avatar
  • 21
5 votes
2 answers
1k 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{...
user avatar
  • 5,175
1 vote
1 answer
2k 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 ...
user avatar
1 vote
0 answers
377 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{\...
user avatar
  • 111
2 votes
3 answers
946 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: ...
user avatar
10 votes
5 answers
3k 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 ...
user avatar
  • 5,175
1 vote
1 answer
100 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... ...
user avatar
  • 5,175
4 votes
2 answers
202 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 \...
user avatar
  • 313
3 votes
0 answers
81 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 ...
user avatar
  • 1,108
2 votes
1 answer
803 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} ...
user avatar
  • 1,108
5 votes
1 answer
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> ...
user avatar
  • 6,221
7 votes
2 answers
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) {\...
user avatar
  • 145
1 vote
1 answer
64 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, ...
user avatar
  • 748
1 vote
1 answer
540 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]{...
user avatar
  • 637
4 votes
2 answers
941 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 ...
user avatar
  • 36k
9 votes
1 answer
620 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 ...
user avatar
  • 827
2 votes
0 answers
3k 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 ...
user avatar
12 votes
1 answer
862 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 ...
user avatar
  • 22.4k