tikz add tag
samcarter
I have a document that heavily uses the old TikZ syntax for circles, ellipses and arcs:

```
\draw (0,0) circle (0.45);
\draw (0,0) ellipse (1.4 and 4);
\draw (0.65,0.61) arc(180:360:0.35 and 0.35); 
\draw (0.65,0.61) arc(180:360:0.35);
```

How can I use texstudios search and replace with regex to change it to the new syntax?

```
\draw (0,0) circle[radius=0.45];
\draw (0,0) ellipse[x radius=1.4, y radius=4];
\draw (0.65,0.61) arc[start angle=180, end angle=360, x radius=0.35, y radius =0.35]
\draw (0.65,0.61) arc[start angle=180, end angle=360, radius=0.35];
```








Top Answer
samcarter
The following search and replace terms will update the syntax

### Circle:

- search: `circle \(([^\)]*)\)`
- replace `circle[radius=\1]`

### Ellipse

- search: `ellipse \(([^\)]*) and ([^\)]*)\)`
- replace: `ellipse[x radius=\1, y radius=\2]`

### Elliptical arc 

- search `arc\(([^\)]*):([^\)]*):([^\)]*) and ([^\)]*)\)`
- replace `arc[start angle=\1, end angle=\2, x radius=\3, y radius =\4] `

(if you have both elliptical and circular arcs in the same document, do the elliptical arcs first)

### Circular arc

- search `arc\(([^\)]*):([^\)]*):([^\)]*)\)`
- replace `arc[start angle=\1, end angle=\2, radius=\3] `

(Don't forget to activate the `Reg` and `\1` buttons in texstudio to use this syntax)

![Screen Shot 2020-01-02 at 22.13.45.png](/image?hash=f7ca2611f9a33ab3f4c35380d098912b2cb265534c94bba79bc0cf0306a6d293)

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.