2

I am trying to convert a diagram from a PNG to TikZ in LaTeX. I want to have two arrows that are pointing to a circle to point horizontally and to point to the edge of the circle. I almost get that by using a .west coordinate, but it doesn't quite align:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows}

\begin{document}

\begin{tikzpicture}
 [engine/.style={circle,minimum size=6cm,draw=black,font=\large
  }, block/.style={
   rectangle,minimum size=10cm,draw=black,dashed,font=\large
  }, point/.style={
   circle,inner sep=0pt,minimum size=0pt,fill=none
  }
 ]

 % Draw the rectangle containing the block diagram
 \node (block) [block] at (0,0) {};
 % Put a label at the top of the box
 \node (blockname) [point] at (0, 4.5) {\large Module};

 % A circle representing the engine
 \node (engine) [engine] at (1,-1) {Engine};

 % Inputs representing the network ports
 \node (input1) [point] at (-6,-3) {};
 \path (input1) edge [->] node [below] {Network A} (input1-|engine.west);

 \node (input2) [point] at (-6,-0.5) {};
 \path (input2) edge [->] node [above] {Network B} (input2-|engine.west);

 % Output
 \node (output) [point] at (-6,3) {};
 \node (outputup) [point] at (1,3) {};
 \path (outputup) edge [->,dashed]
                  node [above] {Management}
                  node [below] {Output}
                  (output);
 \path (outputup) edge [->,dashed] (engine);

\end{tikzpicture}

\end{document}

This is what I have:

My attempt

3

I think you may use "intersecting paths", which are discribed in the TikZ manual p34 and 35 (http://www.texample.net/media/pgf/builds/pgfmanualCVS2012-11-04.pdf).

EDIT

Sorry for my first comment, due to a lack of time... This is a complete example with your code showing how to achieve that :

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows, intersections}

\begin{document}

\begin{tikzpicture}
 [engine/.style={circle,minimum size=6cm,draw=black,font=\large
  }, block/.style={
   rectangle,minimum size=10cm,draw=black,dashed,font=\large
  }, point/.style={
   circle,inner sep=0pt,minimum size=0pt,fill=none
  }
 ]

 % Draw the rectangle containing the block diagram
 \node (block) [block] at (0,0) {};
 % Put a label at the top of the box
 \node (blockname) [point] at (0, 4.5) {\large Module};

 % A circle representing the engine
 \node (engine) [name path=engine, engine] at (1,-1) {Engine};

 % Inputs representing the network ports

 \node (input1) [point] at (-6,-3) {};
 \path [name path=refline] (-6,-3) -- (6,-3);
 \node (intersect) [name intersections={of=engine and refline, by=x}] at  (intersection-1) {};
 \path (input1) edge [->] node [below] {Network A} (input1-|intersect);


 \node (input2) [point] at (-6,-0.5) {};
 \path (input2) edge [->] node [above] {Network B} (input2-|engine.west);

 % Output
 \node (output) [point] at (-6,3) {};
 \node (outputup) [point] at (1,3) {};
 \path (outputup) edge [->,dashed]
                  node [above] {Management}
                  node [below] {Output}
                  (output);
 \path (outputup) edge [->,dashed] (engine);

To achieve it, I created a node representing the line you want to create, then another node representing the first intersection between the circle and the line and I ended by linking the line with this last node. In order to do that, you also need to use the intersections library, loaded by : \usetikzlibrary{intersections}.

Result :

enter image description here

I hope it may help.

  • Please elaborate, as link-only answers are discouraged, since links may rot over time. – sodd Feb 19 '16 at 10:27
  • Sorry for first comment, I edited it with a complete example. – Damien Dtx Feb 19 '16 at 10:56

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.