5
votes
2answers
216 views

Do multiplication rules differ in TikZ compared to standard TeX?

I'd like to scale a line according to \figscale. Here it is said that the below syntax should work in general, but in this graphic it does not. As the picture shows, the numbers are just concatenated ...
2
votes
1answer
35 views

\widthof text in a def'd subroutine inside a tikzpicture? [duplicate]

I have already seen \widthof within tikzpicture, but this is slightly different. I have a rather complex Tikz image, which I'd like to eventually include in a Latex document; as such, I'd like this ...
1
vote
1answer
82 views

Tikz: How to combine orthogonal edge syntax with coordinate calculation? [duplicate]

I'm trying to combine the syntax for orthogonal edges (p |- q) with the syntax for calculation relative coordinates ($ (a) + (1,0) $). Example: \draw ($ (node1.south) + (1,0) $) to ( ($ (node1.south) ...
5
votes
1answer
102 views

Resize tikzfigure in tcolorbox depending on height of tcolorbox

in my book I got many different type of boxes so I made some macros placing the boxes automatically according to their arguments. That's one of them. So far I made some boxes that have big "+" and ...
10
votes
3answers
722 views

TikZ coding style

I've got a piece of TikZ code here and since I am only starting to learn how to use it, I wanted to ask whether this code would be regarded to be ok or rather completely unreadable and what I can do ...
11
votes
4answers
266 views

Calculations in TikZ for iterative procedure

In many \foreach iterative procedures in TikZ I would like to relate the generic node called n\x -- where x is a natural number -- to another node the name of which is obtained by applying basic ...
1
vote
1answer
71 views

How do I store the x or y value of a named node in tikz \draw?

A big part of the question above has already been answered: "Use the calc tikzlibrary and the let syntax". \begin{tikzpicture} \draw [help lines] (0,0) grid (4,4); \node (A) at (2,1) {A}; ...
2
votes
1answer
159 views

How to calculate intersections of a line defined by a segment and an ellipse in tikz

EDIT Here's what I intended to ask, but didn't clearly formulate initially. The Tikz package intersections allows one to calculate and manipulate the intersection point of two non-parallel lines ...
8
votes
1answer
316 views

Rotate a path around a point

I have a named path (a triangle). How do I rotate it around point A in various angles without recalculating points B & C? Here's my code. I want to create the red and green triangles by simply ...
1
vote
1answer
217 views

Can I calculate a square or square root to include as coordinates in a tikz picture?

I am trying to draw the folding lines of a paper plane. This as a template for my kids to learn how to fold a paper plane. I came as far as: % based on ...
3
votes
1answer
508 views

Tikz: Scale coordinates perhaps using the calc package

I've drawn a rectangle like this: \draw[color=orange, fill=orange, opacity=0.1] (Q3term1) rectangle (Q3term2); and essentially, what I want is to do is stretch the rectangle by 10% horizontally and ...
8
votes
2answers
306 views

Fixed Point Arithmetic: Why does the fp work sometimes but others it errors?

Why does fixed point arithmetic like to error on parts of the code that aren't doing any math? I am using the package to improve the calculation of some angles I have it printing out, but it is ...
1
vote
3answers
609 views

How can I draw tikz arrows on a calculated triangle?

I am going to need a lot of vector triangles and would like to do them with TikZ. My TikZ experience is close to not existing. Therefore I would like to ask you, if there is a possibility to draw ...
5
votes
2answers
493 views

TikZ: Make node height span several others

How can I make the Z node span the total height of the ABCD column? My current code is: \documentclass{article} \usepackage{tikz} \usetikzlibrary{calc,positioning} \begin{document} ...
3
votes
1answer
592 views

Calculate numerical value for node text in TikZ

I am using a tikzpicture environment to draw a Temperature v composition plot. I do not have exact data so am only mimicking it. I am aware that I could/should use pgfplots but the issue could be ...
2
votes
1answer
300 views

Modulo calculation in PGFplots tick label

I am printing a diagram and want to use a_[0...3] as tick labels on the x-axis. Right now I have a[0...7] as labels and look for a way to print a[\tick mod 4] (i.e. a_0, a_1, a_2, a_3, a_0, a_1, a_2, ...
1
vote
2answers
219 views

Calc and \settocdepth break \tikzexternalize

This might well be the strangest TeX behaviour I've ever seen and that's saying a lot. The following really is a MWE as far as the header is concerned: \documentclass{memoir} \settocdepth{subsection} ...
5
votes
1answer
488 views

Right Angle Symbol Alignment with TikZ/Calc

I used a solution from @Jake from this post Insertion of Perpendicular Symbol at Intersection of Two Lines, but the alignment is not quite right. I have my suspicions why, but I don't understand the ...
4
votes
2answers
269 views

Different Results for distance by sqrt and veclen

I'm trying a simple task of drawing a tangent to a circle. While I already succeded with the tangent cs option, I also want to use the library calc for the exact intersection points. I simply start ...
7
votes
1answer
759 views

Computing value using pgfmath for use in coordinates?

Why can't I use the outcome of using pgfmath in a TikZ coordinate? Here is a (minimal) example that does not work: \documentclass[11pt]{article} \usepackage{tikz} \begin{document} ...
6
votes
3answers
198 views

How can I calculate the length of the longest word in a node?

I would like to create an inline brace command \inline{} for xelatex using TikZ. The difficult part is calculating the text width for the node without hardcoding it into the tikzpicture environment. ...
3
votes
1answer
177 views

Calculating the minimum height for a node based on the size of other nodes

Consider the following example: \documentclass{article} \usepackage{tikz} \usetikzlibrary{calc} \usepackage{xcolor} \begin{document} \def\mydist{1mm} \begin{tikzpicture}[ mystyle/.style={ ...
6
votes
1answer
699 views

tikz label coordinates using mathematical expression from foreach variables

\documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \foreach \x [count=\xi from 1] in {-3.0,-2.8,...,1.8} \draw[thin] (0,0) ++(\x,2) rectangle ++(0.2, 0.2) ...
8
votes
2answers
196 views

TikZ grouping expressions in calculations

I had to do some calculations like: \node (A) {A}; \node (b) at (x,y) {B}; ((A) + (B))*2 However I could not figure out how to group it in a calc statement, I tried ($((A)+(B))*2$) and ...
8
votes
1answer
813 views

Using let command in TikZ but want to have reference to new point later as well

I'm beginning to use TikZ and am having some issues understanding the proper way to reference my data points without specifying the precise absolute positions for all of them. An example of the simple ...
6
votes
4answers
181 views

How can I calculate within style values?

Is it possible to calculate (addition etc.) in style values? I wanted to do the following: \documentclass{article} \usepackage{tikz} \usetikzlibrary{positioning,fit,chains} ...
17
votes
1answer
485 views

Setting TikZ curve control points and preserve area of closed curve

I would like to reproduce the shown periodic table, with more correct areas. http://www.meta-synthesis.com/webbook/35_pt/relative_abundance.jpg I would appreciate any ideas to how this can be ...
16
votes
3answers
1k views

PGF math engine imprecise?

The command \pgfmathparse{asin(1/\x)} yields for each \x in the range of 125 to 142 the same value, whereas \pgfmathparse{1/\x} yields the much more precise values for each \x. Is the ArcSin function ...
9
votes
1answer
298 views

How to fit ellipse into another object - using intersections and calc library

I would like to ask, how to place ellipse into any object, so that the length of the main arm is defined by line1 (point A, B) in my code: calculate the coordinates of the ellipse midpoint rotation ...
22
votes
4answers
1k views

Get derivative of a function

I want to write a macro, which takes a mathematical function as argument and returns a plot using pgfplots of the function and of its derivative. I guess that this isn't possible using just LaTeX; ...
11
votes
2answers
819 views

Compute the x distance between two nodes

Is there a way to define a macro which would evaluate to the x part of the distance between two nodes? I know there are the point registers \p and the correspoding \x commands, but I find them rather ...
6
votes
1answer
561 views

Extract coordinates from 3D point

How do I extract coordinates from a three-dimensional point defined when using tikz-3dplot? I would like to perform some calculations on these (more specifically a cross-product of two vectors), but ...
12
votes
2answers
444 views

Is there a better way to do intersections and calculations with relative coordinates in TikZ?

I've been doing many TikZ diagrams lately and every so often I encounter a situation where I am forced to use some temporary coordinate in a \path. In the following short example, the problem is ...
7
votes
3answers
3k views

Line through two points with offset in TikZ

I could not find a native command in TikZ allowing to draw a line going through two specified points where an offset can be controlled. So far, I'm using the calc extension to perform what I need but ...
4
votes
1answer
1k views

Can't find TikZ library calc

I've been googling for some time now, and can't find the manual for the TikZ library calc. All I see is people using it. Where can I find the manual or some info? Is it the same as the LaTeX package ...
1
vote
1answer
600 views

Sequent Calculus

What is sequent calculus? See wiki: http://en.wikipedia.org/wiki/Sequent_calculus So basicaly I'd like to produce something like this: Maybe using Tikz?
7
votes
3answers
2k views

How to Intersect an arc with a line without calculating the angle

I'd like to draw an optics-related figure, for which I need to draw several beams with varying opening angles, which will need to be labeled. What I've come up at the moment (boiled down to a minimal ...
6
votes
2answers
2k views

Coordinates A, B: compute |B-A| and angle between +x and (B-A)

This question has two parts: why is the angle computed always 0 (should be 45) what is a straightforward way to compute distance between coordinates (there is How can I compute the distance between ...
4
votes
1answer
435 views

Prevent tikz to calculate

I just played with an answer to a question I asked here some time ago: Divide a rectangle into n times k equal cells. I wanted to be able to generate the list of points in a separate macro, however ...
16
votes
2answers
3k views

How can I compute the distance between two coordinates in TikZ?

Given two points (defined, for instance using nodes), I want to compute the distance between them. Is there some build in functionality in tikz to do this? If not, how can it be done using the ...
21
votes
2answers
5k views

Problems with TikZ calculations

When can I use functions and do calculations in TikZ? How do I make this work: \draw (0,0) arc(0:90:sqrt(15)); %not ok why is this working: \draw (0,0) arc(0:asin(1):5); %ok with ...
17
votes
2answers
4k views

Is plotting exponential graphs a known source of bugs in TikZ?

I want to plot $y = 2^x$ over a small domain. Unfortunately, even though tikz (v 2.1) seems to be able to calculate 2^{negative numbers} it is not plotting them correctly. My minimal example is: ...
9
votes
1answer
4k views

simple arithmetic on index of foreach statement in tikz

Is foreach really a tikz statement or is derived from some other package? I would like to draw a horizontal axis with 7 ticks spaced 1 cm apart. I'd like to place a label under each tick that is the ...
2
votes
1answer
4k views

TikZ Coordinate calculation - calculate coordinates separately

I'm trying to calculate coordinates based on existing coordinates but each coordinate individually. The first thing which is unclear to me is how to define scalar variables. I can define coordinates ...
2
votes
1answer
1k views

Calculating position in tikz

I'm trying to do calculation to be used in tikz. Here is my current code: \def\monthtabpos#1% {\ifthenelse{#1<7} {\dimexpr \numexpr -3*#1 \relax cm} {\dimexpr \numexpr -3*(#1-6) \relax ...
7
votes
1answer
1k views

Shrinking text to the width of a node within a tikzpicture

I would like to be able to scale text to the width of a TikZ node. Using \widthof within tikzpicture as a starting point, I've arrived at somewhat of a solution, except it has incorrect spacing, and ...
5
votes
2answers
1k views

How can I nest coordinate calculations in TikZ?

Why does this not work? I'm not using LaTeX and TikZ very much; I don't see it. \begin{tikzpicture} \coordinate (Zero) at (0,0); \coordinate[label=below:cell a] (vertexA) at (0, 10); ...
3
votes
2answers
1k views

Calculate maximum of lengths

How can I calculate a maximum of lengths? I am aware of pgfmath's function max(x_1,x_2,...) \documentclass[a4paper,draft]{article} \usepackage{tikz} \pgfmathparse{max(3,4)} \begin{document} ...
5
votes
2answers
1k views

\widthof within tikzpicture

In this minimal example \documentclass{scrartcl} \usepackage{calc} \usepackage{tikz} \newlength{\TestLength} \begin{document} \setlength{\TestLength}{\widthof{\tikz \node {bla};}} ...
5
votes
2answers
1k views

How to use pgf-math inside an argument?

I response to xport's recent questions, I tried to do the following \usepackage{pgf} [...] \rule{\pgfmathdivide{4}{3}\pgfmathresult mm}{5mm} Unfortunately, this fails with the following error ...