Tag Info

82

\draw (x,y) arc (start:stop:radius); draws an arc with radius radius starts from (x,y) with center (x-r*cos(start), y-r*sin(start)) and ends at (x-r*cos(start)+r*cos(stop), y-r*sin(start)+r*sin(stop)). For example, \draw[red] (0,0) arc (30:60:3); draws an arc of radius 3 starting from (0,0) with center (0+3*cos(30+180),0+3*sin(30+180)) and ...

66

If people come to this question via Google (like me) and want to get only a rectangle with rounded corners: \draw[rounded corners] (0, 0) rectangle (4, 1) {}; This is an empty rectangle with rounded corners. The rectangle is from (0, 0) - the lower left corner - to (4, 1) - the upper right corner.

45

Now as TikZ 3.0 is here we can use pic. \documentclass[tikz,border=5]{standalone} \tikzset{ pics/carc/.style args={#1:#2:#3}{ code={ \draw[pic actions] (#1:#3) arc(#1:#2:#3); } } } \begin{document} \begin{tikzpicture} \pic{carc=-30:30:2cm}; \draw[thick] (4,0) circle (1 cm) pic[red, -latex]{carc=100:150:1.3cm}; \end{tikzpicture} \end{...

33

For visualisation, here is a diagram: where theta_i is the start angle, theta_f is the end angle, R is the radius, O is the centre of rotation (not the origin), A is the starting point, B is the end point. Answers to your question The start and end angles seem to be defined relative to the y axis, yet in the Tikz manual they are defined relative to the x ...

24

Why not using rounded corners locally/globally on the path? \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \draw (0,0) {[rounded corners=15pt] -- ++(2,0) -- ++(0,1)} -- ++(-2,0) -- cycle; \draw[rounded corners=15pt] (4,0) rectangle ++(2,1); \end{tikzpicture} \end{document}

24

This shows how to adjust the angles in your original commands (I've scaled the rectangle down just so the labels show up better) and then demonstrates the use of rounded rectangle from the shapes.misc library. \documentclass[tikz,border=5pt]{standalone} \usetikzlibrary{shapes.misc, positioning} \begin{document} \begin{tikzpicture} \draw (0,0) arc[...

22

Without numbers: \documentclass[tikz]{standalone} \begin{document} \begin{tikzpicture} \draw [ultra thick] (-8,0) -- (8,0); \draw [ultra thick] (0,0) circle (8); \foreach \i in {0,1,2,3} {% \draw [ultra thick] (90*\i:8) arc (270+90*\i:180+90*\i:8);} \foreach \i in {0,1,...,7} {% \draw [very thick] (...

21

It is not any different than the examples given by other languages. Only a few places where expansion needs to be taken care of. I didn't really go for the code golf but it seems working. And it gets fainter as the recursion depth increases. \documentclass[tikz]{standalone} \newcount\recurdepth \begin{document} \begin{tikzpicture}[scale=2] \draw[style=help ...

18

Option rounded corners can be used to draw an arc without specifying the more complex syntax of arc: \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture}[x=1cm, y=1cm] \filldraw[black] (0.5,0.5) circle (0.5); \draw[-,thick,red] (-1,1) [rounded corners=0.5cm] -- (1,1) [sharp corners] -- (1,-1) -- (-1,-1) ; \...

17

The problem is not really about the arc command. It is about how TikZ shortens any curved path. Using arc or controls or to[in= , out=] all produce the same problem. Consider the image: which is created with the code \begin{tikzpicture}[scale=10] \draw[line width=5mm, color=green!75!black] (0,0)--(30:1) arc(30:80:1) -- cycle; \draw[line width=5mm, color=red!...

16

I was wondering the same thing yesterday in the comments of this answer on a close subject. For recursive drawings as this one are (relatively!) easy to do with languages closely related to (La)TeX, but external to it, as MetaPost or Asymptote. For example, here is my "quick and dirty" attempt with MetaPost on the Farey diagram illustrated in the original ...

14

TikZ 3.0.0 provides a bending library for arrow tips placed on non-straight paths (see 16.3.8 Bending and Flexing on pgfmanual). Loading the library makes flex=1 the default choice, but sometimes it worth to use custom values: \documentclass[tikz,border=3pt]{standalone} \usepackage{tikz} \usetikzlibrary{arrows.meta,bending} \begin{document} \begin{...

13

Only part of what was required. But it also shows how a key with the required syntax could be programmed: \documentclass[tikz,border=5]{standalone} \tikzset{% insert arc/.style args={#1:#2:#3and#4 with center #5}{ insert path={ \pgfextra{% \pgfpointxy{#3}{#4}% \pgfgetlastxy\arcrx\arcry% \pgfcoordinate{#5}{% \pgfpoint{\csname ...

13

There is a standard Unicode character tie: ⁀ Unicode: U+2040. Used with an appropriate font and XeLaTeX or LuaLaTeX you can just put it directly into your source or make a macro. (Since it's designed to go on top of two characters, you need to wrap it in spaces for this use, so I've turned it into a macro: % !TEX TS-program = XeLaTeX \documentclass{...

13

Like this? \documentclass[border=10pt,multi,tikz]{standalone} \begin{document} \begin{tikzpicture} \foreach \m in {0,1,2}{ % draws shaded regions \draw [fill=gray!50!white, rounded corners] ({ 15+120*\m}:2.25) arc ({15+120*\m}:{129+120*\m}:2.25) -- ({129+120*\m}:1.75) arc ({129+120*\m}:{15+120*\m}:1.75) -- cycle; } % draws non shaded regions \...

12

You can avoid this by adding the bending library. \documentclass[border=2mm]{standalone} \usepackage{tikz} \usetikzlibrary{calc, arrows.meta, bending} \begin{document} \begin{tikzpicture}[ bigframearrow/.style={-{Latex[length=12mm,width=8mm]}, line width=3mm}, ] \definecolor{myorange}{rgb}{1.0,0.5,0} \def\R{5cm} \fill[gray] (0,0) circle (\R); \draw[...

11

A recommended solution with PSTricks. Still version With pst-eucl: \documentclass[pstricks,border=12pt]{standalone} \usepackage{pst-eucl} \psset{PointName=none,PointSymbol=none,linewidth=3\pslinewidth} \begin{document} \begin{pspicture}[showgrid](9,7) \pstGeonode(4,4){O}(1,2){A}(8,1){B} \pstCircleOA[Radius=\pstDistVal{2}]{O}{} \pstMiddleAB{A}{...

10

This would have been a lot easier using tikz3d. \documentclass[a4paper]{article} \usepackage{amsmath} \usepackage{amssymb} \usepackage{tikz} \usepackage{graphicx} \usetikzlibrary{intersections,arrows.meta,angles} \usetikzlibrary{shapes.geometric} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} %\draw[step=1cm,gray,very thin] (-6,-6) grid (6,6); ...

10

Sandy G has provided an excellent analysis of the issue and a good solution. This is an alternative solution that results in a single path at the end, which is therefore more suited to situations in which that is a consideration, such as if the region is to be filled. It uses my spath3 TikZ library, and I've just added some extras needed to achieve this, so ...

9

This is cheating. Utterly, utterly cheating. It’s a Python script which generates the TikZ necessary to draw a Farey diagram. I use the definition from the Wikipedia page on Farey numbers to generate the successive Farey sequences. This gets processed into a form suitable for TikZ: a list of terms num/denom/nextnum/nextdenom which you can loop over with \...

9

This is best done in one path. \filldraw[fill=gray] (1,0) arc [radius=1, start angle=0, delta angle=90] -- (0,3) arc [radius=3, start angle=90, delta angle=-90] -- cycle; Or, if you’re feeling funny, for a fake filling, you can use the double option which draws one bold black arc followed by a slightly smaller gray arc ...

9

This is not very elegant, but I think it gives the result you are after: \documentclass{standalone} \usepackage{xcolor} \usepackage{tikz} \begin{document} \begin{tikzpicture} \newcommand\rad{2} % circle radius \draw[very thick,<->] (-3,0) -- (3,0)node[anchor=north west] {$x$}; % red \draw[red,thick] (-\rad,0) arc (180:135:\rad); \draw[red,thick] (-\...

9

You can "stack" actions, so have a post action in a post action in a post action ... and so on. For some reason unknown to me, a double line as postaction to a double line produces not the desired result, but a way to wide line with wrong proportions. But one can stack post actions to draw lines alternating in black and white to achieve the look of four ...

9

Since you only require relatively short arc segments, I would suggest cheating and using a linear shading instead of trying to be correct. You could look up the definition of the color wheel shading in pgflibraryshadings.code.tex and try to modify it, but few PDF readers render it right. I first tried to use the shading angle key to rotate the shading, but ...

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