在 LaTeX 中绘制时空!

在 LaTeX 中绘制时空!

我正在用 LaTeX 创建一篇文章,想在其中添加一张时空拓扑图像。我已附上一张我想象的图像。有没有人知道该怎么做?有人告诉我可以使用 tikz 软件包,但我不知道如何使用它。

在此处输入图片描述

答案1

这应该可以帮助你入门。

\documentclass[tikz,border=10pt]{standalone}
\usepackage{amssymb}
\usetikzlibrary{positioning}
\begin{document}
  \begin{tikzpicture}
    \foreach \x/\y/\z in {1/1/9,3.2/1/10,2/1.5/8,1.5/2/6, 2.5/2/7,1.2/2.5/2,2/2.5/4,3.1/2.5/5,2/3/1,2.9/2.9/3}{
    \node[circle,fill,inner sep=2pt,outer sep=0pt,label={[xshift=-3pt,yshift=2pt,scale=0.7]-60:$\mathrm{P}_{\z}$}] (\z) at (\x,\y){};
    }
    \node[draw,rectangle,anchor=south west,minimum width=4cm,minimum height=4cm] (A) at (0,0) {};
    \node[draw,rectangle,top color=white,bottom color=gray!20,anchor=south west,minimum width=4cm,minimum height=4cm] (B) at (1.3,5) {};
    \draw (A.north west) -- (B.north west)
          (A.north east) -- (B.north east)
          (A.south west) -- (B.south west)
          (A.south east) -- (B.south east);
    \node (U) at (-1,6) {$\mathrm{U}_1$};
    \node at (-1,2) {$\mathrm{U}_2$};
    \draw (U.east) edge[bend left] (1.west);
    \draw (U.east) edge[bend right] (2.south);
    \node[anchor=west] at (-0.5,-1) {Legend:};
    \node[anchor=west] at (0,-1.5) {{\tiny$\blacksquare$} $\mathrm{U}_1$ - instantiated universal};
    \node[anchor=west] at (0,-2) {{\tiny$\blacksquare$} $\mathrm{U}_2$ - uninstantiated universal};
    \node[anchor=west] at (0,-2.5) {{\tiny$\blacksquare$} $\mathrm{P}_1 \ldots \mathrm{P}_2$ - thin particulars};
    \node[anchor=west] at (0,-3) {{\tiny$\blacksquare$} $\mathrm{P}_3 \ldots \mathrm{P}_{10}$ - bare particulars};
    \node[anchor=center,above = 0.1cm of B.north west,font=\bfseries\large] {Space-time manifold}; 
  \end{tikzpicture}
\end{document}

在此处输入图片描述

答案2

这是一种最基本的办法,顶部方块没有渐变,并且手动放置黑点。

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}

\begin{document}

\begin{tikzpicture}
% Main shapes
\draw (0,0) rectangle (3,3);
\foreach \x\y in {0/0,3/0,0/3,3/3}{
  \draw (\x,\y)--($(\x,\y)+(1,4)$);
}
\draw[fill=gray,fill opacity=.2] (1,4) rectangle (4,7);
% Labels
\node (u) at (-1,4.5) {$U_1$};
\node at (-1,1) {$U_2$};
% Dots
\foreach \x\y\z in {1.3/2.5/1,.8/2/2,2.1/2.6/3,1.5/1.8/4,2.5/1.7/5,1.2/1.1/6,2.3/1.1/7,1.5/.5/8,.8/.4/9,2.5/.4/10}{
  \coordinate (p\z) at (\x,\y);
  \draw[fill=black] (\x,\y) circle (.05);
  \node at ($(\x,\y)+(315:.3)$) {\scalebox{.7}{$P_{\z}$}};
}
% Connectors
\draw (u) to [out=0,in=90] (p1);
\draw (u) to [out=270,in=180] (p2);
\end{tikzpicture}

\end{document}

\foreach循环中,您可以直接调整小 s 的大小P_i以及它们与每个节点的距离。如果您想要更粗的线条,请更改\draw\draw[line width=1pt]或类似。结果如下所示:

在此处输入图片描述

相关内容