我正在尝试重现以下图像TikZ
,
除了我想让\overbrace
s 位于黑点之间的线段上方V2
(如左侧中间情况所示)。
我目前想到的是
使用此代码。
\documentclass{standalone}
\usepackage{tikz,amssymb}
\tikzset{
realline/.pic={
\draw [thick,<->] (0,0) -- (6,0) node [right] {$\mathbb{R}$};
}}
\begin{document}
\begin{tikzpicture}
\matrix (A) [column sep=20, row sep=20] {
\pic{realline}; & \pic{realline}; \\
\pic{realline}; & \pic{realline}; \\
\pic{realline}; & \pic{realline}; \\
};
\end{tikzpicture}
\end{document}
但现在我不知道如何添加点和括号。如果能得到一些帮助就太好了。
答案1
对于起点:
\documentclass[border=3mm,tikz]{standalone}
\usetikzlibrary{decorations.pathreplacing}
\usepackage{amssymb}
\tikzset{
pics/realline/.style 2 args = {
code = {\draw [thick] (0,0) -- (6,0) node [right=2mm] {$\mathbb{R}$};
\fill[black] (1,0) circle (1mm) node[above=2mm] {$#1$}
(3,0) circle (1mm) node[above=2mm] {$#2$}
(6,0) circle (1mm) node[above=2mm] {$V_4$};
\foreach \i [count=\j] in {0,0.5,1,1.5,3,4.5,6}
\coordinate (-\j) at (\i,0);
}}}
\begin{document}
\begin{tikzpicture}[
point/.style={circle, draw, fill=white,
inner sep=0pt, minimum size=2mm,
label=above:#1},
brc/.style args = {#1/#2}{decorate,
decoration={brace, amplitude=5pt,
raise=#1,#2},% for mirroring of brace
thick},
]
\matrix (A) [column sep=20, row sep=20] {
\pic (A1) {realline={V_1}{V_3}};
\node[point=$V_0$] at (A1-2) {}; & \pic{realline={V_3}{V_1}}; \\
\pic (A2) {realline={V_1}{V_3}};
\draw[brc=1.5mm/] (A2-3) -- node[above=3mm] {$V_2$} (A2-5);
& \pic{realline={V_3}{V_1}}; \\
\pic (A3) {realline={V_1}{V_3}};
\node[point=$V_2$] at (A1-6) {}; & \pic{realline={V_3}{V_1}}; \\
};% end of matrix
\end{tikzpicture}
\end{document}
编辑:
关于您的评论,我重新定义了realline
。现在它有两个选项用于前两个黑点。如果您希望有更多自由选项,那么您需要将realline
定义更改为:
pics/realline/.style n args = {<number for n>}{ ...
线条上的其他点或基本图片的不同布局留给您决定。上面的代码应该会引导您进行这些更改/采用。