Graphics, Figures & Tablesproblem with tikz intersections

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Bahurin
Posts: 5
Joined: Mon Dec 30, 2013 2:33 pm

problem with tikz intersections

Post by Bahurin »

I have some problem with tikz. I want to get a curve and a several parallel arrows. But ends of arrows are unpredictable.

This is my code:

Code: Select all

Code, edit and compile here:
\begin{figure}[h!]
\begin{center}
\begin{tikzpicture} [>=latex]
%\draw[->] (-4.0 cm, 0.0 cm) -- (10.0 cm, 0.0 cm) node[below]{$\omega$} ;
%\draw[->] (0.0 cm, 0.0 cm) -- (0.0 cm, 3.5 cm) node[right]{$S(\omega)$};
\draw[-, thin, dashed,rounded corners=0.14cm, name path=S]
(0.00cm, 3.0cm) --
(0.25cm, 3.0cm) --
(0.50cm, 2.0cm) --
(1.00cm, 1.0cm) --
(1.25cm, 0.8cm) --
(1.50cm, 0.5cm) --
(1.75cm, 0.4cm) --
(2.00cm, 0.4cm) --
(2.25cm, 0.3cm) --
(2.50cm, 0.3cm);
\path [name path=v] ( 0, 0) -- ( 0, 5);
\draw [->, name intersections={of=v and S, by=y}, thick] (0, 0cm) -- (y);
\path [name path=v1] ( 0.25, 0) -- ( 0.25, 5);
\draw [->, name intersections={of=v1 and S, by=X}, thick] (0.25, 0cm) -- (X);
\path [name path=v2] ( 0.5, 0) -- ( 0.5, 5);
\draw [->, name intersections={of=v2 and S, by=X}, thick] (0.5, 0cm) -- (X);
\end{tikzpicture}
\end{center}
\end{figure}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
result is very strange
lines.png
lines.png (2.01 KiB) Viewed 3669 times
What is my problem? How can I get a parallel lines?

Recommended reading 2024:

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

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

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

problem with tikz intersections

Post by Johannes_B »

I cannot reproduce the problem.

Code: Select all

Code, edit and compile here:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{intersections}
\begin{document}
\begin{tikzpicture} [>=latex]
%\draw[->] (-4.0 cm, 0.0 cm) -- (10.0 cm, 0.0 cm) node[below]{$\omega$} ;
%\draw[->] (0.0 cm, 0.0 cm) -- (0.0 cm, 3.5 cm) node[right]{$S(\omega)$};
\draw[-, thin, dashed,rounded corners=0.14cm, name path=S]
(0.00cm, 3.0cm) --
(0.25cm, 3.0cm) --
(0.50cm, 2.0cm) --
(1.00cm, 1.0cm) --
(1.25cm, 0.8cm) --
(1.50cm, 0.5cm) --
(1.75cm, 0.4cm) --
(2.00cm, 0.4cm) --
(2.25cm, 0.3cm) --
(2.50cm, 0.3cm);
\path [name path=v] ( 0, 0) -- ( 0, 5);
\draw [->, name intersections={of=v and S, by=y}, thick] (0, 0cm) -- (y);
\path [name path=v1] ( 0.25, 0) -- ( 0.25, 5);
\draw [->, name intersections={of=v1 and S, by=X}, thick] (0.25, 0cm) -- (X);
\path [name path=v2] ( 0.5, 0) -- ( 0.5, 5);
\draw [->, name intersections={of=v2 and S, by=X}, thick] (0.5, 0cm) -- (X);
\end{tikzpicture}
\end{document}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

problem with tikz intersections

Post by Stefan Kottwitz »

Hi Bahurin,

Johannes' Code seems to work fine. You can click on "Open in WriteLaTeX" to have it compiled independently of your TeX version. Do you see any difference to your code?

I cannot test your code, since it's not compilable. It would be better if you would post complete codes in case of a problem, in the meaning of a Infominimal working example. In such a case, all would be clear, and a solution is nearly guaranteed.

Stefan
LaTeX.org admin
Post Reply