13 votes
Accepted

Tikz coordinate calculation

You can either use the intersection library to calculate the intersection of the path (C)-(c) with another path at height 8/9C (the red path in the first picture). \path[draw,red, name path=target] ($...
user avatar
  • 5,926
12 votes

Draw curve in same curve small

One way is not to draw two paths, but one path at two thicknesses \documentclass[12pt]{article} \usepackage{tikz} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} \coordinate (O) at (0,0); ...
user avatar
12 votes
Accepted

Define coordinate based on other coordinate in Tikz

with calc library, you can add coordinates \usetikzlibrary{calc} % in the preamble ... \coordinate (B) at ($(A)+(2cm,1cm)$); or with positioning library \usetikzlibrary{positioning} % in the ...
user avatar
  • 154k
12 votes
Accepted

Derived \coordinate in TikZ

Because what you've done is to add the B coordinate at the same place as A. This is because (A)+(1,0) is not a single coordinate specification, what it does is to first move "pen"/active ...
user avatar
11 votes

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

With the TikZ library math looks quite intuitive :) \documentclass{article} \usepackage{tikz} \usetikzlibrary{math} \begin{document} \begin{tikzpicture} %Two points (A) and (B) \coordinate (A) at (0,...
user avatar
11 votes

3D Cartesian Coordinate System

With some styles and declare function for constants. The grids are drawn manually with one loop, the ticks with labels with a second loop. Use the scale parameter to adjust the size of the diagram. \...
user avatar
11 votes
Accepted

Tikz: Extract polar coordinate

You can define your own macro analogous to \pgfgetlastxy to extract the last cartesian coordinates, convert them into polar coordinates and store the resulting values in macros: (Thanks to @John ...
user avatar
10 votes

Pass a 3d coordinate via pgfkeys

As stated in my comment, the fundamental problem is that the statement \coordinate (A) at (1,1,0); only stores the 2d representation of the point in (A). Using pgfkeys we can define a new command ...
user avatar
10 votes

automatic tikz coordinate calculations

A solution using TikZ powerful let...in syntax, which produces a code short and readable: \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{calc} \begin{document} \def\nextZ#1{ \path let ...
user avatar
  • 54.5k
10 votes

Draw uniform lines/grid on a distorted square/axes?

Here's one better way, using Metapost, using the point x of y notation. TikZ has the same idea, but using a rather more compact notation. With this set up you can move your four points as much as ...
user avatar
  • 36.1k
10 votes
Accepted

Using vectors in TikZ?

Coordinates are already some kind of vectors. Library calc provides the addition of coordinates: \documentclass{article} \usepackage{tikz} \usetikzlibrary{calc} \begin{document} \tikz\draw (0, 1) ...
user avatar
10 votes
Accepted

How to iteratively define coordinates in TikZ?

You can use (A\i) \documentclass[]{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \foreach \i in {0,1,2} { \coordinate(A\i) at (0, \i); \coordinate(B\i) at (1, \i); } ...
user avatar
  • 7,831
10 votes
Accepted

Draw a Line Between Two Points described by Trigonometric Calculations

You're almost there. Two things to fix: \cos is a macro defined to typeset cos. To have PGF parse it as the cosine function you have to remove the backslash and let it parse the three letters c, o, s ...
user avatar
10 votes
Accepted

How can I draw angled lines in LaTeX to create ruled template for calligraphy?

You can use polar coordinates such as (55:100cm). In the code below, I compute the precise number of oblique lines to draw in function of the chosen angle \myAngle and the distance \myDist between two ...
user avatar
  • 22.9k
9 votes
Accepted

Tikz-Control relative coordinates in background layer

You can make use of the fit-library. You can pass the nodes you want to include to the fit-option and put the fitting-node on the background layer. In your example it is sufficient to fit the three ...
user avatar
  • 4,356
9 votes
Accepted

automatic tikz coordinate calculations

You could do something like this: \documentclass[border=3mm,tikz]{standalone} \begin{document} \begin{tikzpicture} \pgfmathsetmacro{\Xi}{0.9} \pgfmathsetmacro{\Yi}{0.5} \pgfmathsetmacro{\Coeff}{0.8} ...
user avatar
9 votes

Draw in cylindrical and spherical coordinates

First, I want to give all the credit to @mrc . His work is quite good. I want to complete a few details on his work. Basically he is missing two segments which makes sometimes the visualization ...
user avatar
9 votes

Accessing the logic values of a TikZ coordinate

Here is another method to extract coordinate values from a node or an anchor. Its advantage is to provide these values ​​taking account of the current origin. \makeatletter \def\extractcoord#1#2#3{ ...
user avatar
  • 68.1k
9 votes

drawing smooth path through symmetric points, gives non symmetric curve

Try the Hobby Tikz library. It allows you to specify the incoming and outgoing angles, and produces a smoother curve. \documentclass[10pt,a4paper]{article} \usepackage[utf8]{inputenc} \usepackage{...
user avatar
9 votes

Tikz: Placing a node relative to the (rectangular) coordinates of another

Similar to Harish's answer with more details on positioning syntax I think there is a confusion about the positioning syntax. It doesn't use polar coordinates but if given only one argument it ...
user avatar
  • 154k
9 votes
Accepted

Storing and re-using tikz coordinates for position and tangent vectors

Here is a solution where: (f-\t) is a point on the curve, (f'-\t) is the associate tangent vector. \documentclass[border=5pt]{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture} \...
user avatar
  • 68.1k
9 votes

To draw a graph like this, what code do I need?

Have a look at the following code: \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture}[scale=5] \draw[blue] (0,0) circle (1); \node[circle, fill=orange, label=above left :$...
user avatar
  • 4,828
9 votes
Accepted

Combining calc and perpendicular coordinates in tikz

The syntax of the line to operation given in the manual is to place |- between two coordinates: Sometimes you want to connect two points via straight lines that are only horizontal and vertical. ...
user avatar
  • 23.2k
8 votes

Transform defined coordinates in TikZ

Not as pgf-hacky as the other answers, but how about the following. Very straight forward, simple and easy to understand workaround. \documentclass{article} \usepackage{tikz} \begin{document} \begin{...
user avatar
  • 561

Only top scored, non community-wiki answers of a minimum length are eligible