{pgfmath} concerns the pgfmath library used for internal computations in TikZ-pgf but which is also available for other computations in (La)TeX.
5
votes
3answers
796 views
Print integer without fraction part
In a Tikz Figure, I'm doing some computation and want to print results as label of nodes.
The problem is that I only need the integer part of the number to print.
I tried with round() function. It ...
2
votes
1answer
456 views
Using an array element to specify end iteration point in TikZ “\foreach”?
Is it possible to access an array and use one of its elements to specify the last iteration point in a TikZ \foreach?
I've tried with the code below but I keep getting a compilation error:
! ...
3
votes
1answer
2k views
Using the commands \pgfmathparse and \pgfmathresult
How do I use the commands \pgfmathparse {tan (pi/3 r)} \pgfmathresult
to draw the green line in the figure below?
\begin{tikzpicture}[>=latex,scale=2]
\draw circle (1);
\draw[->] (-1.2,0) -- ...
4
votes
1answer
191 views
Change “<” to “<=” in pgfmath's and function
I am using this method for Defining a Piecewise Function for PGFplots and want to specifically define the function value at the endpoint to be 1, not 0. When I change the < in the and to <= I ...
15
votes
1answer
469 views
Is it possible to load pgfmath without loading the full pgf package?
Update Oct 30th 2011
This has now been fixed in the CVS repository of PGF due to my bug report. With this version \usepackage{pgfmath} should work.
I would like to use pgfmath in one of my ...
3
votes
1answer
381 views
Good workaround for pgfmath/tikz definition of inverse cosine?
I wanted to draw a graph of y = arccosine(x) and saw in the Tikz documentation the function acos which claims to do this but returns a result in the range [-90,90] (degrees). I was surprised by this ...
5
votes
2answers
235 views
Why does enumitem need the macro to exist already?
I'm using pgf and enumitem to define a hexadecimal enumeration scheme as follows:
\documentclass{article}
\usepackage{pgf,enumitem}
\makeatletter
\newcommand*{\Hex}[1]{%
\expandafter\@Hex\csname ...
1
vote
2answers
234 views
\pgfmathdectobase macro \pgfmathresult digit index or bitwise operators
Is there a way to access each digit of a macro returned by \pgfmathdectobase (or \pgfmathresult) which is a binary number ? This would be useful for a function which prints the power set of a given ...
4
votes
1answer
180 views
Unit-free ratios in \path let
I want to compute pure ratios of distances in a \path let construction; for example, in the document fragment
\path let \p1 = (1cm, 2cm), \n1 = {\y1 / \x1} in ...
I would like \n1 to be the number ...
10
votes
2answers
547 views
How to solve the 10.09999 rounding problem with pgfmath?
I'm trying to create a technical drawing of a magnetic write head with dimensions on it. I'm using some macros which help a lot from here: Dimensioning a technical drawing.
\documentclass{beamer}
...
8
votes
1answer
587 views
How to omit printing the decimal part in pgfmath macros
In Dimensioning of a technical drawing in TikZ a very nice solution to mark lengths on a drawing has been given that uses pgfmath's capability. How do I omit having the decimal part of the number ...
7
votes
1answer
1k views
Increment loop variable in inner foreach loop
I need the following pairs of numbers:
12 13 14
23 24
34
My first attempt was to use two nested foreach loops:
\foreach \x in {1,...,4} {
\foreach \y in {\x+1,...,4} { % This would be very easy in ...
5
votes
3answers
2k views
PGF Math Function to compute cube root
When I found that a simple x^(1.0/3.0) does not yield a graph in PGFplots for negative values of x, I attempted to define my own function for CubeRoot using pgfmathdeclarefunction as below. But, am ...
8
votes
1answer
1k views
\ifnum and pgfmath: error
In the following example I want to use \ifnum to compare two numbers computed by pgfmath, for simplicity I use simply 1 and 2 in the example below. Compiling this code gives me the error:
ERROR: ...
4
votes
2answers
586 views
Use variable in domain of a plot in tikz
Consider the following example:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc,patterns,decorations.pathmorphing,decorations.markings}
\begin{document}
\begin{tikzpicture}
...
7
votes
2answers
1k views
Store \pgfmathresult in a variable
The result of \pgfmathparse is automatically stored in \pgfmathresult. Is it possible to store it in an other variable, too?
3
votes
1answer
522 views
Variables and basic arithmetics and tikz-euclide
I want to draw a circle using tkz-euclide and n segments of this circle. Since I want to have n as a basic variable I need to divide in the following example. However it doesn't work, any ideas?
...
14
votes
2answers
1k views
Pascal's triangle in tikz
I would like to typeset the top part of Pascal's triangle. To get the triangle with the names of the binomial coefficients, i.e., {n \choose k}, I used the following code
\begin{tikzpicture}
\foreach ...
5
votes
1answer
212 views
TikZ: How to compare approximate equality of dimensions?
When scaling tikzpicture using option scale, some points that had equal coordinates appear to be shifted a little bit. So the precise comparision \ifdim \y1 = \y2 will not do anymore.
I'm aware of ...
6
votes
1answer
1k views
Using ifthenelse in pgfmath
Following questions on constructing functions on the forum, I tried to build some myself. I can't seem to get the ifthenelse function in TikZ/PGF to work. Here is an example:
...
4
votes
1answer
332 views
Pgfplots jump mark error when plotting a floor function
For some weird reason the following code gives me the wrong plot
\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot+[jump mark left,samples ...
5
votes
1answer
632 views
Persistent random steps decorations during beamer \uncover
I'm using a random steps decoration with a path that appears through several uncover transitions. Currently the decoration is redrawn in each instance of the slide. How can I change this behavior. ...