Graphics, Figures & TablesEdges does not meet

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
random3f
Posts: 3
Joined: Wed May 08, 2013 3:44 pm

Edges does not meet

Post by random3f »

Hi Everyone!
I have a problem with this piece of latex code. I want to draw a not regular exagonal figure:

Code: Select all

\begin{tikzpicture} 
	\def\r{1.5}
	\coordinate (1) at (0:\r); 
	\coordinate (2) at	(60:\r); 
	\coordinate (3) at	(120:\r); 
	\coordinate (4) at	(180:\r); 
	\coordinate (5) at (240:\r); 
	\coordinate (6) at (300:\r); 
	

	\node (Origin1) at (3,0)[ ]  {}; 

	\draw (Origin1) +(1) to node [above right] {$j_1$} +(2)
						 to node [above] {$j_2$} +(3)
						 to node [left] {$j_3$} +(4)
						 to node [below left] {$j_4$} +(5);
	\draw (Origin1) to node[above] {$j_6$} +(1);
	\draw (Origin1) +(3) [dashed] to node[right] {$c$} (Origin1) ;
	\draw (Origin1) +(5) to node[ right] {$j_5$} (Origin1)  ; 

	\node (k1) at ($(Origin1) + (1)!.5!(3) $) [blue] {$k$};
	\node (k2) at ($(Origin1) + (3)!.5!(5) $) [blue] {$k'$};
\end{tikzpicture}
I cannot understand why lines $j_1,\, j_2, \, c$ does not meet at the vertex. I was writing the code using only the pgf manual, but I don't understand why it is not working.

Thanks!!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Edges does not meet

Post by localghost »

Seems as if Origin1 should better be a \coordinate than a \node.

Code: Select all

\documentclass[11pt]{standalone}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usetikzlibrary{calc}

\begin{document}
  \begin{tikzpicture}
    \def\r{1.5}
    \coordinate (1) at (0:\r);
    \coordinate (2) at (60:\r);
    \coordinate (3) at (120:\r);
    \coordinate (4) at (180:\r);
    \coordinate (5) at (240:\r);
    \coordinate (6) at (300:\r);
    \coordinate (Origin1) at (3,0);

    \draw (Origin1) + (1) to node [above right] {$j_1$} + (2)
                          to node [above]       {$j_2$} + (3)
                          to node [left]        {$j_3$} + (4)
                          to node [below left]  {$j_4$} + (5);
    \draw (Origin1) to node[above] {$j_6$} +(1);
    \draw (Origin1) +(3) [dashed] to node[right] {$c$} (Origin1) ;
    \draw (Origin1) +(5) to node[ right] {$j_5$} (Origin1)  ;

    \node (k1) at ($(Origin1) + (1)!.5!(3) $) [blue] {$k$};
    \node (k2) at ($(Origin1) + (3)!.5!(5) $) [blue] {$k'$};
  \end{tikzpicture}
\end{document}
Next time please prepare a self-contained and minimal example in order to make a problem comprehensible instantly for others.


Best regards and welcome to the board
Thorsten
Attachments
ttmp.png
ttmp.png (2.41 KiB) Viewed 2678 times
random3f
Posts: 3
Joined: Wed May 08, 2013 3:44 pm

Re: Edges does not meet

Post by random3f »

I'm sorry for the inadequately posed question :oops: ,
But thank you very much!
Post Reply