您好,我想从“Bit”到“12”画一条曲线,但箭头指向框的中间。我怎样才能让它到达这个框的前端?或者稍微高一点。
\documentclass[12pt]{scrartcl}
\usepackage[a4paper]{geometry}
\geometry{left=3.5cm,right=3.5cm,top=3cm,bottom=3cm}
\usepackage[T1]{fontenc} % Aktiviert EC-Schriftarten
\usepackage[utf8]{inputenc} % Dateikodierung
\usepackage[ngerman]{babel} % Deutsche Einstellung
\usepackage{lmodern} % Latin Modern
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
\node (15) [draw, minimum height=7mm, minimum width=8mm] {$15$};
\node (14) [draw, minimum height=7mm, minimum width=8mm, right=0cm of 15] {$14$};
\node (13) [draw, minimum height=7mm, minimum width=8mm, right=0cm of 14] {$13$};
\node (12) [draw, minimum height=7mm, minimum width=8mm, right=0cm of 13] {$12$};
\node (11) [draw, minimum height=7mm, minimum width=8mm, right=0cm of 12] {$11$};
\node (10) [draw, minimum height=7mm, minimum width=8mm, right=0cm of 11] {$10$};
\node (9) [draw, minimum height=7mm, minimum width=8mm, right=0cm of 10] {$9$};
\node (8) [draw, minimum height=7mm, minimum width=8mm, right=0cm of 9] {$8$};
\node (7) [draw, minimum height=7mm, minimum width=8mm, right=0cm of 8] {$7$};
\node (6) [draw, minimum height=7mm, minimum width=8mm, right=0cm of 7] {$6$};
\node (5) [draw, minimum height=7mm, minimum width=8mm, right=0cm of 6] {$5$};
\node (4) [draw, minimum height=7mm, minimum width=8mm, right=0cm of 5] {$4$};
\node (3) [draw, minimum height=7mm, minimum width=8mm, right=0cm of 4] {$3$};
\node (2) [draw, minimum height=7mm, minimum width=8mm, right=0cm of 3] {$2$};
\node (1) [draw, minimum height=7mm, minimum width=8mm, right=0cm of 2] {$1$};
\node (0) [draw, minimum height=7mm, minimum width=8mm, right=0cm of 1] {$0$};
\coordinate[below left=0mm of 15] (RWLeft);
\coordinate[below right=0mm of 0] (RWRight);
\draw[decorate,decoration={brace,amplitude=15pt}, minimum height=6mm]
(RWRight) -- (RWLeft)
node[anchor=north,midway,below=15pt] {Word};
\coordinate[above left=0mm of 7] (AddrLeftRes);
\coordinate[above right=0mm of 0] (AddrRightRes);
\draw[decorate,decoration={brace,amplitude=15pt}, minimum height=6mm]
(AddrLeftRes) -- (AddrRightRes)
node[anchor=south,midway,above=15pt] {Byte};
\node [inner sep=2pt,outer sep=0pt] (O) at (12) {};
\node [align=center] (origin) at ([xshift=-1.8cm,yshift=1.3cm]O) {Bit};
\draw [shorten <=.1cm,stealth-] (O) to [out=0,in=-90] (origin.west);
\end{tikzpicture}
\end{document}
答案1
\documentclass[12pt]{scrartcl}
\usepackage[a4paper]{geometry}
\geometry{left=3.5cm,right=3.5cm,top=3cm,bottom=3cm}
\usepackage[T1]{fontenc} % Aktiviert EC-Schriftarten
\usepackage[utf8]{inputenc} % Dateikodierung
\usepackage[ngerman]{babel} % Deutsche Einstellung
\usepackage{lmodern} % Latin Modern
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
\node (15) [draw, minimum height=7mm, minimum width=8mm] {$15$};
\node (14) [draw, minimum height=7mm, minimum width=8mm, right=0cm of 15] {$14$};
\node (13) [draw, minimum height=7mm, minimum width=8mm, right=0cm of 14] {$13$};
\node (12) [draw, minimum height=7mm, minimum width=8mm, right=0cm of 13] {$12$};
\node (11) [draw, minimum height=7mm, minimum width=8mm, right=0cm of 12] {$11$};
\node (10) [draw, minimum height=7mm, minimum width=8mm, right=0cm of 11] {$10$};
\node (9) [draw, minimum height=7mm, minimum width=8mm, right=0cm of 10] {$9$};
\node (8) [draw, minimum height=7mm, minimum width=8mm, right=0cm of 9] {$8$};
\node (7) [draw, minimum height=7mm, minimum width=8mm, right=0cm of 8] {$7$};
\node (6) [draw, minimum height=7mm, minimum width=8mm, right=0cm of 7] {$6$};
\node (5) [draw, minimum height=7mm, minimum width=8mm, right=0cm of 6] {$5$};
\node (4) [draw, minimum height=7mm, minimum width=8mm, right=0cm of 5] {$4$};
\node (3) [draw, minimum height=7mm, minimum width=8mm, right=0cm of 4] {$3$};
\node (2) [draw, minimum height=7mm, minimum width=8mm, right=0cm of 3] {$2$};
\node (1) [draw, minimum height=7mm, minimum width=8mm, right=0cm of 2] {$1$};
\node (0) [draw, minimum height=7mm, minimum width=8mm, right=0cm of 1] {$0$};
\coordinate[below left=0mm of 15] (RWLeft);
\coordinate[below right=0mm of 0] (RWRight);
\draw[decorate,decoration={brace,amplitude=15pt}, minimum height=6mm]
(RWRight) -- (RWLeft)
node[anchor=north,midway,below=15pt] {Word};
\coordinate[above left=0mm of 7] (AddrLeftRes);
\coordinate[above right=0mm of 0] (AddrRightRes);
\draw[decorate,decoration={brace,amplitude=15pt}, minimum height=6mm]
(AddrLeftRes) -- (AddrRightRes)
node[anchor=south,midway,above=15pt] {Byte};
% \node [inner sep=2pt,outer sep=0pt] (O) at (12) {};
\node [align=center] (Bit) at ([xshift=-1.8cm,yshift=1.3cm]12) {Bit};
\draw [stealth-] (12) to [out=90,in=0] (Bit);
\end{tikzpicture}
\end{document}
答案2
您可能喜欢(至少代码明显短得多):
\documentclass[12pt]{scrartcl}
\usepackage[a4paper,
hmargin=3.5cm,vmargin=3cm]{geometry}
\usepackage[T1]{fontenc} % Aktiviert EC-Schriftarten
\usepackage[ngerman]{babel} % Deutsche Einstellung
\usepackage{lmodern} % Latin Modern
\usepackage{pgfplots}
\usetikzlibrary{chains,
decorations.pathreplacing,
calligraphy,
positioning,
babel% added for compatibility with babel ...
}
\begin{document}
\begin{tikzpicture}[
node distance = 4mm and 0mm,
start chain = A going right,
B/.style = {decorate,
decoration={calligraphic brace, amplitude=4mm,
raise=1mm},
very thick, pen colour=black},
N/.style = {draw, minimum height=7mm, minimum width=8mm, outer sep=0pt,
on chain}
]
\foreach \i in {15,14,...,0}
\node[N] {$\i$}; % node names names are from A-1 to A-16
%
\node (aux) [above=5mm of A-2] {Bit};
\draw [-stealth] (aux) to [bend left] (A-4.north);
% braces
\draw[B] (A-7.north west) -- node[above=5mm] {Byte} (A-16.north east);
\draw[B] (A-16.south east) -- node[below=5mm] {Word} (A-1.south west);
\end{tikzpicture}
\end{document}