Skip to content

Commit 0dea58a

Browse files
committed
Started v1.3
- New functionality to generate causets from integer permutations that may now also include negative numbers - New key `offset` to shift all integers given in the arguments - New key `text font` to set a font face size and font family for text labels - New functionality to replace label text and add event text in the permutation argument - Changed functionality, `\*causetL` deactivates the permutation, and `\*causetP` deactives the event labels
1 parent a31bcbc commit 0dea58a

File tree

8 files changed

+935
-615
lines changed

8 files changed

+935
-615
lines changed

README.md

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
LaTeX Package: causets
2-
======================
3-
This is a LaTeX package to create (Hasse) diagrams of causal sets - short causets (locally finite, partially ordered sets) to be used inline with text or mathematical expressions, as well as with TikZ pictures.
1+
# The `causets` package
2+
The LaTeX package `causets` lets you create (Hasse) diagrams of causal sets. Causal sets (causets) are locally finite, partially ordered sets and are consider as a framework for quantum gravity. This package is built on the package `tikz`, which is usually included in the standard LaTeX installations and loaded automatically with `\usepackage{causets}`.
43

4+
The diagrams can be used inline with text or mathematical expressions, or they may be included in a TikZ pictures.
55
The three main commands (macros) are
66
```tex
77
% causet generated from a permutation:
@@ -14,12 +14,7 @@ The three main commands (macros) are
1414

1515
For a full documentation, please see causets.pdf.
1616

17-
Additional Packages
18-
===================
19-
This package is built on the package `tikz`, which is usually included in the standard LaTeX installations.
20-
21-
Bug Reports
22-
===========
17+
## Bug reports
2318
Problems with the package are reported here:
2419
https://github.com/c-minz/LaTeX-causets/issues
2520

@@ -34,20 +29,19 @@ Bug reports can be send to the maintainer:
3429
C. Minz
3530
christoph{dot}minz[AT]gmail{dot}com
3631

37-
Information on Distribution
38-
===========================
32+
## License and distribution
3933
Copyright 2020-2022 by C. Minz
4034

41-
This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3 of this license or (at your option) any later version.
42-
The latest version of this license is in
35+
This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3 of this licence or (at your option) any later version.
36+
The latest version of this licence is in
4337
http://www.latex-project.org/lppl.txt
4438

4539
This work has the LPPL maintenance status "maintained".
4640

4741
The current maintainer of this work is C. Minz.
4842
https://github.com/c-minz
4943

50-
Current version: 1.2
44+
**Current version: v1.3**
5145

5246
CTAN location: /graphics/pgf/contrib/causets/
5347

causet_tikz_example1.pdf

1.26 KB
Binary file not shown.

causet_tikz_example1.tex

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,21 @@
33
\usetikzlibrary{fit,shapes.geometric}
44
\begin{document}
55
\begin{tikzpicture}
6+
% Create causet, shifted in x- and y-direction:
67
\begin{scope}[xshift=3cm, yshift=-1cm]
8+
\tikzcausetsset{offset=-2}
79
\drawpcauset{5,2,7,3,6,1,4}
810
\draw[red, double] (0, 0) circle[radius=0.1];
911
\end{scope}
10-
\node[draw=blue, inner sep=1pt, thick, ellipse, fit=(E4) (E6) (E7)] (Finf) {};
11-
\node[draw=blue] (FinfLabel) at (6.5, -0.5) {future infinity};
12-
\node[draw=red] (centerLabel) at (0.5, -0.5) {center};
13-
\node[draw=green!50!black] (myEventLabel) at (5.5, -2.5) {event (E2)};
12+
% Circumscribe the future infinity:
13+
\node[draw=blue, inner sep=1pt, thick, ellipse, fit=(E2) (E4) (E5)] (Finf) {};
14+
% Add labels on top:
15+
\node[draw=blue, right, align=right] (FinfLabel) at (4.8, -0.5) {future infinity / \\ maximal events};
16+
\node[draw=red] (centerLabel) at (0.5, -0.5) {centre};
17+
\node[draw=green!50!black] (myEventLabel) at (5.5, -2.5) {event (E0)};
18+
% Draw arrows from the labels to the references:
1419
\draw[ultra thick, blue, ->] (FinfLabel) -- (Finf);
1520
\draw[ultra thick, red, ->] (centerLabel) -- (3, -1);
16-
\draw[ultra thick, green!50!black, ->] (myEventLabel) -- (E2);
21+
\draw[ultra thick, green!50!black, ->] (myEventLabel) -- (E0);
1722
\end{tikzpicture}
1823
\end{document}

causet_tikz_example2.pdf

30.3 KB
Binary file not shown.

causet_tikz_example2.tex

Lines changed: 89 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,95 @@
11
\documentclass[tikz]{standalone}
22
\usepackage[blue]{causets}
33
\usetikzlibrary{fit,shapes.geometric}
4+
% Set colours and style:
5+
\colorlet{future colour}{green!50!black}
6+
\colorlet{past colour}{yellow!50!orange!80!black}
7+
\colorlet{anywhere colour}{red!80!black}
8+
\tikzset{prob arrow/.style={line width=1.5pt}}
9+
% Define some helper functions:
10+
\newcommand*{\semiopaque}[1]{% Adds a transparency group.
11+
\begin{scope}[transparency group, opacity=0.5]
12+
#1
13+
\end{scope}
14+
}
15+
\newcommand*{\drawprobarrow}[4][]{% Draws a (probability) arrow.
16+
\draw[prob arrow] (#2) -- node[sloped, midway, below, #1] {$#3$} (#4);
17+
}
18+
\newcommand{\drawlegendsymbol}{% Draws the symbol for a legend entry.
19+
\draw[prob arrow] (0,0) -- +(10pt, 6pt);
20+
}
21+
\newcommand{\legendsymbol}[1]{% Creates the legend symbol.
22+
\begin{tikzpicture}
23+
\ifnum#1=0
24+
\drawlegendsymbol
25+
\else
26+
\semiopaque{\drawlegendsymbol}
27+
\fi
28+
\end{tikzpicture}
29+
}
430
\begin{document}
5-
\begin{tikzpicture}[-stealth, line width=2pt]
6-
\matrix[nodes={draw, fill=yellow!10, thin, circle, inner sep=0.6ex, minimum size=5ex}, row sep=1.5cm, column sep=0.1cm]
7-
{
8-
\node (C1234) {\pcauset{1,2,3,4}};
9-
& \node (C1243) {\pcauset{1,2,4,3}};
10-
& \node[fill=yellow!20] (C1423) {\pcauset{1,4,2,3}};
11-
& \node (C1324) {\pcauset{1,3,2,4}};
12-
& \node (C1432) {\pcauset{1,4,3,2}};
13-
& \node[fill=yellow!30] (C4123) {\pcauset{4,1,2,3}};
14-
& \node[fill=yellow!30] (C4132) {\pcauset{4,1,3,2}};
15-
& \node[fill=yellow!20] (C3124) {\pcauset{3,1,2,4}};
16-
& & \node[fill=yellow!20] (C3412) {\pcauset{3,4,1,2}};
17-
& \node[fill=yellow!30] (C3142) {\pcauset{3,1,4,2}};
18-
& \node[fill=yellow!30] (C4312) {\pcauset{4,3,1,2}};
19-
& \node (C2134) {\pcauset{2,1,3,4}};
20-
& \node (C2143) {\pcauset{2,1,4,3}};
21-
& \node[fill=yellow!20] (C4213) {\pcauset{4,2,1,3}};
22-
& \node (C3214) {\pcauset{3,2,1,4}};
23-
& \node (C4321) {\pcauset{4,3,2,1}};
24-
\\
25-
\\
26-
& & \node (C123) {\pcauset{1,2,3}};
27-
& & & \node (C132) {\pcauset{1,3,2}};
28-
& & & \node[fill=yellow!20] (C312) {\pcauset{3,1,2}};
29-
& & & \node (C213) {\pcauset{2,1,3}};
30-
& & & \node (C321) {\pcauset{3,2,1}};
31-
\\
32-
& & & & & \node (C12) {\pcauset{1,2}};
33-
& & & & & & \node (C21) {\pcauset{2,1}};
34-
\\
35-
& & & & & & & & \node (C1) {\pcauset{1}};
36-
\\
37-
};
38-
\draw (C1) -- node[below left] {$p_{12}$} (C12);
39-
\draw (C12) -- node[below left] {$p_{123}$} (C123);
40-
\draw (C123) -- node[sloped, midway, below] {$p_{1234}$} (C1234);
41-
\draw (C123) -- node[sloped, near end, below] {$p_{1243}$} (C1243);
42-
\draw (C123) -- node[sloped, midway, below] {$p_{1423}$} (C1423);
43-
\draw (C123) -- node[sloped, near start, below] {$p_{4123}$} (C4123);
44-
\draw (C12) -- node[left] {$p_{132}$} (C132);
45-
\draw (C132) -- node[sloped, near start, below] {$p_{1342}$} (C1423);
46-
\draw (C132) -- node[sloped, near end, below] {$p_{1324}$} (C1324);
47-
\draw (C132) -- node[sloped, midway, above] {$p_{1432}$} (C1432);
48-
\draw (C132) -- node[sloped, near start, below] {$p_{4132}$} (C4132);
49-
\draw (C12) -- node[below right] {$p_{312}$} (C312);
50-
\draw (C312) -- node[sloped, near end, above] {$p_{3124}$} (C3124);
51-
\draw (C312) -- node[sloped, near end, above] {$p_{3412}$} (C3412);
52-
\draw (C312) -- node[sloped, near end, above] {$p_{3142}$} (C3142);
53-
\draw (C312) -- node[sloped, near start, below] {$p_{4312}$} (C4312);
54-
\draw (C1) -- node[below right] {$p_{21}$} (C21);
55-
\draw (C21) -- node[below left] {$p_{231}$} (C312);
56-
\draw (C312) -- node[sloped, near start, below] {$p_{2341}$} (C4123);
57-
\draw (C312) -- node[sloped, near end, above] {$p_{2431}$} (C4132);
58-
\draw (C21) -- node[right] {$p_{213}$} (C213);
59-
\draw (C213) -- node[sloped, midway, above] {$p_{2134}$} (C2134);
60-
\draw (C213) -- node[sloped, near start, below] {$p_{2413}$} (C3142);
61-
\draw (C213) -- node[sloped, near end, below] {$p_{2143}$} (C2143);
62-
\draw (C213) -- node[sloped, near start, below] {$p_{4213}$} (C4213);
63-
\draw (C21) -- node[below right] {$p_{321}$} (C321);
64-
\draw (C321) -- node[sloped, near start, below] {$p_{3421}$} (C4312);
65-
\draw (C321) -- node[sloped, midway, above] {$p_{3241}$} (C4213);
66-
\draw (C321) -- node[sloped, near end, above] {$p_{3214}$} (C3214);
67-
\draw (C321) -- node[sloped, midway, below] {$p_{4321}$} (C4321);
31+
\begin{tikzpicture}[-stealth]
32+
\def\ystep{2.0cm}
33+
\def\xstep{0.52cm}
34+
% Create nodes of all causets with 1 to 4 events:
35+
\begin{scope}[nodes={draw, thin, circle, minimum size=1.02cm}]
36+
\node (C1) at ( 0, 0) {\pcauset{1}};
37+
\node (C12) at (-4*\xstep, 1*\ystep) {\pcauset{1,2}};
38+
\node (C21) at ( 4*\xstep, 1*\ystep) {\pcauset{2,1}};
39+
\foreach \CPoint/\CXPos/\CPerm in {C123/-8/{{1,2,3}}, C132/-4/{{1,3,2}}, C312/0/{{3,1,2}}, C213/4/{{2,1,3}}, C321/8/{{3,2,1}}}
40+
\node (\CPoint) at (\CXPos*\xstep, 2*\ystep) {\expandafter\pcauset\CPerm};
41+
\foreach \CPoint/\CXPos/\CPerm in {C1234/-15/{{1,2,3,4}}, C1243/-13/{{1,2,4,3}}, C1423/-11/{{1,4,2,3}}, C1324/-9/{{1,3,2,4}}, C1432/-7/{{1,4,3,2}}, C4123/-5/{{4,1,2,3}}, C4132/-3/{{4,1,3,2}}, C3124/-1/{{3,1,2,4}}, C3412/1/{{3,4,1,2}}, C3142/3/{{3,1,4,2}}, C4312/5/{{4,3,1,2}}, C2134/7/{{2,1,3,4}}, C2143/9/{{2,1,4,3}}, C4213/11/{{4,2,1,3}}, C3214/13/{{3,2,1,4}}, C4321/15/{{4,3,2,1}}}
42+
\node (\CPoint) at (\CXPos*\xstep, 3.75*\ystep) {\expandafter\pcauset\CPerm};
43+
\end{scope}
44+
% Add graph edges for expandings ...
45+
% ... to the past (additionally):
46+
\begin{scope}[past colour]
47+
\foreach \StartPoint/\EndPoint in {C12/C213, C123/C3124, C123/C2134, C132/C1243, C132/C3142, C132/C2143, C312/C1423, C312/C4213, C213/C1324, C213/C3124, C213/C3214, C321/C1432, C321/C4132, C21/C132}
48+
\semiopaque{\drawprobarrow{\StartPoint}{}{\EndPoint}};
49+
\end{scope}
50+
% ... to anywhere (additionally, further):
51+
\begin{scope}[anywhere colour]
52+
\semiopaque{\drawprobarrow{C123}{}{C1324}};
53+
\end{scope}
54+
% ... to the future:
55+
\begin{scope}[prob arrow, future colour]
56+
\drawprobarrow{C1}{p_{12}}{C12}
57+
\drawprobarrow{C12}{p_{123}}{C123}
58+
\drawprobarrow{C123}{p_{1234}}{C1234}
59+
\drawprobarrow[near end]{C123}{p_{1243}}{C1243}
60+
\drawprobarrow[near end]{C123}{p_{1423}}{C1423}
61+
\drawprobarrow[near start, above]{C123}{p_{4123}}{C4123}
62+
\drawprobarrow[above]{C12}{p_{132}}{C132}
63+
\drawprobarrow[near end]{C132}{p_{1342}}{C1423}
64+
\drawprobarrow[near end]{C132}{p_{1324}}{C1324}
65+
\drawprobarrow[midway, above]{C132}{p_{1432}}{C1432}
66+
\drawprobarrow[near start]{C132}{p_{4132}}{C4132}
67+
\drawprobarrow[near start, above]{C12}{p_{312}}{C312}
68+
\drawprobarrow[near end]{C312}{p_{3124}}{C3124}
69+
\drawprobarrow[near end]{C312}{p_{3412}}{C3412}
70+
\drawprobarrow[near end]{C312}{p_{3142}}{C3142}
71+
\drawprobarrow[near start]{C312}{p_{4312}}{C4312}
72+
\drawprobarrow{C1}{p_{21}}{C21}
73+
\drawprobarrow[near start, above]{C21}{p_{231}}{C312}
74+
\drawprobarrow[near start]{C312}{p_{2341}}{C4123}
75+
\drawprobarrow[near end]{C312}{p_{2431}}{C4132}
76+
\drawprobarrow{C21}{p_{213}}{C213}
77+
\drawprobarrow[above]{C213}{p_{2134}}{C2134}
78+
\drawprobarrow[near start]{C213}{p_{2413}}{C3142}
79+
\drawprobarrow[near end]{C213}{p_{2143}}{C2143}
80+
\drawprobarrow[near end]{C213}{p_{4213}}{C4213}
81+
\drawprobarrow{C21}{p_{321}}{C321}
82+
\drawprobarrow[near start, above]{C321}{p_{3421}}{C4312}
83+
\drawprobarrow[near end]{C321}{p_{3241}}{C4213}
84+
\drawprobarrow[near end]{C321}{p_{3214}}{C3214}
85+
\drawprobarrow{C321}{p_{4321}}{C4321}
86+
\end{scope}
87+
% Add legend:
88+
\node[above left, align=left, draw, inner sep=3ex, fill=gray!05]
89+
at (15*\xstep, 0)
90+
{Expanding into\\
91+
\bfseries\color{future colour}\legendsymbol{0}\ the future\\
92+
\bfseries\color{past colour}\legendsymbol{1}\ + the past\\
93+
\bfseries\color{anywhere colour}\legendsymbol{1}\ + anywhere};
6894
\end{tikzpicture}
6995
\end{document}

causets.pdf

43.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)