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

Am trying to draw a simple rectangle and there seems to be minor issue with two of the endpoints (f and d in the following). I tried line cap=rect as suggested by Bad intersection of lines in TikZ but that did not seem to work. The resulting image:

enter image description here




    \coordinate (A) at ( 0,       0,     \Depth);%
    \coordinate (B) at (\Height,  0,     \Depth);%
    \coordinate (C) at (\Height,  0,      0);%
    \coordinate (D) at (\Height, \Width,  0);%
    \coordinate (E) at ( 0,      \Width,  0);%
    \coordinate (F) at ( 0,      \Width, \Depth);%
    \coordinate (G) at (\Height, \Width, \Depth);%
    \coordinate (H) at ( 0,       0,      0);%
    \draw [blue, ultra thick,line cap=rect]%
        (A) -- (B) -- (C) -- (D) -- (E) -- (F) -- cycle;%
    \draw [blue, ultra thick,line cap=rect]%
        (B) -- (G) -- (F) -- (E) -- (D) -- (G) -- cycle;%

    \path (D)  [right] node {$d$};% Problem Point 1
    \path (F)  [left ] node {$f$};% Problem Point 2

This problem about TikZ: changing colour of a path half way along seems related, but I do not understand how to adapt that to my problem.

share|improve this question
Can you include the picture? – Loop Space Jun 18 '11 at 6:25
Have added a link to the image. – Peter Grill Jun 18 '11 at 6:58
up vote 19 down vote accepted

You should use a different line join type here, either round or bevel, which influences how the corner (not the ends) of lines are drawn:

\begin{tikzpicture}[line join=miter] % Standard option

miter joins

\begin{tikzpicture}[line join=bevel] 

bevel joins

\begin{tikzpicture}[line join=round]

round joins

share|improve this answer
Yep, that fixed it. Thanks. So is there a reason why I would not want to always use line join=round? I have posted a follow-up question: tex.stackexchange.com/questions/21063/… – Peter Grill Jun 18 '11 at 8:30
@PeterGrill: If possible, line join=round is probably best. However, it is not always possible depending on how you construct your diagram, I guess. – Werner Sep 29 '11 at 21:17
@Werner: According to Jake in the question is line join miter the preferable over line join round the miter option should be used unless otherwise needed as is the case here. – Peter Grill Sep 29 '11 at 21:25

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.