11

Recently I have been mailing with a lector on the institute of Niels Bohr in Copenhagen regarding a picture written in LaTeX of two inertialframes. He made a figure that looks like this: enter image description here

He used the pstricks package, and he sent me the code. Though, my LaTeX couldn't run with the code, so I tried to make the picture using tikzpicture. I rewrote this code:

    \begin{figure}
\begin{center}
  \psset{unit=8.5mm}
  \begin{pspicture}(-3,-2.4)(14,3.5)
    \psset{linewidth=0.7pt}
    \psset{arrowsize=6pt}
%
    \rput(0,0){
      \psline[linewidth=1pt]{->}(0,0)(3.3,0)   \rput(3.3,-0.5){$x$}
      \psline[linewidth=1pt]{->}(0,0)(0,3.3)   \rput(-0.5,3.2){$y$}
      \psline[linewidth=1pt]{->}(0,0)(-2,-1.7) \rput(-2.1,-2.1){$z$}
       \rput[l](0.5,3.3){\textsf{S}}
    }
%
    \rput(7,0){
      \psline[linewidth=1pt]{->}(0,0)(3.3,0)   \rput(3.3,-0.5){$x^\prime$}
      \psline[linewidth=1pt]{->}(0,0)(0,3.3)   \rput(-0.5,3.2){$y^\prime$}
      \psline[linewidth=1pt]{->}(0,0)(-2,-1.7) \rput(-2.1,-2.1){$z^\prime$}
      \rput[l](0.5,3.3){\textsf{S}$^\prime$}
    }
%
    \psline{->}(5.5,2.2)(8.5,2.2) \rput(8.8,2.2){$v$}
    \rput(11,2.2){\scalebox{2}{\ding{90}}}
    \pscircle[linestyle=none,fillstyle=solid](11,2.2){0.2}
    \psdots[dotsize=4pt](11,2.2)
    \rput[c](11,3){\small \textsf{Begivenhed}}
    \rput[l](11.7,2.4){\small $(x,\,y,\,z,\,t)$}
    \rput[l](11.7,1.8){\small $(x^\prime,\,y^\prime,\,z^\prime,\,t^\prime)$}
    \psline{|->}(0.2,1.4)(6.8,1.4)     \rput(3.5,1.7){$vt$}
    \psline{|->}(7.2,1.4)(11,1.4)      \rput(9.1,1.7){$x^\prime$}
    \psline{|->}(0.2,0.8)(11,0.8)      \rput(5.6,1.1){$x$}
  \end{pspicture}
  \caption{En begivenhed betragtes fra to referencesystemer i
    standardkonfigurationen.}
  \label{fig:standardkonfig}
\end{center}
\end{figure}

into this converted code in tikz:

\begin{center}

\begin{tikzpicture}

\coordinate[label= below left:$$] (origo) at (0,0);

\coordinate[label = below left:$$] (origos) at (7,0);

\draw[line width = 1pt, -{Stealth[length=3mm]}] (origo) -- (3.3,0) node[below]{$x$};

\draw[line width = 1pt, -{Stealth[length=3mm]}] (origo) -- (0,3.3) node[left]{$y$};

\draw[line width= 1pt, -{Stealth[length=3mm]}] (origo) -- (-2,-1.7) node[below]{$z$};

\node[] at (0.5,3.3) {\textsf{S}};

\begin{scope}[xshift = 7cm]

\draw[line width = 1pt, -{Stealth[length=3mm]}] (0,0) -- (3.3,0) node[below]{$x'$};

\draw[line width = 1pt, -{Stealth[length=3mm]}] (0,0) -- (0,3.3) node[left]{$y'$};

\draw[line width= 1pt, -{Stealth[length=3mm]}] (0,0) -- (-2,-1.7) node[below]{$z'$};

\node[] at (0.5,3.3) {\textsf{S}$^{\prime}$};

\end{scope}

\draw[-{Stealth[length=3mm]}, line width=0.8pt](5.5,2.2) -- (8.5,2.2) node[right]{$v$};

\fill[black] (11,2.2) circle (4pt);

\node[] at (11,3) {\small \textsf{Begivenhed}};

\node[] at (12.3,2.4) {\small $(t, \, x, \, y, \, z)$};

\node[] at (12.5,1.8) {\small $(t', \, x', \, y', \, z')$};

\draw[|-{Stealth[length=3mm]}, line width=0.8pt] (0.2,1.4) -- (6.8,1.4) node[above] at (3.5,1.4) {$vt$};

\draw[|-{Stealth[length=3mm]}, line width=0.8pt] (7.2,1.4) -- (11,1.4) node[above] at (9.1,1.4) {$x^{\prime}$};

\draw[|-{Stealth[length=3mm]},line width=0.8pt] (0.2,0.8) -- (11,0.8) node[above] at (5.6,0.76) {$x$};

\end{tikzpicture}

\end{center}

The result was this: enter image description here Which is almost entirely the same, except for the circle that on the ps-code looks like a sun, but on my code (tikz) is just a dot. Does any of you have an idea of how to create that little thing?

FYI, 'Begivenhed', which is a danish word, means event and is used in special relativity. That little sun is supposed to be an event.

13

You can use polar coordinates to draw the lines.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning,calc,arrows.meta}
\begin{document}
\begin{center}
  \begin{tikzpicture}
    \coordinate[label= below left:$$] (origo) at (0,0);
    \coordinate[label = below left:$$] (origos) at (7,0);
    \draw[line width = 1pt, -{Stealth[length=3mm]}] (origo) -- (3.3,0) node[below]{$x$};
    \draw[line width = 1pt, -{Stealth[length=3mm]}] (origo) -- (0,3.3) node[left]{$y$};
    \draw[line width= 1pt, -{Stealth[length=3mm]}] (origo) -- (-2,-1.7) node[below]{$z$};
    \node[] at (0.5,3.3) {\textsf{S}};
    \begin{scope}[xshift = 7cm]
      \draw[line width = 1pt, -{Stealth[length=3mm]}] (0,0) -- (3.3,0) node[below]{$x'$};
      \draw[line width = 1pt, -{Stealth[length=3mm]}] (0,0) -- (0,3.3) node[left]{$y'$};
      \draw[line width= 1pt, -{Stealth[length=3mm]}] (0,0) -- (-2,-1.7) node[below]{$z'$};
      \node[] at (0.5,3.3) {\textsf{S}$^{\prime}$};
    \end{scope}
    \draw[-{Stealth[length=3mm]}, line width=0.8pt](5.5,2.2) -- (8.5,2.2) node[right]{$v$};
    \fill[black] (11,2.2) circle (4pt);
    \foreach \ang in {22.5,45,...,360}{%%%%%%%%%%%%%% Added
      \draw[ultra thick] (11,2.2) +(\ang:6pt) -- +(\ang:11pt);
    }
    \node[] at (11,3) {\small \textsf{Begivenhed}};
    \node[] at (12.3,2.4) {\small $(t, \, x, \, y, \, z)$};
    \node[] at (12.5,1.8) {\small $(t', \, x', \, y', \, z')$};
    \draw[|-{Stealth[length=3mm]}, line width=0.8pt] (0.2,1.4) -- (6.8,1.4) node[above] at (3.5,1.4) {$vt$};
    \draw[|-{Stealth[length=3mm]}, line width=0.8pt] (7.2,1.4) -- (11,1.4) node[above] at (9.1,1.4) {$x^{\prime}$};
    \draw[|-{Stealth[length=3mm]},line width=0.8pt] (0.2,0.8) -- (11,0.8) node[above] at (5.6,0.76) {$x$};
  \end{tikzpicture}
\end{center}
\end{document}

enter image description here

|improve this answer|||||
  • Thanks, this looks just like that. Though, I'm not quite experienced with tikz, so could to elaborate on why the code looks like it does? Could you perhaps break the syntax down for me, the arch, ang:6pt ++ and so on? :) – Cazo May 15 '18 at 21:40
  • \ang is the angle of the line and the \foreach loops through the 16 values. For each line start in the center of your black circle and go 6pt in the angle direction, where you start draw the line up to 11pt. The notation (\ang:6pt) means 6pt in the direction \ang. – StefanH May 15 '18 at 21:47
12

In the original code, you can see that the symbol is generated by \ding{90}.

As the preamble is missing in both your code examples, one has to guess, but it turns out the command comes from the pifont package:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{arrows.meta}

\usepackage{pifont}

\begin{document}

\begin{center}

\begin{tikzpicture}

\coordinate[label= below left:$$] (origo) at (0,0);

\coordinate[label = below left:$$] (origos) at (7,0);

\draw[line width = 1pt, -{Stealth[length=3mm]}] (origo) -- (3.3,0) node[below]{$x$};

\draw[line width = 1pt, -{Stealth[length=3mm]}] (origo) -- (0,3.3) node[left]{$y$};

\draw[line width= 1pt, -{Stealth[length=3mm]}] (origo) -- (-2,-1.7) node[below]{$z$};

\node[] at (0.5,3.3) {\textsf{S}};

\begin{scope}[xshift = 7cm]

\draw[line width = 1pt, -{Stealth[length=3mm]}] (0,0) -- (3.3,0) node[below]{$x'$};

\draw[line width = 1pt, -{Stealth[length=3mm]}] (0,0) -- (0,3.3) node[left]{$y'$};

\draw[line width= 1pt, -{Stealth[length=3mm]}] (0,0) -- (-2,-1.7) node[below]{$z'$};

\node[] at (0.5,3.3) {\textsf{S}$^{\prime}$};

\end{scope}

\draw[-{Stealth[length=3mm]}, line width=0.8pt](5.5,2.2) -- (8.5,2.2) node[right]{$v$};

%\fill[black] (11,2.2) circle (4pt);

\node[scale=3] at (11,2.2) {\ding{90}};

\node[] at (11,3) {\small \textsf{Begivenhed}};

\node[] at (12.3,2.4) {\small $(t, \, x, \, y, \, z)$};

\node[] at (12.5,1.8) {\small $(t', \, x', \, y', \, z')$};

\draw[|-{Stealth[length=3mm]}, line width=0.8pt] (0.2,1.4) -- (6.8,1.4) node[above] at (3.5,1.4) {$vt$};

\draw[|-{Stealth[length=3mm]}, line width=0.8pt] (7.2,1.4) -- (11,1.4) node[above] at (9.1,1.4) {$x^{\prime}$};

\draw[|-{Stealth[length=3mm]},line width=0.8pt] (0.2,0.8) -- (11,0.8) node[above] at (5.6,0.76) {$x$};

\end{tikzpicture}

\end{center}


\end{document}

enter image description here

|improve this answer|||||
6

This is one of the cases where the decoration with ticks doesn't work because the dimensions get too small.

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}

\coordinate[label= below left:${}$] (origo) at (0,0);

\coordinate[label = below left:${}$] (origos) at (7,0);

\draw[line width = 1pt, -{Stealth[length=3mm]}] (origo) -- (3.3,0) node[below]{$x$};

\draw[line width = 1pt, -{Stealth[length=3mm]}] (origo) -- (0,3.3) node[left]{$y$};

\draw[line width= 1pt, -{Stealth[length=3mm]}] (origo) -- (-2,-1.7) node[below]{$z$};

\node[] at (0.5,3.3) {\textsf{S}};

\begin{scope}[xshift = 7cm]

\draw[line width = 1pt, -{Stealth[length=3mm]}] (0,0) -- (3.3,0) node[below]{$x'$};

\draw[line width = 1pt, -{Stealth[length=3mm]}] (0,0) -- (0,3.3) node[left]{$y'$};

\draw[line width= 1pt, -{Stealth[length=3mm]}] (0,0) -- (-2,-1.7) node[below]{$z'$};

\node[] at (0.5,3.3) {\textsf{S}$^{\prime}$};


\end{scope}

\draw[-{Stealth[length=3mm]}, line width=0.8pt](5.5,2.2) -- (8.5,2.2) node[right]{$v$};

\foreach \X in {0,30,...,330}
{\draw (11,2.2) -- ++ (\X:11pt);}
\fill[white] (11,2.2) circle (6pt);
\fill[black] (11,2.2) circle (4pt);


\node[] at (11,3) {\small \textsf{Begivenhed}};

\node[] at (12.3,2.4) {\small $(t, \, x, \, y, \, z)$};

\node[] at (12.5,1.8) {\small $(t', \, x', \, y', \, z')$};

\draw[|-{Stealth[length=3mm]}, line width=0.8pt] (0.2,1.4) -- (6.8,1.4) node[above] at (3.5,1.4) {$vt$};

\draw[|-{Stealth[length=3mm]}, line width=0.8pt] (7.2,1.4) -- (11,1.4) node[above] at (9.1,1.4) {$x^{\prime}$};

\draw[|-{Stealth[length=3mm]},line width=0.8pt] (0.2,0.8) -- (11,0.8) node[above] at (5.6,0.76) {$x$};

\end{tikzpicture}

\end{document}

enter image description here

|improve this answer|||||
  • I changed ticks to tikz :). And can't you fool ticks by making a bigger symbol and scaling it afterward? EDIT: Sorry if I misunderstood it! – Dr. Manuel Kuehner May 15 '18 at 21:37
  • 2
    @Dr.ManuelKuehner Sorry, ticks was intentional, and I'm not sure scaling would work, see here. – user121799 May 15 '18 at 21:39
4

It is not a complete an excellent answer. But is also possible to create a macro for TikZ using this code.

enter image description here

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
  \def\Radius{4cm}
  \draw[line width=1.2mm]
    \foreach \a in {0,10,20, 30, ..., 350} {
      (0, 0) -- (\a:\Radius)
    }
    (0, 0) -- (10:3cm)
  ;
  \end{tikzpicture}
\end{document}
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.