# Tag Info

## Hot answers tagged coordinates

61

\node requires a caption: \node (name) at (coordinate) {caption}; \coordinate does not use a caption: \coordinate (name) at (coordinate); \node can also have a shape and dimension, \coordinate is just a point

47

Well, perhaps it's interesting to look at the pgfmanual : \coordinate is a shortcut for \path ... coordinate[⟨options⟩](⟨name⟩)at(⟨coordinate⟩) ...; and it's the same that node[shape=coordinate][]⟨options ⟩](⟨name ⟩)at(⟨coordinate ⟩){}, where the at part might be missing. Since nodes are often the only path operation on paths, there are two special ...

28

The TikZ package is great! I did the following: \documentclass{article} \usepackage{tikz} \begin{document} % TikZ picture with origin upper left \begin{tikzpicture}[yscale=-1] % 4x4 grid \draw (0, 0) grid (4, 4); % origin point \draw [color=blue, fill=blue] (0, 0) circle (0.1); % x-axis \draw [thick,-...

27

You can use the calc library for this. See section 13.5 Coordinate Calculations of the manual. To get the halfway point between two coordinates, you can use the syntax ($(A)!0.5!(B)$) or ($0.5*(A)+0.5*(B)$). For the rotated vector, you can use ($(A)!<length>!<angle>:(B)$). The midpoint between two coordinates can also be found using a \path ...

26

Tikz or pstricks are more powerful but LaTeX has a built in coordinate drawing system, and you really don't need to load an external package for this (although I loaded color) \documentclass{article} \usepackage{color} \begin{document} \setlength\unitlength{10pt} \begin{picture}(20,10)(0,-10) \thicklines \put(0,0){\line(1,0){20}} \put(0,0){\line(0,-1){10}}...

25

I don't understand the 3D behavior of tikz very well, but here's a way to do one of your pictures in Asymptote using a bunch of lines, arcs, and labels. A few of the built-in Asymptote commands I used: X is the unit vector (1,0,0) similarly for Y and Z expi(theta,phi) returns the unit vector in the theta,phi direction Updated to incorporate a few of ...

24

One option using TikZ. All distances are measured from the upper left corner of the paper (this can be easily modified to choose another origin point): \documentclass{article} \usepackage{tikz} \newcommand\PlaceText[3]{% \begin{tikzpicture}[remember picture,overlay] \node[outer sep=0pt,inner sep=0pt,anchor=south west] at ([xshift=#1,yshift=-#2]current ...

23

You can use the let syntax (See Section 14.15 The Let Operation of the manual); another option (suggested by percusse in a comment) is to use the |- syntax (page 131 of the manual). An example with both possibilities: \documentclass{article} \usepackage{tikz} \usetikzlibrary{calc,intersections} \begin{document} \begin{tikzpicture} \coordinate [label=...

22

Here is an embryonic tikz-3dplot solution, adapted from the example on p26 of the manual: \documentclass{article} \usepackage{tikz} \usepackage{tikz-3dplot} \begin{document} \tdplotsetmaincoords{60}{110} % \pgfmathsetmacro{\rvec}{.8} \pgfmathsetmacro{\thetavec}{30} \pgfmathsetmacro{\phivec}{60} % \begin{tikzpicture}[scale=5,tdplot_main_coords] \...

21

\coordinate[⟨options⟩](⟨name⟩)at(⟨coordinate⟩) ...; This has the same effect as \node[shape=coordinate][⟨options ⟩](⟨name ⟩)at(⟨coordinate ⟩){} This can be read in the tikz documentation. It is obvious, that coordinate has no content. It's mainly used for defining coordinates for referring them with names. \coordinate btw is a abbreviation for \path ...

19

I have prepared a lecture notes on electromagnetic field theory for my students. I have drawn surfaces used in cylindrical coordinate system. For this I have used tikz-3dplot package. Here is the code and output. I hope this is a starting point for you. \documentclass{article} \usepackage{tikz,tikz-3dplot} \begin{document} \begin{figure} \centering \...

18

Before trying to answer your questions, I'd like to make it clear that this is all based on experiment and in trying to follow what goes on through the code. So it's a guess - hopefully and intelligent one, though. Is it possible to use relative coordinates in the intersection syntax (a -| b)? Not really. What happens is that TikZ sees the -| and assumes ...

17

You can also adapt the solution from Extract x, y coordinate of an arbitrary point in TikZ and invoke \ExtractCoordinate{D} before you need the coordinates of this point and then use \XCoord or \YCoord where you need the value. The code below produces output identical to Gonzalo Medina's answer. Code: \usepackage{tikz} \usetikzlibrary{calc} % https://tex....

17

\documentclass{article} \usepackage {tikz} \usetikzlibrary{positioning} \begin{document} \begin{tikzpicture} \node (A){A}; \coordinate (x) [right=of A]; % <-- this does *not* work expected \coordinate[right=of A] (y) ; % <-- this *works* as expected \draw (x) -- ++(1,1); \draw[red] (y) -- ++(1,1); \end{tikzpicture} \...

17

How about drawing a real grid in the xy plane? This fixes the problem. Why? see below. \documentclass[a4paper]{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[usenames, dvipsnames]{xcolor} \definecolor{mgelb}{RGB}{255, 187, 0} \definecolor{mblau}{RGB}{10, 59, 104} \definecolor{mturkis}{RGB}{0, 171, 183} \definecolor{...

16

While our gurus are busy with their extensive answers here is a quick stab: There is an involved process to compute these curves and I don't think I can do justice with an answer that can fit here (although my work involves such interpolations pretty often). However I would like to quote the paragraph from the manual (p.25) which pretty much gives the ...

15

For the sake of completeness and future reference, if you have a point (a) defined, you can define a new point (b) which depends on the coordinates of (a) using the let as follows: \path let \p1 = (a) in coordinate (b) at (2*\x1,\y1/2); Since \coordinate is an alias for \path coordinate you have to use the above code if you want to use let for the ...

13

Well, as you already figured out, you missed an at in your coordinate specification: \coordinate (South West) at ($(current page.south east) + (-\XMargin, \XMargin)$); \coordinate (North West) at ($(current page.south west) + ( \XMargin, \XMargin)$); \coordinate (North East) at ($(current page.north west) + ( \XMargin,-\XMargin)$); \coordinate (South East) ...

13

You can achieve something like this relatively easily by defining a new style position/.style args={#1:#2 from #3}{ at=(#3.#1), anchor=#1+180, shift=(#1:#2) } Then you can specify the angle and the separation between the nodes using, for example, position=-120:{\nodeDist} from n2. If you want to use the value set in node distance, you can use \...

13

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] ($(ut)!8.0/9!(C)$) node [label=left:8/9] {} -- ++(1,0); \path[name intersections={of=target and C-c}] (intersection-1) coordinate[label=above:D](D) ...

12

As the other questions linked have explained the issue, I'll not go over old ground. Looking at the code there does not seem to be an easy way to say "Apply the following style (say, shift={(2,3)}) to all of the following points.". There is no every point style (contrast the many every path or every node or ...). Moreover, adding one in would not be ...

12

It isn't straightforward at all to add a general every coordinate style. But, a \iftikztransformnodecoordinates is fairly simply to hack. \documentclass{standalone} \usepackage{tikz} \makeatletter \newif\iftikztransformnodecoordinates \tikzset{transform node coordinates/.is if=tikztransformnodecoordinates} \def\tikz@parse@node#1(#2){% \pgfutil@in@.{#2}...

12

That's what the calc library is for: \documentclass{article} \usepackage{tikz} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} \node [draw] (X) {X node}; \draw (X.north west) -- ($(X.north west)!cos(45)!45:(X.north east)$) -- (X.north east); \end{tikzpicture} \end{document} The syntax is as follows: ($(A)!<fraction>!(B)$) referst to the ...

12

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); \draw [line width=10pt] plot[smooth, tension=.7] coordinates {(-4,2.5) (-3,3) (-2,2.8) (-0.8,2.5) (-0.5,1.5) (0.5,0) (0,-2)(-1.5,-2.5) (-4,-2) (-3.5,-0.5) (-5,...

11

Here is a solution using intersections and calc libraries. Method Draw and name (via name path) a first continuous path (x ranges 0 to 10). Draw and name (via name path) a second continuous path (x ranges 0 to 10). Foreach x in 0,...,100 : Draw and name a vertical line at x/10 (y ranges y-min to y-max of your paths). Search intersections (via name ...

11

This leaves the coordinates in scaled points (65536 sp = 1 pt) in a .pos file: \documentclass{scrartcl} \usepackage{tikz} \usetikzlibrary{calc} \newwrite\posfile \immediate\openout\posfile=\jobname .pos \newcommand\coordpos[1]{% \node at (#1) {\pdfsavepos\write\posfile{#1: \the\pdflastxpos, \the\pdflastypos}} } \begin{document} \begin{tikzpicture} \...

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