summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/syllogism
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/syllogism')
-rw-r--r--Master/texmf-dist/tex/latex/syllogism/syllogism.sty284
1 files changed, 284 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/syllogism/syllogism.sty b/Master/texmf-dist/tex/latex/syllogism/syllogism.sty
new file mode 100644
index 00000000000..a9172fba0db
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/syllogism/syllogism.sty
@@ -0,0 +1,284 @@
+%% Copyright 2008 by Nicolas Vaughan
+%% This program can be redistributed and/or modified under the terms
+%% of the LaTeX Project Public License Distributed from CTAN
+%% archives in directory macros/latex/base/lppl.txt; either
+%% version 1 of the License, or any later version.
+%% Author: Nicolas Vaughan
+%% e-mail: nivaca@gmail.com
+%% status: supported
+%% filedate 17/04/2008
+%
+\NeedsTeXFormat{LaTeX2e}
+\def\filedate{04/17/2008}
+\def\fileversion{v1.1}
+\typeout{Package syllogism \fileversion\space<\filedate>.}
+%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{syllogism}[\filedate\space\fileversion]
+\RequirePackage{calc}
+\RequirePackage{amssymb}
+\RequirePackage{ifthen}
+\RequirePackage{xspace}
+%
+\newlength{\SY@LenPA} % Length of longest premiss
+\newlength{\SY@LenPB} % Length of shortest premiss
+\newlength{\SY@LenC} % Length of the conclusion
+\newlength{\SY@LenLab} % Length of the label
+\newlength{\SY@LenRule} % Length of rule
+\newlength{\SY@HiRule} % Height of rule
+\newlength{\SY@LenAdjRule} % Adjust rule separation
+\newlength{\SY@LenSepRuleA} % Separation between premiss and rule
+\newlength{\SY@LenSepRuleB} % Separation between rule and conclusion
+\newlength{\SY@LenSepA} % Separation above syllogism
+\newlength{\SY@LenSepB} % Separation below syllogism
+\newlength{\SY@DeltaC} % Added to rule in case the longest it the conclusion
+\newlength{\SY@SpLabel} % Space between label and syllogism
+\newlength{\SY@SpConEG} % Space between conclusion and Ergo-Sign
+\newlength{\SY@Pre} % Space between left margin and label
+\newlength{\SY@LenBefSyl} % Stores the total length before the premisses
+\newlength{\SY@availSpace} % Stores the available width for premisses
+\newlength{\SY@prSkip} % Premiss skip
+\newlength{\SY@maxPLen} % Length of widest premiss or conclusion
+\newlength{\SY@tempindent}
+\newif\if@SYParam\@SYParamfalse % Boolean for optional argument
+\newif\if@SYpCtooW\@SYpCtooWfalse % If the conclusion is too wide
+%
+%%%%%%%%%%%%%%%%%%%%%%%% Defaults %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\setlength{\SY@LenPA}{\z@}
+\setlength{\SY@LenPB}{\z@}
+\setlength{\SY@LenC}{\z@}
+\setlength{\SY@maxPLen}{\z@}
+\setlength{\SY@LenAdjRule}{.6ex}
+\setlength{\SY@LenSepA}{\baselineskip}
+\setlength{\SY@LenSepB}{\baselineskip}
+\setlength{\SY@HiRule}{.5pt}
+\setlength{\SY@LenSepRuleB}{2pt}
+\setlength{\SY@LenSepRuleA}{2pt}
+\setlength{\SY@DeltaC}{1ex}
+\setlength{\SY@SpLabel}{1em}
+\setlength{\SY@Pre}{2em}
+\setlength{\SY@SpConEG}{2em}
+\setlength{\SY@prSkip}{1ex}
+%
+\def\SY@PuncPA{;} % Punctuation after first premiss
+\def\SY@PuncPB{.} % Punctuation after first premiss
+\def\SY@PuncC{.} % Punctuation after conclusion
+\def\SY@ErgoSign{$\therefore$} % three-dot sign after conclusion (needs amssymb)
+%
+\newcounter{c:syl} % Counter of syllogisms, if required
+\setcounter{c:syl}{1}
+\newcommand{\syl}{(S\arabic{c:syl})\xspace}
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%% Package Options %%%%%%%%%%%%%%%%%%%%%%%%%%
+\DeclareOption{spanish}{%
+ \def\SY@Sed{pero\ } % Syncategorematic before second premiss
+ \def\SY@Ergo{Por lo tanto,\ } % Syncategorematic before conclusion
+ }
+\DeclareOption{english}{%
+ \def\SY@Sed{but\ } % Syncategorematic before second premiss
+ \def\SY@Ergo{Therefore\ } % Syncategorematic before conclusion
+ }
+\DeclareOption{latin1}{%
+ \def\SY@Sed{sed\ } % Syncategorematic before second premiss
+ \def\SY@Ergo{Ergo\ } % Syncategorematic before conclusion
+ }
+\DeclareOption{latin2}{%
+ \def\SY@Sed{sed\ } % Syncategorematic before second premiss
+ \def\SY@Ergo{Igitur\ } % Syncategorematic before conclusion
+ }
+\ExecuteOptions{english}% Default
+\ProcessOptions*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Macros %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\newcommand{\setpresyl}% Command for changing \SY@Pre
+ [1]{\setlength{\SY@Pre}{#1}}
+%
+\newcommand{\setsyllabel}% Command for changing \SY@SpLabel
+ [1]{\setlength{\SY@SpLabel}{#1}}
+%
+\newcommand{\setsylrh}% Command for changing \SY@HiRule
+ [1]{\setlength{\SY@HiRule}{#1}}
+%
+\newcommand{\setsylsepa}% Command for changing \SY@LenSepA
+ [1]{\setlength{\SY@LenSepA}{#1}}
+%
+\newcommand{\setsylsepb}% Command for changing \SY@LenSepB
+ [1]{\setlength{\SY@LenSepB}{#1}}
+%
+\newcommand{\setsylsep}% Command for changing BOTH \SY@LenSepA and \SY@LenSepB
+ [1]{\setlength{\SY@LenSepA}{#1}%
+ \setlength{\SY@LenSepB}{#1}}
+%
+%
+\newcommand{\setsylergo}%
+ [1]{\def\SY@Ergo{#1\ }}
+%
+\newcommand{\setsylsed}%
+ [1]{\def\SY@Sed{#1\ }}
+%
+\newcommand{\setsylpuncpa}%
+ [1]{\def\SY@PuncPA{#1}}
+%
+\newcommand{\setsylpuncpb}%
+ [1]{\def\SY@PuncPB{#1}}
+%
+\newcommand{\setsylpuncc}%
+ [1]{\def\SY@PuncC{#1}}
+%
+\newcommand{\setsylergosign}%
+ [1]{\def\SY@ErgoSign{#1}}
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Basic syllogism %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\def\syllog{%
+ \@ifnextchar[%]
+ {\@SYParamtrue\@syllog}
+ {\@syllog[]}}
+\def\@syllog[#1]#2#3#4{%
+ \setlength{\SY@tempindent}{\parindent}%
+ \setlength{\parindent}{\z@}%
+ %
+ \settowidth{\SY@LenPA}{#2}
+ \settowidth{\SY@LenPB}{#3}
+ \settowidth{\SY@LenC}{#4}
+ \addtolength{\SY@LenC}{\widthof{\SY@ErgoSign}}%
+ \addtolength{\SY@LenC}{\SY@SpConEG}%
+ %
+ \if@SYParam%
+ \setlength{\SY@LenLab}{\widthof{#1}}%
+ \setlength{\SY@LenBefSyl}{\SY@Pre}%
+ \addtolength{\SY@LenBefSyl}{\SY@LenLab}%
+ \addtolength{\SY@LenBefSyl}{\SY@SpLabel}%
+ \else%
+ \setlength{\SY@LenBefSyl}{\SY@Pre}%
+ \fi%
+ %
+ \setlength{\SY@availSpace}{\textwidth-\SY@LenBefSyl}
+ %
+ \ifdim\SY@LenPA>\SY@availSpace%
+ \setlength{\SY@LenPA}{\textwidth-\SY@LenBefSyl}%
+ \else%
+ \setlength{\SY@prSkip}{\z@}%
+ \fi
+ \ifdim\SY@LenPB>\SY@availSpace%
+ \setlength{\SY@LenPB}{\textwidth-\SY@LenBefSyl}%
+ \fi%
+ \ifdim\SY@LenC>\SY@availSpace%
+ \setlength{\SY@LenC}{\textwidth-\SY@LenBefSyl}%
+ \fi%
+ \def\@SYLpropA{\parbox{\SY@LenPA}{#2}}%
+ \def\@SYLpropB{\parbox{\SY@LenPB}{#3}}%
+ \def\@SYLpropC{\parbox{\SY@LenC}{#4\hspace{\SY@SpConEG}\SY@ErgoSign}}%
+ %
+ \setlength{\SY@LenRule}{%
+ \maxof{\maxof{\maxof{\SY@LenPA}{\SY@LenPB}}{\maxof{\SY@LenPA}{\SY@LenC}}}%
+ {\maxof{\SY@LenPB}{\SY@LenC}}%
+ }%
+ %
+ \par\vspace{\SY@LenSepA}%
+ \if@SYParam%
+ \hspace{\SY@Pre}#1\hspace{\SY@SpLabel}%
+ \else%
+ \hspace{\SY@Pre}%
+ \fi%
+ \parbox{\SY@availSpace}%
+ {%
+ \@SYLpropA\par%
+ \vspace{\SY@prSkip}%
+ \@SYLpropB\par\nointerlineskip%
+ \vspace{\SY@LenSepRuleA}%
+ \rule{\SY@LenRule}{\SY@HiRule}\par\nointerlineskip%
+ \vspace{\SY@LenSepRuleB}%
+ \@SYLpropC\\%
+ }%
+ \par\vspace{\SY@LenSepB}%
+ \setlength{\parindent}{\SY@tempindent}%
+ }%
+
+%%%%%%%%%%%%%%%%%%%%%%%%%% Basic syllogism with counter %%%%%%%%%%%%%%%%%%%%%%%%%
+\newcommand{\syllogC}[3]{%
+ \syllog[\syl]{#1}{#2}{#3}
+ \stepcounter{c:syl}%
+ }%
+
+%%%%%%%%%%%%%%%%%%%%%%%%% Syllogism with text added %%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\def\syllogTA{%
+ \@ifnextchar[%]
+ {\@SYParamtrue\@syllogTA}
+ {\@syllogTA[]}}
+\def\@syllogTA[#1]#2#3#4{%
+ {\parindent\z@ \leftmargin\z@ \rightmargin\z@
+ %
+ \settowidth{\SY@LenPA}{#2}
+ \addtolength{\SY@LenPA}{\widthof{\SY@PuncPA}}
+ \settowidth{\SY@LenPB}{#3}
+ \addtolength{\SY@LenPB}{\widthof{\SY@Sed}}
+ \addtolength{\SY@LenPB}{\widthof{\SY@PuncPB}}
+ \settowidth{\SY@LenC}{#4}
+ \addtolength{\SY@LenC}{\widthof{\SY@Ergo}}
+ \addtolength{\SY@LenC}{\widthof{\SY@PuncC}}
+ \addtolength{\SY@LenC}{\widthof{\SY@ErgoSign}}
+ \addtolength{\SY@LenC}{\SY@SpConEG}
+ %
+ \if@SYParam
+ \settowidth{\SY@LenLab}{#1}
+ \setlength{\SY@LenBefSyl}{\SY@Pre + \SY@LenLab + \SY@SpLabel}
+ \else
+ \setlength{\SY@LenBefSyl}{\SY@Pre}
+ \fi
+ %
+ \setlength{\SY@availSpace}{\textwidth}
+ \advance\SY@availSpace -\SY@LenBefSyl
+ \advance\SY@availSpace -1.3ex
+ \ifdim\SY@LenPA>\SY@availSpace
+ \setlength{\SY@LenPA}{\textwidth - \SY@LenBefSyl}
+ \else
+ \setlength{\SY@prSkip}{\z@}
+ \fi
+ \ifdim\SY@LenPB>\SY@availSpace
+ \setlength{\SY@LenPB}{\textwidth - \SY@LenBefSyl}
+ \fi
+ \ifdim\SY@LenC>\SY@availSpace
+ \setlength{\SY@LenC}{\SY@availSpace}
+ \@SYpCtooWtrue
+ \else
+ \@SYpCtooWfalse
+ \fi%
+ \def\@SYLpropA{#2\SY@PuncPA}
+ \def\@SYLpropB{\SY@Sed#3\SY@PuncPB}
+ \def\@SYLpropC{\SY@Ergo#4\SY@PuncC\hspace{\SY@SpConEG}\SY@ErgoSign}
+ %
+ \if@SYpCtooW
+ \relax
+ \else
+ \addtolength{\SY@LenC}{\SY@DeltaC}
+ \fi
+ %
+ \setlength{\SY@LenRule}{%
+ \maxof{\maxof{\maxof{\SY@LenPA}{\SY@LenPB}}{\maxof{\SY@LenPA}{\SY@LenC}}}%
+ {\maxof{\SY@LenPB}{\SY@LenC}}%
+ }%
+ %
+ \par\vspace{\SY@LenSepA}%
+ \if@SYParam%
+ \hspace{\SY@Pre}#1\hspace{\SY@SpLabel}%
+ \else%
+ \hspace{\SY@Pre}%
+ \fi%
+ \begin{minipage}{\SY@LenRule}
+ \begin{list}{}
+ {%
+ \setlength{\parsep}{\z@}
+ \setlength{\itemsep}{\z@}
+ \addtolength{\leftmargin}{-1.5em}
+ \setlength{\itemindent}{-1ex}
+ \setlength{\listparindent}{\itemindent}
+ }
+ \item \@SYLpropA
+ \item \@SYLpropB%
+ \vspace*{-1ex}
+ \item \rule{\SY@LenRule}{\SY@HiRule}
+ \item \@SYLpropC
+ \end{list}
+ \end{minipage}
+ \par\vspace{\SY@LenSepB}%
+ }%parindent
+}% \ No newline at end of file