
Я пытаюсь преобразовать диаграмму из PNG в TikZ в LaTeX. Я хочу, чтобы две стрелки, указывающие на окружность, указывали горизонтально и указывали на край окружности. Я почти получаю это с помощью координат .west
, но это не совсем выравнивает:
\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}
Вот что у меня есть:
решение1
Я думаю, вы можете использовать «пересекающиеся пути», которые описаны в руководстве TikZ на стр. 34 и 35 (http://www.texample.net/media/pgf/builds/pgfmanualCVS2012-11-04.pdf).
РЕДАКТИРОВАТЬ
Извините за мой первый комментарий из-за нехватки времени... Вот полный пример с вашим кодом, показывающий, как этого добиться:
\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);
Чтобы добиться этого, я создал узел, представляющий линию, которую вы хотите создать, затем еще один узел, представляющий первое пересечение между окружностью и линией, и я закончил, связав линию с этим последним узлом. Для этого вам также нужно использовать библиотеку пересечений, загруженную: \usetikzlibrary{intersections}
.
Результат :
Надеюсь, это поможет.