我不知道该如何制作节点来制作基本的框图。以及如何合并箭头。我对颜色不感兴趣,我想要的只是一个像我用过的普通矩形框。谢谢
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usepackage{verbatim}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{positioning,arrows,calc}
\begin{document}
\pagestyle{empty}
\tikzstyle{int}=[rectangle, rounded corners, draw, fill=white!20, minimum size=6em]
\tikzstyle{init} = [pin edge={to-,thin,black}]
\begin{tikzpicture}[node distance=2.5cm,auto,>=latex']
\node [int] (a) {};
\node (b) [below=1em of a,left of=a,node distance=2cm, coordinate] {a};
\node [coordinate] (end) [right of=b, node distance=4cm]{};
\path[o-] (b) edge node {$I$} (a);
\path[-o] (a) edge node {$v$} (end);
\end{tikzpicture}
\end{document}
答案1
干得好。
\documentclass[border=2]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows,positioning,arrows,calc}
\begin{document}
\pagestyle{empty}
\tikzset{int/.style = {rectangle, rounded corners, draw, fill=gray!20, minimum size=6em},
init/.style = {pin edge={to-,thin,black}}
}
\begin{tikzpicture}[node distance=2.5cm,auto,>=latex']
\node [int] (a) {};
%left side
\draw[line width=2pt] ($(a.south west)!0.25!(a.north west)$) -- +(-2cm,0) node[pos=1.05,left] (minusl) {$-$};
\draw[line width=2pt] ($(a.south west)!0.75!(a.north west)$) -- +(-2cm,0) node[pos=1.05,left] (plusl) {$+$};
\node[above left = 1mm and 1mm of plusl,inner sep=2pt] (i1l) {$I_1$};
\draw[->] (i1l.south east) -- +(1cm,0);
\node[below left = 1mm and 1mm of minusl,inner sep=2pt] (i2l) {$I_1$};
\draw[<-] (i2l.north east) -- +(1cm,0);
\node[left] at ($(plusl)!0.5!(minusl)$) {$V_1$};
%right side
\draw[line width=2pt] ($(a.south east)!0.25!(a.north east)$) -- +(2cm,0) node[pos=1.05,right] (minusr) {$-$};
\draw[line width=2pt] ($(a.south east)!0.75!(a.north east)$) -- +(2cm,0) node[pos=1.05,right] (plusr) {$+$};
\node[above right = 1mm and 1mm of plusr,inner sep=2pt] (i1r) {$I_2$};
\draw[->] (i1r.south west) -- +(-1cm,0);
\node[below right = 1mm and 1mm of minusr,inner sep=2pt] (i2r) {$I_2$};
\draw[<-] (i2r.north west) -- +(-1cm,0);
\node[right] at ($(plusr)!0.5!(minusr)$) {$V_2$};
\end{tikzpicture}
\end{document}