Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [pgfmathparse]

The tag has no usage guidance.

1
vote
1answer
31 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
97 views

Include negative value in sum/total value in stacked bar chart

I have a stacked bar chart that looks like this. However, I'm trying to include the negative values (ninth column in the datatable) into the total value on the stacked bar chart so that in the end ...
1
vote
1answer
89 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
74 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
38 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
50 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
76 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
176 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
240 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
51 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?
3
votes
0answers
102 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
869 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
123 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
952 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. ...
3
votes
1answer
219 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
276 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
405 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 ...
7
votes
2answers
6k 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
223 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
147 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
117 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
135 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
266 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
312 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 ...
8
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 ...