Questions tagged [pgfmathparse]

The tag has no usage guidance.

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

Reserved names in “declare function”?

This must be my week for stepping on reserved words... please look at this MWE: \documentclass{article} \usepackage{tikz} \newcommand{\formula}[1]{% \pgfmathsetmacro{\rpval}{#1}% \...
4
votes
2answers
47 views

Change font size in a section as a function of the current font size

This answer shows how to get the current font size, using \makeatletter\f@size\makeatother. This answer shows how to parse and evaluate a mathematical expression before printing it, using for example ...
1
vote
1answer
71 views

Pgfplots and pgfmathparse, lack of precision

I am using pgfplots to draw a graph and I would like to modify the abscissa values of the data when they are plotted. I am currently using x filter/.code={\pgfmathparse{1/#1} \pgfmathresult} to take ...
1
vote
1answer
55 views

Counter does not work properly in \pgfmathparse

I have this code: \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{graphicx} \usepackage{pgfplots} \usepackage{tikz} \pgfplotsset{compat=1.15} \usetikzlibrary{patterns} \newcounter{...
3
votes
1answer
47 views

circuitikz: setting color using \pgfmathparse

\documentclass[a4paper]{article} \usepackage{tikz} \usepackage{circuitikz} \usetikzlibrary{shapes.geometric,arrows,shapes,decorations.markings} \begin{document} \begin{circuitikz} [american ...
1
vote
1answer
46 views

Defining math functions

\documentclass[aspectratio=1610]{beamer} \usepackage{amsmath} \begin{document} \def\function(#1){ 96* (#1)-16 *(#1)^2 } %1. I am trying to condense the following two lines \pgfmathparse{3+\...
1
vote
1answer
216 views

Stacked bar chart, nodes near coords remove small values and show sum

I know it is possible to have only the sum shown on top of the bar chart and remove the other values in the stacked bar chart (as shown in picture attached), but I can't figure out what went wrong in ...
1
vote
2answers
143 views

pgfmath: Function for strings and numbers?

Is there a pgfmath-function for something like ? \documentclass[]{article} \usepackage{tikz} \usepackage{array} \begin{document} \def\myarray{{1,0,"-1","a"}} \foreach \i in {0,...,3}{\pgfmathparse{\...
2
votes
1answer
88 views

\pgfmathsetmacro creates “Dimensions too large” for t distribution

I am trying to plot 't' distribution with area of interest shaded. I have done both plotting and sharing area. Next tried to draw vertical lines closing the shaded area on both sides. For this, I need ...
2
votes
1answer
60 views

Problem with `\pgfmathresult pt = 1 pt` when forming xticklabel (very large values)

I'm having difficulties with the comparison \pgfmathresult pt = 1 pt . A complete example, with a situation in which it works, and a second one that doesn't (both in the x-axis): \documentclass{...
3
votes
1answer
111 views

TikZ PGF - Minus sign being interpreted as a unit of measure

I'm trying to write a macro that draws a number line given a number of tick marks to use. However, there are a couple of spots in the code where I try to do arithmetic using the argument of the ...
5
votes
2answers
219 views

Coordinate calculation with TikZ

I need to draw some plots with vertical lines from the x axis to the function. For example, I defined the gauss(x) function for the normal distribution and I drew this plot, with a vertical line from (...
0
votes
1answer
380 views

! TeX capacity exceeded, sorry [main memory size=5000000]. for foreach

I was blocked on this point, I'm going to compile a code in which I'm using the command foreach: \pgfmathtruncatemacro{\iar}{{\RodLength*\iBngle/180}}%L=\iBngle*x=\RodLength*\iBngle/360%360 ou 180 ...
0
votes
2answers
106 views

Error trying to parse with \pgfmathparse

I'm trying to evaluate the following expression with \pgfmathparse, but I get error messages: \pgfmathparse{\sqrt{{5.8186/{\pi}}}}\pgfmathresult\ Any idea why?
2
votes
0answers
142 views

Calling pgf rand inside pgfmathsetmacro creates extra text

I am using pgf and tikz for some latex questions. The code below illustrates a problem I am facing: when I use the rand function from pgf inside a pgfmathsetmacro I get some extra text at the ...
6
votes
2answers
1k views

How to Draw Horizontal Line in tikzpicture

I am trying to draw a dotted line from a defined function value to the x-axis in order to "close off" a shaded area below the curve. Because I defined a function in order to be plotted, I don't know ...
2
votes
1answer
158 views

Computing color for a mesh using the parametric coordinates

Question: Is there a way to use the parametric parameters (instead of the absolute x and y) inside the mathparse used to calculate the color of a surf? Motivation: The function I have to plot has a ...
4
votes
3answers
1k views

pgfmathparse in foreach, use result as node coordinates

I'm trying to use a counter inside a TikZ picture, and use values resulting on calculations with this counter. Let's say for instance, I want i to be ranging from 0 to 9, j to be i*5 and k to be i*10. ...
2
votes
1answer
236 views

Drawing a graph with pgfmathparse+matrix

I want to draw a graph. I use tikz matrix to draw the vertices, and then would like to add edges from an array. I tried the following code: \documentclass{article} \usepackage{tikz,pgfmath} \...
7
votes
3answers
303 views

pgfmathparse does not correctly parse zero left-padded integers?

I am currently trying to realize a slightly complicated graphic, wherein I have a bunch files all named with the value of a certain parameter, represented by its left-padded value. Namely, I have: ...
5
votes
2answers
450 views

For each loop showing decimal point when I don't want it to

My Code is: \documentclass[tikz,border=10pt]{standalone} \begin{document} \begin{tikzpicture}[timeSlot/.style={draw, rectangle, minimum size =1cm}] \foreach [count=\x] [evaluate=\x as \xx ...
8
votes
2answers
8k views

pgfmathparse basic usage

Please, what I'm doing wrong in this test: \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \pgfmathparse{10*2} \node at (4,-5) {$2 \cdot 10 = \pgfmathresult$}; \end{...
2
votes
1answer
234 views

How to calculate many coordinates inside pgfplots axis in a clever way?

What I want is which could be drawn by the following code. \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=1.13} \begin{document} \begin{tikzpicture} \begin{axis}[xmin=...
1
vote
1answer
179 views

Why is this small example not working any more when using pgfmathparse?

The following small example worked until \pgfmathparse{\myvalue+1}\pgfmathresult was added instead of just 1. I am not getting any error message, the compiling process just doesn't end. This is the ...
2
votes
1answer
150 views

Math with TikZ Strange Behaviour

I am working on a Tikz figure, which uses the sin and cos functions. Currently I use a Python script to compute the six function parameters, which are given to the Tikz "g" function, as shown below: \...
1
vote
0answers
144 views

pgfplots: Problem with ticks in logarithmic scale - math parse error [closed]

Why do I get the error ! Package PGF Math Error: Could not parse input '0.005,0.0005' as a floating po int number, sorry. The unreadable part was near ',0.0005'.. when pdflatexing the following ...
3
votes
1answer
327 views

Parsing input for table automatically generated from csv file

I have a .csv file which looks like: {one},{two},{three} 11/07/2014,14:49:54,(100,100) 2,2,2 I have some code which creates a table from the .csv file. \documentclass{article} \usepackage{...
4
votes
1answer
364 views

avoid logarithm of zero in pgfmathparse conditional assignment

How can i avoid the error message ! Package PGF Math Error: I cannot calculate the logarithm of '0' (in ' 0>1 ? ln(0) : 0'). in the following code? If possible, i want to evaluate the statement ...
9
votes
2answers
2k views

\ifthenelse with inequalities and expressions, using \pgfmathparse

I'm trying to write a function that draws a matrix with a some ones (in black) and zeros (white) in it with a certain pattern to the distribution of ones and zeros. I want to draw ones, only if they ...