在两张 tikzpictures 中间插入文字

在两张 tikzpictures 中间插入文字

我有以下代码:

\documentclass[tikz, border=10pt]{standalone}
\usetikzlibrary{calc, intersections}
\begin{document}

\begin{center}
    \begin{tikzpicture}[
        coordinate/.style={
            circle, fill, inner sep=2pt
        },
        black
    ]
    
    \coordinate[coordinate, label={60:$p_1$}] (P1) at (-2,0.75);
    \coordinate[coordinate, label={60:$p_2$}] (P2) at (-1,-0.75);
    \coordinate[coordinate, label={120:$q_1$}] (Q1) at (2,0.75);
    \coordinate[coordinate, label={120:$q_2$}] (Q2) at (1,-0.75);
    
    \draw[name path=L1] ($(P1)!-0.5!(P2)$) node[above] {$\ell$} -- ($(P1)!3!(P2)$); 
    \draw[name path=L2] ($(Q1)!-0.5!(Q2)$) node[above] {$\ell'$} -- ($(Q1)!3!(Q2)$); 
    
    \coordinate[coordinate, gray, label={[gray]0:$z$}] (Z1) at ($(P1)!0.5!(P2)$);
    
    \node[name intersections={of=L1 and L2, by=Y}, coordinate, label={270:$y$}] at (Y) {};
    
    \draw ($(P1)!-0.25!(Q1)$) -- ($(P1)!1.25!(Q1)$) node[above] {$\overline{p_{1}q_{1}}$}
      ($(P2)!-0.5!(Q2)$) -- ($(P2)!1.5!(Q2)$) node[below] {$\overline{p_{2}q_{2}}$};
    \draw[gray] ($(P2)!-0.5!(Q2)$) to[out=180, in=180] (Z1) to[out=180, in=180] ($(P1)!-0.25!(Q1)$);
    \end{tikzpicture}
        \begin{tikzpicture}[
            coordinate/.style={
                circle, fill, inner sep=2pt
            },
            black
        ]
        
        \coordinate[coordinate, label={60:$p_1$}] (P1) at (-2,0.75);
        \coordinate[coordinate, label={60:$p_2$}] (P2) at (-1,-0.75);
        \coordinate[coordinate, label={120:$q_1$}] (Q1) at (2,0.75);
        \coordinate[coordinate, label={120:$q_2$}] (Q2) at (1,-0.75);
        
        \draw[name path=L1] ($(P1)!-0.5!(P2)$) node[above] {$\ell$} -- ($(P1)!3!(P2)$); 
        \draw[name path=L2] ($(Q1)!-0.5!(Q2)$) node[above] {$\ell'$} -- ($(Q1)!3!(Q2)$); 
        
        \coordinate[coordinate, gray, label={[gray]180:$z$}] (Z2) at ($(Q1)!0.5!(Q2)$);
        
        \node[name intersections={of=L1 and L2, by=Y}, coordinate, label={270:$y$}] at (Y) {};

        \draw ($(P1)!-0.25!(Q1)$) -- ($(P1)!1.25!(Q1)$) node[above] {$\overline{p_{1}q_{1}}$}
          ($(P2)!-0.5!(Q2)$) -- ($(P2)!1.5!(Q2)$) node[below] {$\overline{p_{2}q_{2}}$};
        \draw[gray] ($(P1)!1.25!(Q1)$) to[out=0, in=0] (Z2) to[out=0, in=0] ($(P2)!1.5!(Q2)$);
        
        \end{tikzpicture}
    \end{center}
\end{document}

结果如下:

在此处输入图片描述

我想在两个图之间添加一些空间,并在它们之间写上“OR”,表示两种不同的情况。有人能帮我吗?

答案1

给你:

\documentclass[12pt]{article}
\usepackage[a4paper, total={180mm,257mm},left=15mm,top=20mm]{geometry}
\usepackage{tikz}
\usetikzlibrary{calc, intersections}
\begin{document}
    
    \begin{center}
        \begin{tikzpicture}[
            coordinate/.style={
                circle, fill, inner sep=2pt
            },
            black
            ]
            
            \coordinate[coordinate, label={60:$p_1$}] (P1) at (-2,0.75);
            \coordinate[coordinate, label={60:$p_2$}] (P2) at (-1,-0.75);
            \coordinate[coordinate, label={120:$q_1$}] (Q1) at (2,0.75);
            \coordinate[coordinate, label={120:$q_2$}] (Q2) at (1,-0.75);
            
            \draw[name path=L1] ($(P1)!-0.5!(P2)$) node[above] {$\ell$} -- ($(P1)!3!(P2)$); 
            \draw[name path=L2] ($(Q1)!-0.5!(Q2)$) node[above] {$\ell'$} -- ($(Q1)!3!(Q2)$); 
            
            \coordinate[coordinate, gray, label={[gray]0:$z$}] (Z1) at ($(P1)!0.5!(P2)$);
            
            \node[name intersections={of=L1 and L2, by=Y}, coordinate, label={270:$y$}] at (Y) {};
            
            \draw ($(P1)!-0.25!(Q1)$) -- ($(P1)!1.25!(Q1)$) node[above] {$\overline{p_{1}q_{1}}$}
            ($(P2)!-0.5!(Q2)$) -- ($(P2)!1.5!(Q2)$) node[below] {$\overline{p_{2}q_{2}}$};
            \draw[gray] ($(P2)!-0.5!(Q2)$) to[out=180, in=180] (Z1) to[out=180, in=180] ($(P1)!-0.25!(Q1)$);
        \end{tikzpicture}\hspace{0.5cm} \raisebox{2.9cm}{\textbf{OR}}\hspace{0.5cm}%<--insert space and text between the tizpictures
        \begin{tikzpicture}[
            coordinate/.style={
                circle, fill, inner sep=2pt
            },
            black
            ]
            
            \coordinate[coordinate, label={60:$p_1$}] (P1) at (-2,0.75);
            \coordinate[coordinate, label={60:$p_2$}] (P2) at (-1,-0.75);
            \coordinate[coordinate, label={120:$q_1$}] (Q1) at (2,0.75);
            \coordinate[coordinate, label={120:$q_2$}] (Q2) at (1,-0.75);
            
            \draw[name path=L1] ($(P1)!-0.5!(P2)$) node[above] {$\ell$} -- ($(P1)!3!(P2)$); 
            \draw[name path=L2] ($(Q1)!-0.5!(Q2)$) node[above] {$\ell'$} -- ($(Q1)!3!(Q2)$); 
            
            \coordinate[coordinate, gray, label={[gray]180:$z$}] (Z2) at ($(Q1)!0.5!(Q2)$);
            
            \node[name intersections={of=L1 and L2, by=Y}, coordinate, label={270:$y$}] at (Y) {};
            
            \draw ($(P1)!-0.25!(Q1)$) -- ($(P1)!1.25!(Q1)$) node[above] {$\overline{p_{1}q_{1}}$}
            ($(P2)!-0.5!(Q2)$) -- ($(P2)!1.5!(Q2)$) node[below] {$\overline{p_{2}q_{2}}$};
            \draw[gray] ($(P1)!1.25!(Q1)$) to[out=0, in=0] (Z2) to[out=0, in=0] ($(P2)!1.5!(Q2)$);
            
        \end{tikzpicture}
    \end{center}
\end{document}
```````````````````````````````````````````````````

相关内容