我正在使用出色的 TikZ 软件为书中的一章绘制图形。我对我所创建的图形的质量非常满意。不幸的是,有一件事让我有点困惑。下面的代码说明了我所遇到的图形部分。
绘图基本上是正确的。问题是双头箭头看起来很糟糕。箭头的末端没有以应有的方式指向 r1j 和 r3j,顶部和底部的箭头相互叠加,而它们之间实际上应该有一些间隔。希望有人能告诉我如何改变它以使其看起来更好。我突然想到可能需要增加 r1j、r2j、r3j 之间的垂直空间,以使箭头看起来正确。如果是这样,那么我认为这样做可能是有意义的。
\documentclass[10pt]{article}
%%%% Packages %%%%
\usepackage{here}
\usepackage{tikz}
\usetikzlibrary{calc,shapes,shapes.geometric}
\usepackage{hyperref}
%%%% Set pdf zoom to 100% %%%%
\hypersetup{pdfstartview={XYZ null null 1.00}, pdfview={XYZ null null 1.00}}
%%%% TikZ graphics styles/commands %%%%
\tikzstyle{arr}=[-latex, black, line width=0.5pt]
\tikzstyle{doublearr}=[latex-latex, black, line width=0.5pt]
\tikzstyle{input}=[font=\small\sffamily\bfseries]
\tikzstyle{rect}=[rectangle, draw=black, font=\small\sffamily\bfseries, inner sep=9pt]
\begin{document}
\newcommand{\rlist}{
\left\{
\begin{array}{cl}
r_{1j} \\
r_{2j} \\
r_{3j}
\end{array}
\right.
}
\begin{figure}[H]
\begin{center}
\begin{tikzpicture}[auto]
\node[rect] (Yij) at (26, 0) {$LifeSat_{ij}$};
\node[input] (rij) at (28.5, 0) {$r_{ij} \rlist$};
\draw [arr] (rij) to (Yij);
\draw [doublearr, bend left] (rij.north east) to (rij.south east);
\draw [doublearr, bend left] (rij.north east) to (rij.east);
\draw [doublearr, bend left] (rij.east) to (rij.south east);
\end{tikzpicture}
\end{center}
\end{figure}
\end{document}
答案1
使用[xshift=...mm]
或[yshift=...mm]
作为节点。
\documentclass[10pt]{article}
%%%% Packages %%%%
\usepackage{here}
\usepackage{tikz}
\usetikzlibrary{calc,shapes,shapes.geometric}
\usepackage{hyperref}
%%%% Set pdf zoom to 100% %%%%
\hypersetup{pdfstartview={XYZ null null 1.00}, pdfview={XYZ null null 1.00}}
%%%% TikZ graphics styles/commands %%%%
\tikzstyle{arr}=[-latex, black, line width=0.5pt]
\tikzstyle{doublearr}=[latex-latex, black, line width=0.5pt]
\tikzstyle{input}=[font=\small\sffamily\bfseries]
\tikzstyle{rect}=[rectangle, draw=black, font=\small\sffamily\bfseries, inner sep=9pt]
\begin{document}
\newcommand{\rlist}{
\left\{
\begin{array}{cl}
r_{1j} \\
r_{2j} \\
r_{3j}
\end{array}
\right.
}
\begin{figure}[H]
\begin{center}
\begin{tikzpicture}[auto]
\node[rect] (Yij) at (26, 0) {$LifeSat_{ij}$};
\node[input] (rij) at (28.5, 0) {$r_{ij} \rlist$};
\draw [arr] (rij) to (Yij);
\draw [doublearr, bend left] ([xshift=2mm]rij.north east) to ([xshift=2mm]rij.south east);
\draw [doublearr, bend left] (rij.north east) to (rij.east);
\draw [doublearr, bend left] (rij.east) to (rij.south east);
\end{tikzpicture}
\end{center}
\end{figure}
\end{document}