summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/ptolemaicastronomy/ptolemaicastronomy.sty
blob: 6d132d470912faa13f5e6c36f19e04ef32440c6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
%%
%% This is file `ptolemaicastronomy.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% ptolemaicastronomy.dtx  (with options: `package')
%% 
%% ptolemaicastronomy
%% ==================
%% 
%% Diagrams of sphere models for variably strict conditionals (Lewis
%% counterfactuals)
%% 
%% Author: Richard Zach
%% E-mail: rzach@ucalgary.ca
%% License: Released under the LaTeX Project Public License v1.3c or later
%% See: http://www.latex-project.org/lppl.txt
%% 
%% David K. Lewis (Counterfactuals, Blackwell 1973) introduced a sphere
%% semantics for counterfactual conditionals. He jokingly referred to the
%% diagrams depicting such sphere models as Ptolemaic astronomy, hence
%% the name of this package. It has nothing to do with Ptolemy or with
%% astronomy, sorry.
%% 
%% The macros provided in this package aid in the construction of
%% sphere model diagrams in the style of Lewis. The macros all make use
%% of TikZ.
%% 
%% for documentation and source code see
%% https://github.com/rzach/ptolemaic-astronomy
%% 
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{ptolemaicastronomy}
    [2018/04/08 v1.00 Diagrams of sphere models for variably strict conditionals (Lewis counterfactuals)]














\RequirePackage{tikz}

\tikzset{
  sphere/.style = {dotted},
  sphere intersection/.style = {fill=lightgray},
  sphere layer/.style = {fill=lightgray},
  proposition/.style={smooth,tension=1.7},
}
\pgfkeyssetvalue{/tikz/layerwidth}{.5}
\pgfkeyssetvalue{/tikz/innerfactor}{.4}
\newcommand{\sphereplot}[1]{
  circle
    [radius=(#1)*\pgfkeysvalueof{/tikz/layerwidth}-
      \pgfkeysvalueof{/tikz/layerwidth}*\pgfkeysvalueof{/tikz/innerfactor}]
}
\newcommand{\spheresystem}[2][]{
  \foreach \i in {1,...,#2}{
    \draw[sphere,#1] \sphereplot{\i} ;
  }
}

\newcommand{\spherelayer}[2][]{
  \begin{scope}[even odd rule]
    \fill[#1,sphere layer]
    \sphereplot{#2-1} \sphereplot{#2} ;
  \end{scope}
}
\newcommand{\spherefill}[2][]{
    \fill[sphere intersection,#1]
    \sphereplot{#2} ;
}
\newcommand{\sphereintersect}[3][]{
  \begin{scope}[even odd rule]
    \path[clip] #3;
    \spherefill[#1]{#2}
  \end{scope}
}
\newcommand{\propositionplot}[4]{
  plot [proposition]
  coordinates {+(#1+#3/2:#4)
    +(#1:#2*\pgfkeysvalueof{/tikz/layerwidth}-
    \pgfkeysvalueof{/tikz/layerwidth}*.9
    -\pgfkeysvalueof{/tikz/layerwidth}*\pgfkeysvalueof{/tikz/innerfactor})
    +(#1-#3/2:#4)}
}
\newcommand{\proposition}[5][]{
  \draw[proposition,#1] \propositionplot {#2}{#3}{#4}{#5} ;
  }
\newcommand{\propositionintersect}[5][]{
  \begin{scope}
  \path[clip] \propositionplot{#2}{#3}{#4}{#5};
  \spherefill[#1]{#3}
  \end{scope}
  \draw[proposition,#1] \propositionplot{#2}{#3}{#4}{#5};
}
\newcommand{\spherepos}[4][]{
  \begin{scope}[shift=(#2:#3*\pgfkeysvalueof{/tikz/layerwidth}-
      \pgfkeysvalueof{/tikz/layerwidth}/2-
        \pgfkeysvalueof{/tikz/layerwidth}*\pgfkeysvalueof{/tikz/innerfactor})]
    \path[#1] #4 ;
  \end{scope}
}
\endinput
%%
%% End of file `ptolemaicastronomy.sty'.