有人可以在 LaTeX 中画交叉配列吗?

有人可以在 LaTeX 中画交叉配列吗?

我正在尝试绘制两条形成交叉的曲线。我想象它看起来像一个由两条曲线组成的“X”,其宽度大于高度。

我还想放置四个单词,每行末尾一个。我希望它看起来像这样:

在此处输入图片描述

答案1

tikz

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{positioning}

\begin{document}
\begin{tikzpicture}
        \node[align=right,anchor=east] at(0,0) (a) {Tragedy};
        \node[below=1cm of a.east,anchor=east] (b) {Appearence};
        \node[right=2cm of a,anchor=west] (c) {Comedy};
        \node[below=1cm of c.west,anchor=west] (d) {Reality};
        \draw (a) edge[out=0, in=180] (d);
        \draw (b) edge[out=0, in=180] (c);
\end{tikzpicture}

\end{document}

在此处输入图片描述

bazier curves

\documentclass[tikz,border=10pt]{standalone}

\usepackage{tikz}
\usetikzlibrary{positioning}

\begin{document}
\begin{tikzpicture}[font=\sffamily]
        \node[align=right,anchor=east] at(0,0) (a) {Tragedy};
        \node[below=1cm of a.east,anchor=east] (b) {Appearence};
        \node[right=2cm of a,anchor=west] (c) {Comedy};
        \node[below=1cm of c.west,anchor=west] (d) {Reality};
        \draw (a.east) .. controls (2,-0.35) and (0,-0.65).. (d.west);
        \draw (b.east) .. controls (2,-0.65) and (0,-0.35).. (c.west);
\end{tikzpicture}

\end{document}

在此处输入图片描述

还有一点作弊 ;)

\documentclass[tikz,border=10pt]{standalone}

\usepackage{tikz}
\usetikzlibrary{positioning}

\begin{document}
\begin{tikzpicture}[font=\sffamily]
        \node[align=right,anchor=east] at(0,0) (a) {Tragedy};
        \node[below=1cm of a.east,anchor=east] (b) {Appearence};
        \node[right=2cm of a,anchor=west] (c) {Comedy};
        \node[below=1cm of c.west,anchor=west] (d) {Reality};
        \draw[olive,thick] (a) edge[out=0,in=0,distance=1.335cm] (b);
        \draw[olive,thick] (c) edge[out=180,in=180,distance=1.335cm] (d);
\end{tikzpicture}

\end{document}

在此处输入图片描述

最后一个变化。如果你发现很难处理 Bazier 曲线控制,这只是另一个捷径:

\documentclass[tikz,border=10pt]{standalone}

\usepackage{tikz}
\usetikzlibrary{positioning}

\begin{document}
\begin{tikzpicture}[font=\sffamily]
        \node[align=right,anchor=east] at(0,0) (a) {Tragedy};
        \node[below=1cm of a.east,anchor=east] (b) {Appearence};
        \node[right=2cm of a,anchor=west] (c) {Comedy};
        \node[below=1cm of c.west,anchor=west] (d) {Reality};
        \path[draw=none] (a) -- (d) coordinate[midway] (m);
        \draw (a) edge[out=0,in=90] (m)
                            (m) edge[out=270,in=180] (d);
        \draw (b) edge[out=0,in=270] (m)
                            (m) edge[out=90,in=180] (c);
\end{tikzpicture}

\end{document}

在此处输入图片描述

答案2

由于该曲线具有 的所有外观kappa curve,我们可以用 绘制 kappa 曲线 pst-plot,并给出其极坐标方程 (ρ = a/ tan θ):

        \documentclass[11pt, a4paper]{article}
        \usepackage[utf8]{inputenc}
        \usepackage[T1]{fontenc}
        \usepackage{lmodern}

        \usepackage[svgnames,pdf]{pstricks}
        \usepackage{pst-plot}

        \begin{document}

        \psset{unit=0.8cm}
        \begin{pspicture}(-4,-4)(4,4)
        \sffamily
        \psset{linewidth = 1pt, linecolor = IndianRed, plotpoints=200, plotstyle=curve, polarplot, algebraic, labelsep = 0.5em}
        \psclip{\pscircle[linestyle=none]{2.5}}%
         \psplot{0.5}{3}{1.5*cos(x)/sin(x)}
         \psplot{-0.5}{-3}{1.5*cos(x)/sin(x)}
         \endpsclip
         \uput[r](2.5; 32){Comedy} \uput[r](2.5; -32){Reality}
         \uput[l](-2.5; 32){Tragedy} \uput[l](-2.5; -32){Appearance}
         \end{pspicture}

        \end{document}

得出:

在此处输入图片描述

答案3

元帖子

prologues := 3;
outputtemplate := "%j%c.eps";

beginfig(1);
z0 = right scaled 60; 
z1 = -z3 = z0 rotated 30;
z4 = -z2 = z0 rotated -30;

path p[];
p1 = z2 {right} .. {right} z4;
p2 = z3 {right} .. {right} z1;
draw p2; undraw p1 withpen pencircle scaled 4; draw p1;

defaultfont := "phvr8r";
label.lft("Tragedy",z2);
label.lft("Appearance",z3);
label.rt("Comedy",z1);
label.rt("Reality",z4);

endfig;
end.

试图强调穿越让一条线飞过另一条线。

在此处输入图片描述

如果你宁愿保留一些模糊性并使形状不那么像气,你可以尝试将路径弯曲到它们交叉的垂直位置,并可能摆脱undraw,就像这样:

p1 = z2 {right} .. {down} origin .. {right} z4;
p2 = z3 {right} .. {up}   origin .. {right} z1;
draw p1; draw p2;

这将改变上面的图片,使其更像 OP 图

在此处输入图片描述

答案4

运行xelatex

\documentclass{article}
\usepackage{pst-node}
\begin{document}
\noindent
\makebox[3cm][r]{\rnode{ul}{Tragedy}}\hspace{3cm}\rnode{ur}{Comedy}\\[1.25cm]
\makebox[3cm][r]{\rnode{ll}{Appearence}}\hspace{3cm}\rnode{lr}{Reality}
\nccurve[nodesep=5pt,angleB=180]{ul}{lr}
\nccurve[nodesep=5pt,angleB=180,border=2pt]{ll}{ur}

\end{document}

在此处输入图片描述

相关内容