10

Apologies if this is a duplicate. It would seem like it would be a well-known problem, but I was unable to track a solution.

In words: the grid lines do not extend enough to form sharp corners. I would like sharp corners. Thanks.

\documentclass[border=1mm]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[scale=1]
  \draw (0, 0) grid (1, 1);
\end{tikzpicture}
\end{document}

enter image description here

9

I do not know why it is not default for grid, but it helps to set the line cap to rect.

\documentclass[border=1mm]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw[line cap=rect] (0, 0) grid (1, 1);
\end{tikzpicture}
\end{document}
|improve this answer|||||
  • 3
    Great. Indeed, if anyone knows why this isn't the default, please chime in. – PatrickT Jan 21 '19 at 13:18
  • 7
    @PatrickT You can also try round (instead of rect). The initial value is butt for grid and for all other drawing operations as in PDF standard. – Paul Gaborit Jan 21 '19 at 14:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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