summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/syllogism
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2008-10-30 23:55:15 +0000
committerKarl Berry <karl@freefriends.org>2008-10-30 23:55:15 +0000
commit59043f5dcffdd257e2a64806a6238094a7df7231 (patch)
treebcf1446dcc59526e569f1a49066267cc91db3185 /Master/texmf-dist/tex/latex/syllogism
parentc30072203e5def2ebff53ccd203554e6eca0b311 (diff)
syllogism update (29oct08)
git-svn-id: svn://tug.org/texlive/trunk@11131 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/syllogism')
-rw-r--r--Master/texmf-dist/tex/latex/syllogism/syllogism.sty189
1 files changed, 113 insertions, 76 deletions
diff --git a/Master/texmf-dist/tex/latex/syllogism/syllogism.sty b/Master/texmf-dist/tex/latex/syllogism/syllogism.sty
index a9172fba0db..f12928789e1 100644
--- a/Master/texmf-dist/tex/latex/syllogism/syllogism.sty
+++ b/Master/texmf-dist/tex/latex/syllogism/syllogism.sty
@@ -6,11 +6,11 @@
%% Author: Nicolas Vaughan
%% e-mail: nivaca@gmail.com
%% status: supported
-%% filedate 17/04/2008
+%% filedate 25/10/2008
%
\NeedsTeXFormat{LaTeX2e}
-\def\filedate{04/17/2008}
-\def\fileversion{v1.1}
+\def\filedate{25/10/2008}
+\def\fileversion{v1.2}
\typeout{Package syllogism \fileversion\space<\filedate>.}
%
\NeedsTeXFormat{LaTeX2e}
@@ -25,40 +25,38 @@
\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@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@SpLabel} % Hspace between label and syllogism
+\newlength{\SY@SpConEG} % Hspace between conclusion and Ergo-Sign
+\newlength{\SY@Pre} % Hspace 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@LenPA}{\z@}% Used to store the length of 1st premiss
+\setlength{\SY@LenPB}{\z@}% Used to store the length of 2nd premiss
+\setlength{\SY@LenC}{\z@}% Used to store the length of conclusion
+\setlength{\SY@maxPLen}{\z@} % Used to store the available length
+\setlength{\SY@LenSepA}{\baselineskip}% V-space before syllogism
+\setlength{\SY@LenSepB}{\baselineskip}% V-space after syllogism
+\setlength{\SY@HiRule}{.3pt}% `Height' of the rule
+%
+\setlength{\SY@LenAdjRule}{-1ex}% Adjust height of rule
+%
\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
@@ -71,37 +69,37 @@
%
%%%%%%%%%%%%%%%%%%%%%%%%%% Package Options %%%%%%%%%%%%%%%%%%%%%%%%%%
\DeclareOption{spanish}{%
- \def\SY@Sed{pero\ } % Syncategorematic before second premiss
- \def\SY@Ergo{Por lo tanto,\ } % Syncategorematic before conclusion
+ \def\SY@Sed{pero\ } % Syncategorema before second premiss
+ \def\SY@Ergo{Por lo tanto,\ } % Syncategorema before conclusion
}
\DeclareOption{english}{%
- \def\SY@Sed{but\ } % Syncategorematic before second premiss
- \def\SY@Ergo{Therefore\ } % Syncategorematic before conclusion
+ \def\SY@Sed{but\ } % Syncategorema before second premiss
+ \def\SY@Ergo{Therefore\ } % Syncategorema before conclusion
}
\DeclareOption{latin1}{%
- \def\SY@Sed{sed\ } % Syncategorematic before second premiss
- \def\SY@Ergo{Ergo\ } % Syncategorematic before conclusion
+ \def\SY@Sed{sed\ } % Syncategorema before second premiss
+ \def\SY@Ergo{Ergo\ } % Syncategorema before conclusion
}
\DeclareOption{latin2}{%
- \def\SY@Sed{sed\ } % Syncategorematic before second premiss
- \def\SY@Ergo{Igitur\ } % Syncategorematic before conclusion
+ \def\SY@Sed{sed\ } % Syncategorema before second premiss
+ \def\SY@Ergo{Igitur\ } % Syncategorema before conclusion
}
\ExecuteOptions{english}% Default
\ProcessOptions*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Macros %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\newcommand{\setpresyl}% Command for changing \SY@Pre
+\newcommand{\setpresyl}% Command for changing h-space before the label
[1]{\setlength{\SY@Pre}{#1}}
%
-\newcommand{\setsyllabel}% Command for changing \SY@SpLabel
+\newcommand{\setsyllabel}% Command for changing h-space after the label
[1]{\setlength{\SY@SpLabel}{#1}}
%
-\newcommand{\setsylrh}% Command for changing \SY@HiRule
+\newcommand{\setsylrh}% Command for changing the `height' the the rule
[1]{\setlength{\SY@HiRule}{#1}}
%
-\newcommand{\setsylsepa}% Command for changing \SY@LenSepA
+\newcommand{\setsylsepa}% Command for changing v-space before the syl.
[1]{\setlength{\SY@LenSepA}{#1}}
%
-\newcommand{\setsylsepb}% Command for changing \SY@LenSepB
+\newcommand{\setsylsepb}% Command changing v-space after the syl.
[1]{\setlength{\SY@LenSepB}{#1}}
%
\newcommand{\setsylsep}% Command for changing BOTH \SY@LenSepA and \SY@LenSepB
@@ -127,6 +125,11 @@
\newcommand{\setsylergosign}%
[1]{\def\SY@ErgoSign{#1}}
%
+\newcommand{\@SYRestoreBooleans}{%
+ \@SYParamfalse
+ \@SYpCtooWfalse
+ }
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Basic syllogism %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\syllog{%
\@ifnextchar[%]
@@ -134,7 +137,7 @@
{\@syllog[]}}
\def\@syllog[#1]#2#3#4{%
\setlength{\SY@tempindent}{\parindent}%
- \setlength{\parindent}{\z@}%
+ \parindent\z@%
%
\settowidth{\SY@LenPA}{#2}
\settowidth{\SY@LenPB}{#3}
@@ -142,7 +145,7 @@
\addtolength{\SY@LenC}{\widthof{\SY@ErgoSign}}%
\addtolength{\SY@LenC}{\SY@SpConEG}%
%
- \if@SYParam%
+ \if@SYParam% If optional parameter is provided...
\setlength{\SY@LenLab}{\widthof{#1}}%
\setlength{\SY@LenBefSyl}{\SY@Pre}%
\addtolength{\SY@LenBefSyl}{\SY@LenLab}%
@@ -153,10 +156,9 @@
%
\setlength{\SY@availSpace}{\textwidth-\SY@LenBefSyl}
%
+ % Algorithm to check longest proposition -----------------------------
\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}%
@@ -164,35 +166,53 @@
\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}}%
%
+ % Define the propositions -----------------------------------------------
+ \def\@SYLpropA{#2}%
+ \def\@SYLpropB{#3\SY@PuncPB}%
+ \def\@SYLpropC{#4\hspace{\SY@SpConEG}\SY@ErgoSign}%
+ %
+ \if@SYpCtooW
+ \relax
+ \else
+ \addtolength{\SY@LenC}{\SY@DeltaC}
+ \fi
+ % Set the rule's length ----------------------------------------------
\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%
+ % Construction of the Syllogism ----------------------------------------
+ \par\vspace{\SY@LenSepA}% V-space before the syllogism
+ \if@SYParam% Conditional H-space before syllogism
\hspace{\SY@Pre}#1\hspace{\SY@SpLabel}%
- \else%
+ \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}%
+ %
+ \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*{\SY@LenAdjRule}
+ \item \rule{\SY@LenRule}{\SY@HiRule}
+ \item \@SYLpropC
+ \end{list}
+ \end{minipage}
+ \par\vspace{\SY@LenSepB}% V-space after the syllogism
+ %
+ \setlength{\parindent}{\SY@tempindent}% Restore default indent
+ \@SYRestoreBooleans% Restore booleans
}%
-
+%
%%%%%%%%%%%%%%%%%%%%%%%%%% Basic syllogism with counter %%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\syllogC}[3]{%
\syllog[\syl]{#1}{#2}{#3}
@@ -205,7 +225,8 @@
{\@SYParamtrue\@syllogTA}
{\@syllogTA[]}}
\def\@syllogTA[#1]#2#3#4{%
- {\parindent\z@ \leftmargin\z@ \rightmargin\z@
+ \setlength{\SY@tempindent}{\parindent}%
+ \parindent\z@%
%
\settowidth{\SY@LenPA}{#2}
\addtolength{\SY@LenPA}{\widthof{\SY@PuncPA}}
@@ -218,30 +239,35 @@
\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
+ \if@SYParam% If optional parameter is provided...
+ \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}
\advance\SY@availSpace -\SY@LenBefSyl
\advance\SY@availSpace -1.3ex
+ %
+ % Algorithm to check longest proposition -----------------------------
\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
+ % Is the conclusion too wide? -----------------------------------------
\ifdim\SY@LenC>\SY@availSpace
\setlength{\SY@LenC}{\SY@availSpace}
\@SYpCtooWtrue
\else
\@SYpCtooWfalse
\fi%
+ % Define the propositions -----------------------------------------------
\def\@SYLpropA{#2\SY@PuncPA}
\def\@SYLpropB{\SY@Sed#3\SY@PuncPB}
\def\@SYLpropC{\SY@Ergo#4\SY@PuncC\hspace{\SY@SpConEG}\SY@ErgoSign}
@@ -252,17 +278,20 @@
\addtolength{\SY@LenC}{\SY@DeltaC}
\fi
%
+ % Set the rule's length ----------------------------------------------
\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%
+ % Construction of the Syllogism ----------------------------------------
+ \par\vspace{\SY@LenSepA}% V-space before the syllogism
+ \if@SYParam% Conditional H-space before syllogism
\hspace{\SY@Pre}#1\hspace{\SY@SpLabel}%
- \else%
+ \else%
\hspace{\SY@Pre}%
\fi%
+ %
\begin{minipage}{\SY@LenRule}
\begin{list}{}
{%
@@ -272,13 +301,21 @@
\setlength{\itemindent}{-1ex}
\setlength{\listparindent}{\itemindent}
}
- \item \@SYLpropA
+ \item \@SYLpropA%
\item \@SYLpropB%
- \vspace*{-1ex}
- \item \rule{\SY@LenRule}{\SY@HiRule}
- \item \@SYLpropC
+ \vspace*{\SY@LenAdjRule}%
+ \item \rule{\SY@LenRule}{\SY@HiRule}%
+ \item \@SYLpropC%
\end{list}
\end{minipage}
- \par\vspace{\SY@LenSepB}%
- }%parindent
-}% \ No newline at end of file
+ \par\vspace{\SY@LenSepB}% V-space after the syllogism
+ %
+ \setlength{\parindent}{\SY@tempindent}% Restore default indent
+ \@SYRestoreBooleans% Restore booleans
+}%
+
+%%%%%%%%%%%%%%%%%%%% Syllogism with text added and counter %%%%%%%%%%%%%%%%%%%%%
+\newcommand{\syllogTAC}[3]{%
+ \syllogTA[\syl]{#1}{#2}{#3}
+ \stepcounter{c:syl}%
+ }%