TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to produce rounded closed polygon like in the following uggly draw. This shape will be defined by giving positions of the vertex. This will be used on sudoku grids.

enter image description here

share|improve this question
In its current form, your question might not receive many answers. Please take a look at the How to Ask-page and try to improve your question according to the guidance found there. This may require you to show some effort on your part in terms of attempting a solution. If you have questions about what to do or if you don't quite understand what this means, please ask for clarification using the add comment function. – Brent.Longborough Feb 11 '13 at 10:51
I've changed my question to be more precise. – projetmbc Feb 11 '13 at 11:02
up vote 6 down vote accepted

Assuming you are using the Sudoku code of question TikZ - "Zig-Zag" arrows, for example, this code is drawn in such a way that each cell is 1 unit wide, so this makes very easy to draw this kind of shapes, since the vertex will have integer units.

Moreover, if you use relative coordinates (++ syntax) you can specify each point of the polygon as an increment of ++(1,0), ++(0,1), ++(-1,0) or ++(0,-1) with respect of the last drawn point, so you only need to give absolute coordinates for the first point of the path, and this kind of relative coordinates for the remaining ones.

So, for example, your shape would be (assuming that I guessed right the units from your distorted drawing):

\draw[ultra thick, red, rounded corners] (first point) --
  ++(1, 0) -- ++(0,-1) -- ++(1, 0)  -- ++(1,0) -- ++(0,-1) --
  ++(0,-1) -- ++(-1,0) -- ++(0,-1) -- ++(-1,0) -- ++(0, 1) --
  ++(-1,0) -- ++(0, 1) -- ++(0, 1) --  cycle;

Where (first point) can be for example (3,6) to give this:


share|improve this answer
Thanks ! Is there a way to not draw on the line of the grids ? – projetmbc Feb 11 '13 at 17:50
There is a strange behavior. I've tried (4, 2) instead of (3,6) and the output is not the one expected. No ? – projetmbc Feb 11 '13 at 18:13
I’d favour the polar-coordinate syntax, i.e. (3,6) -- ++(right:1) -- ++(down:1) -- ++(right:2) -- ++(down:2) …. That is probably a bit more intuitive than to deal with all the 1s and 0s. – Qrrbrbirlbel Feb 11 '13 at 18:23
@projetmbc Yes, it is possible not to draw on the line of the grid: Don’t do it. Move the \drawing command before the grid or use layers (or maybe opacity?). (4, 2) looks right to me … – Qrrbrbirlbel Feb 11 '13 at 18:25
For the coordinate, it is indeed logical. There is no problem. – projetmbc Feb 11 '13 at 18:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.