Skip to main content

Questions tagged [tikzmath]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
40 views

Conflict between TikZ math library and Beamer Metropolis + XeLaTeX

I am having trouble using the TikZ library math in a Beamer metropolis document compiled with XeLaTeX. I need XeLaTeX to use the beautiful Fira fonts. Here is an example: \documentclass{beamer} \...
Andros's user avatar
  • 339
5 votes
3 answers
279 views

Drawing n boxes in a row

I would like to draw identical boxes in one row. The following error message is shown: in {0,1,...,\bn -1}{\bc = (\bl /2+\i *(\bw +\bd ):0); \draw [draw=dbl\ETC. ! Paragraph ended before \tikz@math@...
Thomas's user avatar
  • 53
2 votes
1 answer
82 views

bigintcalc: using a result in further calculations

I have a \newcommand that calcs for predefined variables Hint: I use bigintcalc.sty for huge numbers; and pgfmath to define variables (and maybe other calculations). I would like to have the ...
cis's user avatar
  • 8,912
3 votes
1 answer
81 views

tikzmath: how to define numbered variables by a loop

I would like to define \x{1}, \x{2}, ...; so why does the following not work? \documentclass[]{article} \usepackage{tikz} \usetikzlibrary {math} \begin{document} \tikzmath{ int \i; for \xValue in {2,...
cis's user avatar
  • 8,912
1 vote
0 answers
45 views

Sums and products with tikzmath

I have numbered variables like \tikzmath{ \x{1}=2; \x{2}=3; \x{3}=7; \x{4}=43; \x{5}=1806; ..... and many more .... } which are all integer numbers. I need to calc some sums and products of them; ...
cis's user avatar
  • 8,912
0 votes
1 answer
87 views

Sums and products of n values in tikzmath

I have a table like n x1 x2 x3 x4 x5 ... 3 2 3 6 0 0 ... 4 2 3 7 42 0 ... 5 ... 6 ... ... Suppose we have 4 numbers x1,x2,x3,x4 (case "n=4"). Then the sums of all ...
cis's user avatar
  • 8,912
0 votes
0 answers
80 views

pgfmathsetmacro, pgfmarthparse, pgfmathresult to define command with calculation

I am quite new to using tikz and the pgf package in general, and I'm having a hard time understanding how/when to use pgfmathsetmacro, pgfmathparse and pgfmathresult. I have the following problem: I ...
Pedro Montanari's user avatar
5 votes
3 answers
195 views

How to pass coordinate parameters to a function?

I am trying to draw arc's by calling a function instead of macro. I don't know how to pass a coordinate to a function. I tried two ways: one is passing it directly (preferred), the other is to pass ...
Leon Chang's user avatar
0 votes
0 answers
44 views

Default unit for x,y components of `tikzmath` coordinate is in `pt`

Lets say I want to draw a line on a grid given two points A,B: \documentclass[tikz]{standalone} %mixing defs and coordinates is a bad idea \usetikzlibrary{fit,shapes,calc,matrix,math,positioning,...
Ted Black's user avatar
  • 495
0 votes
1 answer
82 views

adding coordinates in tikz math does not work

If I start with the following MWE, \documentclass[tikz]{standalone} \usetikzlibrary{math} \begin{document} \begin{tikzpicture} \draw [help lines] (0,0) grid (7,7); \tikzmath{ coordinate \A, \B; \A =(...
Ted Black's user avatar
  • 495
0 votes
0 answers
30 views

TIKZMATH not working with \let\detokenize\relax

As seen in the picture below, after compiling document.tex... ... the first part using mathtikz as usual works fine ... the second part using mathtikz via abc.tex (while renewcommanding \test) doesnt ...
Bilal Yilmaz's user avatar
2 votes
1 answer
54 views

Link A to B with straight lines (instead of curved) - MATHTIKZ

Im struggling with the options in tikz to get straight lines instead of curved lines, when im linking A to B (see picture below). Here is my mwe: \documentclass{article} \usepackage{pgf,tikz} %%%%%%%%%...
Bilal Yilmaz's user avatar
1 vote
1 answer
55 views

Problema in tikzmath with two outputs

I haver a MWE where I want to calculate a sum and the associated error, implemented in the funcion serieF. How can I implement in the function to return two outputs, i.e., the variables \s and \e and ...
Angelo Aliano Filho's user avatar
0 votes
2 answers
128 views

Problems with large numbers in Tikzmath

I have a MWE as following.I build a matrix whose first column is 1's; second column is the square of each component of x; third column is the cube of the x component, and so on. I need to use tikzmath ...
Angelo Aliano Filho's user avatar
0 votes
0 answers
70 views

draw random point in TikZ and create a contour with specific condition

Dear all, I'm contacting you because I'd like to learn how to simulate this type of image with tikz. I simulate points randomly (Poisson process, number of points 1024) in a rectangle ideally of size [...
Ya Kiv's user avatar
  • 1
0 votes
1 answer
112 views

Reset tikzmath variable in for loop

I want to draw multiple curves (each with a different slope) using tikzmath coordinates: \begin{tikzpicture} \begin{axis}[ xmin=0, xmax=1, ymin=0, ymax=1, width=\textwidth, ...
segfault's user avatar
  • 103
1 vote
0 answers
34 views

tikzmath produces an error when the trigonometric functions are used [duplicate]

Why does the following code: \documentclass{article} \usepackage{tikz} \usetikzlibrary{math} \begin{document} \begin{tikzpicture} \tikzmath{ coordinate \v; \v = (cos(pi),sin(pi)); } \end{...
Evan Aad's user avatar
  • 11.1k
1 vote
1 answer
405 views

Syntax of \tikzmath{function....?

What is wrong with the syntax of the two \tikzmath function definitions function here? \documentclass{article} \usepackage{tikz} \usetikzlibrary{math} \tikzmath{function f(\x) { return sin(\x); } \...
murray's user avatar
  • 8,692
0 votes
1 answer
114 views

tikzmath arithmetic calculations using predefined variables

I'm trying to do calculations in tikzmath using some predefined variables. Here's an example of what I have \usepackage{tikz} \usetikzlibrary{math} \begin{tikzpicture} \tikzmath{ real \ang = 30; ...
TurbPhys's user avatar
  • 115
0 votes
1 answer
50 views

How to assign a value of the form (my node.east) to a coordinate variable inside the argument of a tikzmath command?

The PGF & TikZ manual for version 3.1.9a (the current version) has this to say about the coordinate keyword of the math TikZ library (p. 706): coordinate 〈variable〉, 〈additional variables〉; This ...
Evan Aad's user avatar
  • 11.1k
0 votes
2 answers
43 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{...
Zhong Qing's user avatar
2 votes
0 answers
73 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 ...
Angelo Aliano Filho's user avatar
0 votes
0 answers
64 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, ...
Hérisson Didier's user avatar
4 votes
1 answer
262 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{...
Angelo Aliano Filho's user avatar
0 votes
0 answers
143 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} \...
Angelo Aliano Filho's user avatar
1 vote
0 answers
388 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,...
Angelo Aliano Filho's user avatar
2 votes
1 answer
247 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 ...
aaragon's user avatar
  • 3,051
2 votes
1 answer
2k 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(...
loved.by.Jesus's user avatar
3 votes
3 answers
112 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,...
Péter Juhász's user avatar
2 votes
2 answers
70 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 ...
Jes's user avatar
  • 851
2 votes
1 answer
583 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
101 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} \...
Angelo Aliano Filho's user avatar
0 votes
1 answer
367 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 ...
Lucas Myers's user avatar
1 vote
1 answer
288 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); }; ...
oaheix's user avatar
  • 101
1 vote
3 answers
464 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 ...
Vladimir Nikishkin's user avatar
2 votes
1 answer
296 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 ...
ozak's user avatar
  • 23
4 votes
1 answer
824 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&...
Frunobulax's user avatar
  • 2,228
4 votes
3 answers
2k 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 ...
berkus's user avatar
  • 1,178
1 vote
2 answers
597 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 ...
JPI's user avatar
  • 148
2 votes
0 answers
53 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.}; } \...
uzsolt's user avatar
  • 1,431
8 votes
5 answers
902 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; } $\...
Glenn's user avatar
  • 165
1 vote
1 answer
435 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 ...
Alex Povel's 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 ...
Keith's user avatar
  • 21
5 votes
2 answers
2k 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{...
tobiasBora's user avatar
  • 8,944
1 vote
1 answer
4k 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 ...
demodave's user avatar
1 vote
0 answers
498 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{\...
gaugi's user avatar
  • 111
2 votes
3 answers
1k 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: ...
demodave's user avatar
10 votes
5 answers
4k 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 ...
tobiasBora's user avatar
  • 8,944
1 vote
1 answer
121 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... ...
tobiasBora's user avatar
  • 8,944
4 votes
2 answers
237 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 \...
Nixie777's user avatar
  • 313