More fully than the title: When does TikZ either require or forbid a semicolon at the end of a command?

Learning TikZ I naturally go on line and copy instructions for drawings like the ones I want to make. A lot of these examples have a semicolon after each command, which seems to be what the TikZ manual does.

But many other examples, with many command in them, use no semicolons, and still work fine for me. I tried adding a semicolon at the end of each command in one of these it still worked. But can adding a semicolon at the end of a command sometimes cause trouble?

What is the general rule?

As the comment requests here is a TikZ drawing that works for me, with no semicolons:


\tkzGetPoint{I} \tkzGetLength{rIN}
\tkzGetPoint{K} \tkzGetLength{rCI}
\tkzDrawCircle[R,blue](I,\rIN pt)
\tkzDrawCircle[R,red](K,\rCI pt)
\tkzLabelPoints[above left](A,I,K)
  • 2
    Each TikZ command does require a semicolon to end it. Perhaps you could post a sample compilable document with examples of the code you think doesn't require it.
    – Alan Munn
    Aug 22, 2016 at 23:50
  • 2
    But PGF commands don't necessarily need semi-colons. In addition, you can define macros which include the semi-colons and then you don't need to add them again.
    – cfr
    Aug 22, 2016 at 23:56
  • 4
    None of these commands are tikz commands. They are tkz commands defined by the tkz-euclide package. And as @cfr notes, you can define commands with semicolons inside them which therefore don't themseleves require semicolons, which is what tkz-euclide does.
    – Alan Munn
    Aug 23, 2016 at 0:08
  • 1
    tkz-euclide defines those macros such that the definitions of the macros include the semicolons. Hence, you don't need to add them yourself. But TikZ is still dependent on the semicolons. They are just hidden behind the tkz obfuscation.
    – cfr
    Aug 23, 2016 at 0:10
  • 1
    @cfr chacun à son goût. ;)
    – Alan Munn
    Aug 23, 2016 at 0:12

1 Answer 1


The simple answer to your question is "almost always". As a rule of thumb, every tikz drawing command is delimited by a semicolon. The \foreach command also uses a final semi-colon even though it doesn't necessarily draw anything. However, as you have shown in your sample code, it's possible to construct code which goes inside a tikzpicture environment which does not require a semicolon.

The reason for this is that all of the commands you have shown are macros which have been defined with the semicolons already included in the macro definition. This was a design choice by the author of the tkz-euclide package. I won't comment on whether this was a good design or not. It clearly simplifies the interface but at the expense of making the commands behave differently from regular tikz commands.

For example, a simplified version of the internal command that the \tkzDrawCircle command uses is the following: (I've simplified the actual code to make the example clearer.)

... set some keys for DrawCircle/.cd using #2
\draw[/DrawCircle/.cd,line style,#1]%
   (tkzPointResult) circle (\tkzLengthResult pt);%      

So the actual tikz command \draw is delimited by a semicolon inside the definition.

As cfr notes in her comment, it's also the case that the low level pgf commands that are the underlying layer of code for TikZ also don't require semicolons. But as a regular end user of TikZ you are unlikely to use or see these commands, since they would normally only be used within macro definitions or \tikzset commands.

This exception also applies the the \tikzset command itself, which even if you used it inside a tikzpicture environment would not use a semicolon.

One benefit of the semicolon syntax is that since there is a semicolon to terminate the current command you can introduce more flexibility to the order of arguments etc. and TikZ can parse it as well as it can. This is not possible with a fixed structure e.g., if you happen to forget to remove a space in

\tkzDefPoint (1,-2) {C}

it would lead to an error saying that the macro couldn't function because it couldn't find its argument although it's only one more character away.

However, consider below both valid node specifications:

\node[draw] (n) at (2,1)           {a} ;
\node       at (2,1) [draw] (n)    {a} ;

There is a limit to this flexibility (notice the node content is always given at the end etc.) but as long as we behave, this is much more flexible and without the semicolon would have required a very strict order and syntax as in PGF level or the tkz-euclide examples you have given.

  • So, when I use tkz-euclide, can I also use actual tikz commands, with semicolons at the end, combined with tkz commands? I do not know if I would ever want to. But would that cause a problem if I did it? Aug 23, 2016 at 0:44
  • 4
    @ColinMcLarty Yes, that's correct, you can, without any problems. The tkz-euclide macros are just a higher level wrapper for underlying tikz commands, so you can use both within the same tikzpicture environment.
    – Alan Munn
    Aug 23, 2016 at 0:47
  • I thought a linguist would start from the syntactic part :P I took the liberty to add an example I hope it's not something you wouldn't agree
    – percusse
    Aug 23, 2016 at 8:26
  • @percusse Thanks! I didn't realize that the some of the syntax was relatively order free in TikZ commands.
    – Alan Munn
    Aug 23, 2016 at 14:38
  • This answer is discussed at the linked question tex.stackexchange.com/questions/703266/…, apparently the statement "Every tikz command is delimited by a semicolon" has caused confusion because the OP there thought it also applies to \tikzset. I understand the confusion, maybe you can specify this a bit more @AlanMunn?
    – Marijn
    Dec 6, 2023 at 15:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .