forked from OpenLogicProject/forallx-cam
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathforallx-adl.sty
417 lines (360 loc) · 17.6 KB
/
forallx-adl.sty
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
%!TEX root = forallx-adl.tex
\ProvidesPackage{forallx-adl}[2011/10/29 support for a logic textbook]
% The original forallx.sty was written in 2005
% Comments marked "TB" are additions by Tim Button in September 2012
% Comments marked "Æ" are additions by Antony Eagle from June 2017
\PassOptionsToPackage{dvipsnames}{xcolor}
\RequirePackage{latexsym,amssymb,amsmath,hyperref,multicol,ifthen,graphicx,rotating,xcolor}
\usepackage[numbered]{bookmark} %TB: added for speedy navigation
% XeLaTeX font commands - Æ
\usepackage{fontspec}
\defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
\setmainfont[Numbers=OldStyle,Ligatures={Common}]{Palatino Linotype} % Æ loathes Computer Modern
\setsansfont[Numbers=OldStyle,Ligatures={Common},Scale=MatchLowercase,ScaleAgain=0.93,BoldFont={Avenir Next Demi Bold},BoldItalicFont={Avenir Next Demi Bold Italic}]{Avenir Next}
\setmonofont[Scale=MatchLowercase]{Iosevka Fixed Light}
\usepackage{mathtools}
\usepackage[math-style=ISO,mathbf=sym,bold-style=ISO,mathsf=text,warnings-off={mathtools-colon,mathtools-overbracket}]{unicode-math}
\setoperatorfont{\rmfamily}
\setmathfont[Scale=MatchLowercase,ScaleAgain=0.94]{STIX Two Math}
% \setmathfont[range=up/{num},Numbers=OldStyle]{Palatino Linotype}
\newfontfamily\cjkfont{Yu Mincho}
\newfontfamily\dispfont[Numbers=OldStyle,Ligatures={Common},SizeFeatures={{Size=12-,Scale=2}}]{Palatino Linotype Bold Italic}
% packages added by Æ
\usepackage{polyglossia}
\setdefaultlanguage[variant=australian]{english}
\usepackage{microtype}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{metalogo}
\usepackage[norule,bottom,hang]{footmisc}
\frenchspacing
% ****************************************
% * LOGICAL SYMBOLS *
% ****************************************
%
% There are, of course, many different symbols used for the truth-functional
% connectives. In order to make the book adaptable, the symbols are defined
% here in the style sheet and these commands are used throughout the book.
% To change conjunction from the ampersand to the carat, for instance,
% change the definition of \eand from ~\&~ to \wedge. To change negation from
% the hoe to the tilde, change \enot from \neg to {\sim}. Other examples
% are given below.
%
\newcommand{\ttherefore}{\ensuremath{\mathrel{\therefore}}}
% disjunction
\def\eor{\ensuremath{\vee}}
% conjunction:
% {\,^{_{_{_{_{\mbox{\footnotesize\textbullet}}}}}}} gives the dot
\def\eand{\ensuremath{\wedge}}
% conditional: \supset gives the horseshoe
\def\eif{\ensuremath{\rightarrow}}
% biconditional: \equiv gives the triple bar
\def\eiff{\ensuremath{\leftrightarrow}}
% negation: {\sim} gives the tilde
\def\enot{\ensuremath{\neg}}
\def\ered{\ensuremath{\bot}}% TB: added to give an absurdity sign
\def\maththe{\turnediota} % Æ added to used unicode rotated iota for definites
\def\proves{\ensuremath{\vdash}}
\def\entails{\ensuremath{\vDash}}
\def\nproves{\ensuremath{\nvdash}}
\def\nentails{\ensuremath{\nvDash}}
% These commands define the names of our languages; I like 'Sentential' instead of 'TFL' and 'Quantifier' instead of 'FOL' – but you might like to mix it up.
\newcommand{\TFL}{\textsf{Sentential}}
\newcommand{\FOL}{\textsf{Quantifier}}
% ****************************************
% * TITLE AND VERSION DATA *
% ****************************************
% the title of the book
\newcommand*{\forallx}{\texttt{forall}\script{x}}
\newcommand*{\forallxadl}{\texttt{forall}\script{x} \textsc{Adelaide}}
% The version number of the book is a 5 digit integer:
% the last digit of the year, the month, the day of the month
\newcounter{dummy}
\setcounter{dummy}{\year}
\addtocounter{dummy}{-2000}
\newcommand*{\bookversion}{%
\ifthenelse{\arabic{dummy}<10}{0}{}%
\arabic{dummy}%
\ifthenelse{\month<10}{0}{}\number\month%
\ifthenelse{\day<10}{0}{}\number\day%
}
% ****************************************
% * SYMBOLS AND SCRIPTY BITS *
% ****************************************
% equivalent to commenting something out, but usable on multiple lines
\providecommand{\nix}[1]{}
\newcommand*{\script}[1]{\ensuremath{\symscr{#1}}}
\renewcommand*{\meta}[1]{\ensuremath{\symscr{#1}}} % TB: used for all metavariables
% create a blank
\newcommand*{\gap}[1]{\ensuremath{\underbracket{\hspace*{2.5em}}_{#1}}} % TB: used for keys, to avoid use/mention confusion Æ made script
\newcommand*{\blank}{\gap{}}
% These are included for discussing formal semantics in predicate logic.
\newcommand*{\model}[1]{\ensuremath{\symbb{#1}}}
\newcommand*{\extension}[1]{\ensuremath{\mbox{extension}(#1)}}
\newcommand*{\referent}[1]{\ensuremath{\mbox{referent}(#1)}}
% Many philosophers seem to think using < and > is acceptable for angle brackets, even though it is not. If you want to use them, though, you can replace \langle and \rangle in the commands below.
\newcommand*{\openntuple}{\langle}
\newcommand*{\closentuple}{\rangle}
\newcommand*{\ntuple}[1]{\mbox{\ensuremath{\mathopen{\openntuple}}#1\ensuremath{\mathclose{\closentuple}}}}
% definitions
\newcommand*{\define}[1]{\textsc{\lowercase{#1}}\index{#1}}
\newcommand*{\idefine}[1]{\textsc{\emph{\lowercase{#1}}}\index{#1@\emph{#1}}}
\newcommand{\subs}[2]{\vert_{#1\curvearrowright #2}} % Æ notation for uniform substitution of #1 for #2
\newcommand{\domain}{\text{domain}}
\newcommand{\httpurl}[1]{\href{https://#1}{\nolinkurl{#1}}} % new treatment of urls Æ
% ****************************************
% * LIST ENVIRONMENTS *
% ****************************************
% The {earg} environment is used for arguments and example sentences.
% The {ekey} environment is used for symbolization keys.
% Updated by Æ to attempt to keep arguments and examples together rather than widow premises and orphan conclusions – basically just stick in a minipage and vertically offset by topsep.
\newcounter{eargnum}
\newcounter{OLDeargnum}
\newenvironment{earg}{%
\vskip\topsep\begin{minipage}{\linewidth} % Added Æ
\begin{list}{\arabic{eargnum}.}{\usecounter{eargnum}\itemsep=0pt \parsep=0pt}}%
{\setcounter{OLDeargnum}{\arabic{eargnum}}\end{list}
\end{minipage}\vskip\topsep % Added Æ
}
%\newenvironment{itemize}% TB: added to give a nice bulleted enivronment
%{\begin{list}{\textbullet}{\itemsep=0pt \parsep=0pt}}%
%{\end{list}}
\newcommand{\ekeylabel}[1]{{\makebox[8ex][r]{\ensuremath{ #1}:}}}
\newenvironment{ekey}{
\vskip\topsep\begin{minipage}{\linewidth} % Added Æ
\begin{list}{}{\renewcommand{\makelabel}{\ekeylabel} \itemsep=0pt \parsep=0pt}}{\end{list}
\end{minipage}\vskip\topsep % Added Æ
}
% Used in conjunction with {earg}, this handles the numbering and
% references to example sentences:
\newcounter{Example}% [chapter] continuous numbering
\newcommand*{\ex}[1]{\refstepcounter{Example}(\arabic{Example}) \label{#1}}
% Used in specifying partial models, this keeps the lines justified so
% so that the = signs all line up. For example:
% \begin{partialmodel}
% UD & \{Duke, Miles\}\\
% \extension{B} & \{Duke\}
% \end{partialmodel}
\newenvironment{partialmodel}{\par\begin{tabular}{r@{~=~}l}}{\bottomrule \end{tabular}\par}
% define the bullet for {itemize} lists
\renewcommand{\labelitemi}{{\textcolor{orange}›}}%{$▸$}{\textbullet}
% \factoidbox{...} produces an inset paragraph of text with a line around it
% Neither for lists nor an environment, but it really didn't
% belong anywhere else.
\setlength{\fboxsep}{0.8em}
\newcommand{\factoidbox}[1]{\begin{quote}\fcolorbox{orange}{liigray}{\parbox{\linewidth-1.8em}{#1}}\end{quote}}
\newcommand{\keyideas}[1]{\factoidbox{\textcolor{orange}{\textbf{Key Ideas in §\thechapter}} \begin{itemize}
#1 \end{itemize}}}
% \tablefbox{...} is used in certain tables to put a box around the contents of specific table cells without having lines that run the whole length of the table
\newcommand{\tablefbox}[1]{\multicolumn{1}{|p{10em}|}{#1}}
% ****************************************
% * PRACTICE PROBLEMS *
% ****************************************
\newcounter{ProbPart}
\renewcommand{\theProbPart}{\Alph{ProbPart}}
% This inserts a heading and resets the counter:
\newcommand*{\practiceproblems}{
\setcounter{ProbPart}{0}\section*{Practice exercises}%
\addcontentsline{toc}{section}{Practice exercises}
}
% This starts a new section which is automatically numbered:
\newcommand*{\problempart}{\par\noindent\refstepcounter{ProbPart}\textbf{\Alph{ProbPart}. }}
% This bullet is used to indicate that solutions appear at the end of
% the book.
\newcommand*{\solutions}{} %TB: removed, since I am not including the solutions in the book
% When solutions are only given for selected problems, the
% star is placed left of the problem number.
\newcommand*{\leftsolutions}{\hspace{-2.2em}\makebox[2em][l]{\solutions}}
% This is used at the beginning of a section in the solutions
% appendix.
\newcommand*{\solutionsection}[2]{%
\textbf{\textsc{Chapter {\ref{#1}} Part {\ref{#2}}}}%
\markright{solutions for ch.~\ref{#1}}%
\setcounter{countSeq}{0}
}
% This is used to enumerate things that have a given property.
% For example: \nextSeq\nextSeq\noSeq\lastSeq are valid.
% produces : 1, 2, and 4 are valid.
\newcounter{countSeq}
\newcommand*{\nextSeq}{\stepcounter{countSeq}\arabic{countSeq}, }
\newcommand*{\noSeq}{\stepcounter{countSeq}}
\newcommand*{\lastSeq}{and \stepcounter{countSeq}\arabic{countSeq} }
% This is used to place (eg) a partial model or proof as an item
% in a list. Without it, the item tag will be vertically centered next
% to the model or proof.
% – doesn't actually work yet –-
\newenvironment{solutioninlist}{}{}%{~\vspace{-1.6em}}{}
% ****************************************
% * TABLE OF CONTENTS, ETC. *
% ****************************************
\renewcommand{\preindexhook}{\label{app.index}}
\renewcommand{\thechapter}{\arabic{chapter}}
\renewcommand{\thesection}{\arabic{chapter}.\arabic{section}}
\renewcommand{\chaptermark}[1]{\markboth%
{\forallx}%
{\textrm{ch.~\thechapter\ \lowercase{#1}}}%
}
\renewcommand{\sectionmark}[1]{}
\renewenvironment{theindex}{%
\clearforchapter
\if@twocolumn
\@restonecolfalse
\else
\@restonecoltrue
\fi
\ifonecolindex
\onecolumn
\chapter{\indexname}
\preindexhook
\else
\setlength{\columnseprule}{\indexrule}%
\setlength{\columnsep}{\indexcolsep}%
\twocolumn
\chapter{\indexname}
\preindexhook
\fi
\indexmark
\thispagestyle{indextitlepagestyle}\parindent\z@
\parskip\z@ \@plus .3\p@\relax
\let\item\@idxitem}%
{\if@restonecol\onecolumn\else\twocolumn\fi}
% ****************************************
% * TRUTH TABLES *
% ****************************************
% This facilitates the typesetting of truth tables by
% effectively eliminating the intercolumn space.
% This allows truth tables with the Ts and Fs immediately
% below arbitrary connectives.
% An example follows:
%\begin{center}
%\begin{tabular}{c|c|@{\TTon}*{5}{c}@{\TToff}}
%$A$&$B$&$(A$&\eand&$B)$&\eif&A\\
%\midrule
% T & T & & T & & T & \\
% T & F & & F & & T & \\
% F & T & & F & & T & \\
% F & F & & T & & T &
%\bottomrule \end{tabular}
%\end{center}
%\newcommand*{\TTon}{\hspace{1.5em}\extracolsep{-1em}}
%\newcommand*{\TToff}{\extracolsep{-1em}\hspace{.3em}}
%
% Moving to Memoir breaks Magnus's elegant macro
% In the preceding column definition, I would offer instead:
%\begin{tabular}{c c | d e e e f}
% d for left-most columns, e for middle ones, f for right-most ones. The ensuing spacing is ok.
\newcolumntype{d}{ c@{\extracolsep{0.1em}}}
\newcolumntype{e}{@{\extracolsep{0.1em}}c@{\extracolsep{0.1em}}}
\newcolumntype{f}{@{\extracolsep{0.1em}}c }
\newcommand*{\TTbf}[1]{\textbf{ #1}}
% ****************************************
% * PROOFS *
% ****************************************
\usepackage{fitch}
\def\bi{\by{{\eiff}I}}%
\def\be{\by{{\eiff}E}}%
\def\ci{\by{{\eif}I}}%
\def\ce{\by{{\eif}E}}%
\def\Ai{\by{$\forall$I}}%
\def\Ae{\by{$\forall$E}}%
\def\Ei{\by{$\exists$I}}%
\def\Ee{\by{$\exists$E}}%
\def\ae{\by{{\eand}E}}%
\def\ai{\by{{\eand}I}}%
\def\oi{\by{{\eor}I}}%
\def\oe{\by{{\eor}E}}%
\def\nintro{\by{{\enot}I}}%
\def\nelim{\by{{\enot}E}}%
\def\ri{\by{{\ered}I}}% TB: reductio introduction
\def\re{\by{{\ered}E}}% TB: reductio elimination
\def\idi{\by{$=$I}}%
\def\ide{\by{$=$E}}%
\def\tnd{\by{TND}}% TB: tertium non datur
\def\dne{\by{{\enot\enot}E}}% TB: double negation elimination (Æ not derived rule)
\def\mt{\by{MT}}% TB: modus tollens (derived rule)
\def\ds{\by{DS}}% TB: disjunctive syllogism (a derived rule in Cambridge version)
\def\dem{\by{DeM}}% TB: De Morgan rule (derived rule)
\def\cq{\by{CQ}}% TB: conversion of quantifiers (derived rule)
\newenvironment{proof} % command for setting the proofs nicely
{\begin{list}{}{}\item$\begin{nd}}
{\end{nd}$\end{list}}
% ****************************************
% * STYLE OF THE BOOK *
% ****************************************
% TB: I moved from book to memoir and then radically changed the structuring. From the point of view of LaTeX, the book consists of 7 parts, containing roughly 5 chapters each. From the point of view of the user, the book consists of 7 chapters, containing roughly 5 sections each. This means a fair bit of internal redefinition of LaTeX code.
% Memoir page setup
% \setulmarginsandblock{30pt}{*}{1.5}
\midsloppy
\sloppybottom
\semiisopage[10]
\setheaderspaces{*}{2\onelineskip}{*}
\checkandfixthelayout
\makeatletter
\renewcommand{\@chapapp}{ } % TB: to prevent "chapter" appearing all over the place
\g@addto@macro\@floatboxreset\centering % to ensure figures are centered
\makeatother
\renewcommand\cftchapterfont{\normalfont} %TB: to make the sections (which LaTeX regards as chapters) small in the ToC
\renewcommand\cftchapterpagefont{\normalfont} %TB: to make the sections (which LaTeX regards as chapters) small in the ToC
\renewcommand\cftbeforechapterskip{0pt} %TB: to leave no gap between sections (which LaTeX regards as chapters) in the TOC
\renewcommand{\partname}{Chapter} %TB: to make the chapters (which LaTeX regards as parts) labelled "chapter"
\setlength{\headwidth}{\textwidth}
\renewcommand*{\partnamefont}{\normalfont\huge\bfseries\color{orange}}%
\renewcommand*{\partnumfont}{\normalfont\huge\bfseries\color{orange}}%
\renewcommand*{\parttitlefont}{\normalfont\HUGE\itshape\bfseries\color{orange}}
\renewcommand*{\printparttitle}[1]{{\color{orange} \par\hspace{1.5cm}\hrule\vskip\midchapskip\parttitlefont #1\par\hspace{1.5cm}\hrule}}
\aliaspagestyle{part}{empty}
\makepagestyle{forallxpage} %TB: design new page style
%\makeheadrule {forallxpage}{\textwidth}{\normalrulethickness} %TB: put rule beneath page header % Æ removed rule
\makeevenhead {forallxpage}{\small \thepage}{\small\scshape\leftmark}{} %TB: page header consists of section name and page
\makeoddhead {forallxpage}{}{\small\scshape\rightmark}{\small\thepage}
\makeatletter
\makepsmarks{forallxpage}{
\nouppercaseheads
\createmark {part} {left} {nonumber}{}{}
\createmark {chapter} {right} {shownumber}{§}{. \ }
} % Æ modified
\makeatother
\setcounter{tocdepth}{0} %TB: only chapters and sections to appear
\renewcommand{\thepart}{\arabic{part}} % TB: chapters (which LaTeX regards as parts) to be numbered
\renewcommand{\thechapter}{\arabic{chapter}} %TB: sections (which LaTeX regards as chapters) to be numbered
\renewcommand{\thesection}{\arabic{chapter}.\arabic{section}} %TB: subsections (which LaTeX regards as sections) to be n.m
\definecolor{liigray}{gray}{0.95} % Æ: used to color background factoidbox in gray
\definecolor{orange}{HTML}{CC6633} % Æ: used to color links in orange
\newcommand\myanswer[1]{\textcolor{blue}{#1}} % TB: puts model answers in blue
\chapterstyle{madsen} % Æ choice
\renewcommand{\chapnumfont}{\normalfont\dispfont\color{orange}}
\renewcommand*{\printchapternum}{%
\makebox[0pt][l]{\hspace{0.4em}\chapnumfont\thechapter}}
\renewcommand{\chapnamefont}{\normalfont\Huge\bfseries\color{orange}}
\renewcommand{\chaptitlefont}{\normalfont\Huge\bfseries\color{orange}}
\setlength{\columnsep}{2em} % Sets 2em space between columns when calling multicol
% TB: information originally in the main body; but it is style information, so I have included it here. Modified Æ
\hypersetup{pdfinfo={Title={forall x: Adelaide}, Author={Antony Eagle, Tim Button, and P.D. Magnus}, Subject={An open access introductory textbook in formal logic}, Keywords={truth-functional logic, propositional logic, predicate logic, first-order logic, natural deduction, Fitch, philosophical logic}}, %
% bookmarks={true}, %
colorlinks={true}, %
linkcolor={orange},
urlcolor={orange},
pdfdisplaydoctitle={true},
unicode={true},
pdfencoding={auto},
pdfborder={0 0 0},
plainpages={false}}
\urlstyle{tt}
% simulate parskip Æ
\setlength{\parindent}{0pt}
\nonzeroparskip
% ****************************************
% * DIAGRAMS IN TIKZ *
% ****************************************
% TB: I use diagrams in a few places, always using Tikz.
% A. To illustrate an argument for the truth table of the material conditional
% B. To draw graphs illustrating small finite interpretations.
% All these drawings are done using tikz
% AE: added a few more diagrams … Euler diagrams and directed graphs and syntactic trees
\usepackage{tikz}
\usetikzlibrary{arrows,positioning,shapes,matrix,calc,patterns}
\usepackage{tikz-qtree}
\tikzset{phantom_shape/.style={thick, fill=black!0, minimum width=30pt, minimum height=30pt}, % TB: renders the shape invisible
grey_shape/.style={thick, fill=black!20, draw, minimum width=30pt, minimum height=30pt}, % TB: renders a light grey shape with a black outline
white_shape/.style={thick, fill=black!0, draw, minimum width=30pt, minimum height=30pt} % TB: renders a white shape with a black outline
}