3

I'd like a line starting from the red point. Why is there a gap between them? I use the following code.

\begin{tikzpicture}
\draw[help lines] (0,0) grid (10,10);
\draw[very thick,rotate around={45:(2.3,5)}] (2.3,5) rectangle ++(4,0.3) ++(0,-0.15) node (p) {};
\fill[red] (p) circle (2pt);
\draw (p)--++(225:6);
\end{tikzpicture}

Thank you!

  • 2
    Either replace node (p) {} by coordinate (p) or by node[inner sep=0pt,outer sep=0pt] (p) {}, or replace (p) by (p.center) in the \draw command. – gernot says Reinstate Monica Apr 10 '17 at 11:54
3

The gap is due to the default value inner sep of the \node command for node (p) which is .3333em. Setting inner sep=0pt will remove the gap and reduce the node to a minimal size.

\documentclass[10pt]{article}

\usepackage{tikz}


\begin{document}
\begin{tikzpicture}
\draw[help lines] (0,0) grid (10,10);
\draw[very thick,rotate around={45:(2.3,5)}] (2.3,5) rectangle ++(4,0.3) ++(0,-0.15) node[inner sep=0pt,outer sep=0pt] (p) {};
\fill[red] (p) circle (2pt);
\draw (p)--++(225:6);
\end{tikzpicture}
\end{document}

enter image description here

3

or

\documentclass[tikz]{standalone}

\begin{document}
\begin{tikzpicture}
\draw[help lines] (0,0) grid (10,10);
\draw[very thick,rotate around={45:(2.3,5)}] (2.3,5) rectangle ++(4,0.3) ++(0,-0.15) coordinate (p);
\draw (p)--++(225:6);
\fill[red] (p) circle (2pt);
\end{tikzpicture}
\end{document}

gab is caused with ˙inner sep of node (default value is 3pt). You actualy have two possibilities:

  • reduce inner sep of node, or
  • instead node use coordinate as I suggested above

enter image description here

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.