# Drawing SPACE-TIME in LaTeX!

I am creating an article in LaTeX and would like to include an topological image of space-time. I have attached an image of what I am imagining. Any clue how to go about making this? I have been told that tikz is the package to use, but I have no clue how to use it.

-
Welcome to TeX SE! Questions which merely post an image and ask how to make it are not really reasonable for this site. Please make some efforts on your own behalf and post the code you get. Then people will be happy to help with any specific difficulties you experience. tikz is extremely powerful and very well documented. Start by browsing the documentation and looking at the many examples posted here. That should at least give you some ideas. At the very least, you should be able to post the bare bones of a document to save helpers beginning entirely from scratch. –  cfr Apr 14 '14 at 0:03
(part1) A little hint perhaps would be to use the coordinate transformations in 3D or by doing macros and pgfmath commands. An example of a 3D graph based on input can be found here: tex.stackexchange.com/questions/169561/… . EDIT: If you want to go into the direction drawing light cones after defining your points, you might also want to consider the PGFmanual, found here: ftp.snt.utwente.nl/pub/software/tex/graphics/pgf/base/doc/… (the PGF manual may not load correctly because of... –  1010011010 Apr 14 '14 at 0:16
(part2) ...its file size) (pages 1050-1062) and in particular page 1058 because of its example involving assigning sincos theta to x and x,y coordinates both to y (to mimic a radius). You can then define another coordinate to draw the cone over within your 3D environment. Good luck! –  1010011010 Apr 14 '14 at 0:18
You don't have to re-draw the image, you can just include the image you have, if you wish. –  David Carlisle Apr 14 '14 at 0:43
Why not use Inkscape with PDF+Latex export option, or the svg package? –  jnovacho Apr 14 '14 at 8:58

This should get you started.

\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}


-

Here's a bare-bones approach, with no gradient in the top square, and manually placed black dots.

\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}


In the \foreach loop, you can directly adjust how small the little P_is are and how far away from each node they are. And if you want thicker lines, change \draw to \draw[line width=1pt] or similar. The result looks like this:

-