summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/philex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-04-15 17:06:54 +0000
committerKarl Berry <karl@freefriends.org>2010-04-15 17:06:54 +0000
commitb96443cad2d528aab786260f3a4a30ff1c6d94c1 (patch)
treeb6b3e7cb0e060c6c6cfa3dac9a41e2d24c29297d /Master/texmf-dist/tex/latex/philex
parent440f3a0a24a2061ba24309a1c5538be6ecd4e74a (diff)
philex update (14apr10)
git-svn-id: svn://tug.org/texlive/trunk@17879 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/philex')
-rw-r--r--Master/texmf-dist/tex/latex/philex/philex.sty384
1 files changed, 332 insertions, 52 deletions
diff --git a/Master/texmf-dist/tex/latex/philex/philex.sty b/Master/texmf-dist/tex/latex/philex/philex.sty
index 24f14658ce1..1561ef4ba18 100644
--- a/Master/texmf-dist/tex/latex/philex/philex.sty
+++ b/Master/texmf-dist/tex/latex/philex/philex.sty
@@ -1,23 +1,71 @@
-%This is a small package with additions to Wolfgang Sternefeld's linguex package. It provides extended functions for cross-referencing and repeating numbered and named sentences and some additional formatting options.
-%Author: Peter Pagin (with contributions by Robin Fairbairns).
+%This is a small package with additions to Wolfgang Sternefeld's linguex package (adapted to version 4.1). It provides extended functions for cross-referencing and repeating numbered and named sentences, additional formatting options and hyperref support.
+%Author: Peter Pagin (with a contribution by Robin Fairbairns).
%email: peter.pagin@philosophy.su.se
-%Date: 2007.12.04
-%Version: 0.6
+%Date: 2010.04.14
+%Version: 1.0
+
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{philex}
+
+
+\RequirePackage{xspace,calc,cgloss4e,linguex}
+\newif\ifhyperref
+\hyperreffalse
+
+\newif\ifoldpunct
+\oldpunctfalse
+
+\DeclareOption{oldpunct}{\oldpuncttrue}
+\DeclareOption{hyper}{\hyperreftrue}
+\ProcessOptions
+
+%Spacing and formatting commands
+\setlength{\Exredux}{-\baselineskip}
+\renewcommand{\philarge}{3em}
+\renewcommand{\philmiddle}{2em}
+\renewcommand{\philsmall}{1em}
+\renewcommand{\phlabelwidth}[1]{\renewcommand{\philarge}{#1}
+\renewcommand{\philmiddle}{#1}
+\renewcommand{\philsmall}{#1}}
+\renewcommand{\phlabeldefault}{\renewcommand{\philarge}{3em}
+\renewcommand{\philmiddle}{3em}
+\renewcommand{\philsmall}{3em}}
+\newcommand{\phlabelsep}[1]{\setlength{\Exlabelsep}{#1}}
+\newcommand{\phlabelsepdefault}{\setlength{\Exlabelsep}{1.3em}}
+\newcommand{\firstphildash}{}
+\newcommand{\secondphildash}{}
+\newcommand{\phildashes}[2]{\renewcommand{\firstphildash}{#1}\renewcommand{\secondphildash}{#2}}
+\newcommand{\subettan}{\alph}
-\RequirePackage{linguex,calc}
%Controlling brackets,lowercase and full stop.
-\newcommand{\p}{.}
-\newcommand{\q}{\renewcommand{\p}{}}
-\newcommand{\s}{\renewcommand{\p}{.}}
-\newcommand{\km}{\renewcommand{\p}{,}}
-\newcommand{\qt}{\renewcommand{\pt}{}}
-\newcommand{\pt}{.}
-\newcommand{\stp}{\renewcommand{\pt}{.}}
-\newcommand{\kmt}{\renewcommand{\pt}{,}}
+\newcommand{\philpunct}{}
+\newcommand{\philempty}{\renewcommand{\philpunct}{}}
+\newcommand{\philfullstop}{\renewcommand{\philpunct}{.}}
+\newcommand{\philcomma}{\renewcommand{\philpunct}{,}}
+\newcommand{\philexclaim}{\renewcommand{\philpunct}{!}}
+\newcommand{\philquestion}{\renewcommand{\philpunct}{?}}
+\newcommand{\philsubpunct}{}
+\newcommand{\philsubempty}{\renewcommand{\philsubpunct}{}}
+\newcommand{\philsubstop}{\renewcommand{\philsubpunct}{.}}
+\newcommand{\philsubcomma}{\renewcommand{\philsubpunct}{,}}
+\newcommand{\philsubexclaim}{\renewcommand{\philsubpunct}{!}}
+\newcommand{\philsubquestion}{\renewcommand{\philsubpunct}{?}}
+\ifoldpunct%
+\newcommand{\p}{\philpunct}%
+\newcommand{\q}{\philempty}%
+\newcommand{\s}{\philfullstop}%
+\newcommand{\km}{\philcomma}%
+\newcommand{\pt}{\philsubpunct}%
+\newcommand{\qt}{\philsubempty}%
+\newcommand{\stp}{\philsubstop}%
+\newcommand{\kmt}{\philsubcomma}\fi
\newcommand{\lebrack}{(}
-\newcommand{\ribrack}{)}\def\broff{\def\lebrack{}\def\ribrack{}}
+\newcommand{\ribrack}{)}
+\def\broff{\def\lebrack{}\def\ribrack{}}
\def\bron{\def\lebrack{(}\def\ribrack{)}}
+\newcommand{\philbrackets}[2]{\renewcommand{\lebrack}{#1}\renewcommand{\ribrack}{#2}}
\newcounter{bpa}
\newcounter{bpb}
\newcounter{bpc}
@@ -30,44 +78,256 @@
\renewcommand{\theExNo}{\arabic{ExNo}}
\renewcommand{\theSubExNo}{\theExNo\alph{SubExNo}}
\renewcommand{\theSubSubExNo}{\theSubExNo\roman{SubSubExNo}}
-\newcommand{\centro}{\textwidth-(\Exindent*2+\Exlabelsep*2+\Exlabelwidth*2)}
-\newcommand{\hcentro}{\textwidth-(\Exindent+\Exlabelsep+\Exlabelwidth)}
+\newcommand{\ncentro}{\columnwidth-(\Exindent+\Exlabelsep+\Exlabelwidth)}
+\newcommand{\wcentro}{\columnwidth-(\Exindent*2+\Exlabelsep*2+\Exlabelwidth*2)}
+\newcommand{\centro}{\wcentro}
+\newcommand{\narrowcenter}{\renewcommand{\centro}{\ncentro}}
+\newcommand{\widecenter}{\renewcommand{\centro}{\wcentro}}
%Top-level numbered sentence:
-\newcommand{\lb}[3][n]{\ifdim\lastskip=.66\baselineskip\vspace{-1.2\baselineskip}\fi\immediate\write\@auxout{\unexpanded{\expandafter\gdef\csname#2r\endcsname{#3}\expandafter\gdef\csname#2\endcsname{\ref{#2}}\expandafter\gdef\csname#2p\endcsname{\MakeLowercase#3}}}\expandafter\providecommand\expandafter{\csname#2r\endcsname}{#3}\expandafter\providecommand\expandafter{\csname#2\endcsname}{\ref{#2}}\expandafter\providecommand\expandafter{\csname#2p\endcsname}{\MakeLowercase#3}\ex. \label{#2} \if#1c \setlength{\abovedisplayskip}{1ex}\setlength{\belowdisplayskip}{1ex}\parbox{\centro}{\centering #3\p} \else #3\p\fi\par}
+\newcommand{\lb}[3][n]{
+\ifdim\lastskip=\Extopsep\vspace\Exredux\else \fi
+\immediate\write\@auxout{\unexpanded{\expandafter\gdef\csname#2r\endcsname{#3}\expandafter\gdef\csname#2\endcsname{\ref{#2}}
+\expandafter\gdef\csname#2p\endcsname{\MakeLowercase#3}}}
+\expandafter\providecommand\expandafter{\csname#2r\endcsname}{#3}
+\expandafter\providecommand\expandafter{\csname#2\endcsname}{\ref{#2}}\expandafter\providecommand\expandafter{\csname#2p\endcsname}{\MakeLowercase#3}
+\ifhyperref%
+\renewcommand{\theFnExNo}{\roman{FnExNo}}
+\ex. \label{#2} \if#1c \setlength{\abovedisplayskip}{1ex}
+\setlength{\belowdisplayskip}{2ex}%
+\parbox{\centro}{\centering \hypertarget{#2}{#3}\philpunct}\else \hypertarget{#2}{#3}\philpunct\fi\par
+\else
+\ex. \label{#2} \if#1c \setlength{\abovedisplayskip}{1ex}\setlength{\belowdisplayskip}{2ex}%
+\parbox{\centro}{\centering #3\philpunct}\else #3\philpunct\fi\par%
+\fi}
%Top-level named sentence:
-\newcommand{\lbp}[4][n]{\ifdim\lastskip=.66\baselineskip\vspace{-1.2\baselineskip}\fi\label{#2}\immediate\write\@auxout{\unexpanded{\expandafter\gdef\csname#2p\endcsname{\MakeLowercase#4}\expandafter\gdef\csname#2\endcsname{#3} \expandafter\gdef\csname#2r\endcsname{#4}}}\expandafter\providecommand\expandafter{\csname#2p\endcsname}{\MakeLowercase#4}\expandafter\providecommand\expandafter{\csname #2\endcsname}{#3} \expandafter\providecommand\expandafter{\csname#2r\endcsname}{#4}\ex.[\lebrack#3\ribrack\hspace{-1em}]\renewcommand{\theSubExNo}{\csname#2\endcsname\alph{SubExNo}} \if#1c \setlength{\abovedisplayskip}{1ex}\setlength{\belowdisplayskip}{1ex}\parbox{\centro}{\centering #4\p} \else #4\p\fi\par}
+\newcommand{\lbp}[4][n]{
+\ifdim\lastskip=\Extopsep\vspace{\Exredux}\fi
+\label{#2}
+\immediate\write\@auxout{\unexpanded{\expandafter\gdef\csname#2p\endcsname{\MakeLowercase#4}\expandafter\gdef\csname#2\endcsname{#3} \expandafter\gdef\csname#2r\endcsname{#4}}}
+\expandafter\providecommand\expandafter{\csname#2p\endcsname}{\MakeLowercase#4}
+\expandafter\providecommand\expandafter{\csname #2\endcsname}{#3}
+\expandafter\providecommand\expandafter{\csname#2r\endcsname}{#4}
+\ifhyperref
+\ex.[\hypertarget{#2}{\lebrack#3\ribrack}\hspace{-1em}]
+\renewcommand{\theExNo}{\csname#2\endcsname}
+\renewcommand{\theFnExNo}{\csname#2\endcsname}
+\if#1c \setlength{\abovedisplayskip}{1ex}\setlength{\belowdisplayskip}{2ex}\parbox{\centro}{\centering #4\philpunct} \else #4\philpunct\fi\par
+\else%
+\ex.[\lebrack#3\ribrack\hspace{-1em}]
+\renewcommand{\theExNo}{\csname#2\endcsname}
+\if#1c \setlength{\abovedisplayskip}{1ex}\setlength{\belowdisplayskip}{2ex}\parbox{\centro}{\centering #4\philpunct} \else #4\philpunct\fi\par
+\fi
+}
+
+
%Stand-alone sub-level initial sentence, sequence a:
-\newcommand{\lbpa}[3][n]{\ifdim\lastskip=.66\baselineskip\vspace{-1.2\baselineskip}\fi \refstepcounter{bpa}\label{#2}\immediate\write\@auxout{\unexpanded{\expandafter\gdef\csname#2p\endcsname{\MakeLowercase#3}\expandafter\gdef\csname #2r\endcsname{#3}\expandafter\gdef\csname #2\endcsname{\ref{#2}}}}\expandafter\providecommand\expandafter{\csname#2p\endcsname}{\MakeLowercase#3} \expandafter\providecommand\expandafter{\csname #2r\endcsname}{#3}\expandafter\providecommand\expandafter{\csname #2\endcsname}{\ref{#2}}\ex.[\lebrack\thebpa\ribrack\hspace{-1em}]\renewcommand{\theSubExNo}{\csname#2\endcsname\alph{SubExNo}} \if#1c \setlength{\abovedisplayskip}{1ex}\setlength{\belowdisplayskip}{1ex}\parbox{\centro}{\centering #3} \else #3\fi\par}
+\newcommand{\lbpa}[3][n]{
+\ifdim\lastskip=\Extopsep\vspace{\Exredux}\fi
+\refstepcounter{bpa}\label{#2}
+\immediate\write\@auxout{\unexpanded{\expandafter\gdef\csname#2p\endcsname{\MakeLowercase#3}
+\expandafter\gdef\csname#2\endcsname{\ref{#2}}
+\expandafter\gdef\csname#2r\endcsname{#3}}}
+\expandafter\providecommand\expandafter{\csname#2p\endcsname}{\MakeLowercase#3}
+\expandafter\providecommand\expandafter{\csname#2\endcsname}{\ref{#2}}
+\expandafter\providecommand\expandafter{\csname#2r\endcsname}{#3}
+\ifhyperref
+\ex.[\hypertarget{#2}{\thebpa}\hspace{-1em}]
+\renewcommand{\theExNo}{\csname#2\endcsname}
+\renewcommand{\theFnExNo}{\csname#2\endcsname}
+\if#1c \setlength{\abovedisplayskip}{1ex}\setlength{\belowdisplayskip}{2ex}\parbox{\centro}{\centering #3\philpunct} \else #3\fi\philpunct\par
+\else
+\ex.[\thebpa\hspace{-1em}]
+\renewcommand{\theSubExNo}{\csname#2\endcsname\subettan{SubExNo}}
+\if#1c \setlength{\abovedisplayskip}{1ex}\setlength{\belowdisplayskip}{2ex}\parbox{\centro}{\centering #3\philpunct} \else #3\fi\philpunct\par
+\fi
+}
+
%Stand-alone sub-level initial sentence, sequence b:
-\newcommand{\lbpb}[3][n]{\ifdim\lastskip=.66\baselineskip\vspace{-1.2\baselineskip}\fi \refstepcounter{bpb}\label{#2} \immediate\write\@auxout{\unexpanded{\expandafter\gdef\csname#2p\endcsname{\MakeLowercase#3}\expandafter\gdef\csname #2\endcsname{\ref{#2}} \expandafter\gdef\csname #2r\endcsname{#3}}}\expandafter\providecommand\expandafter{\csname#2p\endcsname}{\MakeLowercase#3}\expandafter\providecommand\expandafter{\csname #2\endcsname}{\ref{#2}} \expandafter\providecommand\expandafter{\csname #2r\endcsname}{#3}\ex.[\lebrack\thebpb\ribrack\hspace{-1em}]\label{#2}\renewcommand{\theSubExNo}{\csname#2\endcsname\alph{SubExNo}} \if#1c \setlength{\abovedisplayskip}{1ex}\setlength{\belowdisplayskip}{1ex}\parbox{\centro}{\centering #3} \else #3\fi\par}
+\newcommand{\lbpb}[3][n]{
+\ifdim\lastskip=\Extopsep\vspace{\Exredux}\fi
+\refstepcounter{bpb}\label{#2}
+\immediate\write\@auxout{\unexpanded{\expandafter\gdef\csname#2p\endcsname{\MakeLowercase#3}\expandafter\gdef\csname#2\endcsname{\ref{#2}} \expandafter\gdef\csname#2r\endcsname{#3}}}
+\expandafter\providecommand\expandafter{\csname#2p\endcsname}{\MakeLowercase#3}
+\expandafter\providecommand\expandafter{\csname #2\endcsname}{\ref{#2}}
+\expandafter\providecommand\expandafter{\csname#2r\endcsname}{#3}
+\ifhyperref
+\ex.[\hypertarget{#2}{\thebpb}\hspace{-1em}]
+\renewcommand{\theExNo}{\csname#2\endcsname}
+\renewcommand{\theFnExNo}{\csname#2\endcsname}
+\if#1c \setlength{\abovedisplayskip}{1ex}\setlength{\belowdisplayskip}{2ex}\parbox{\centro}{\centering #3\philpunct} \else #3\fi\philpunct\par
+\else
+\ex.[\thebpb\hspace{-1em}]
+\renewcommand{\theSubExNo}{\csname#2\endcsname\subettan{SubExNo}}
+\if#1c \setlength{\abovedisplayskip}{1ex}\setlength{\belowdisplayskip}{2ex}\parbox{\centro}{\centering #3\philpunct} \else #3\fi\philpunct\par
+\fi
+}
+
%Stand-alone sub-level initial sentence, sequence c:
-\newcommand{\lbpc}[3][n]{\ifdim\lastskip=.66\baselineskip\vspace{-1.2\baselineskip}\fi \refstepcounter{bpc}\label{#2} \immediate\write\@auxout{\unexpanded{\expandafter\gdef\csname#2p\endcsname{\MakeLowercase#3}\expandafter\gdef\csname #2\endcsname{\ref{#2}} \expandafter\gdef\csname #2r\endcsname{#3}}}\expandafter\providecommand\expandafter{\csname#2p\endcsname}{\MakeLowercase#3}\expandafter\providecommand\expandafter{\csname #2\endcsname}{\ref{#2}} \expandafter\providecommand\expandafter{\csname #2r\endcsname}{#3}\ex.[\lebrack\thebpc\ribrack\hspace{-1em}]\renewcommand{\theSubExNo}{\csname#2\endcsname\alph{SubExNo}} \if#1c \setlength{\abovedisplayskip}{1ex}\setlength{\belowdisplayskip}{1ex}\parbox{\centro}{\centering #3} \else #3\fi\par}
+\newcommand{\lbpc}[3][n]{
+\ifdim\lastskip=\Extopsep\vspace{\Exredux}\fi
+\refstepcounter{bpc}\label{#2}
+\immediate\write\@auxout{\unexpanded{\expandafter\gdef\csname#2p\endcsname{\MakeLowercase#3}\expandafter\gdef\csname#2\endcsname{\ref{#2}} \expandafter\gdef\csname#2r\endcsname{#3}}}
+\expandafter\providecommand\expandafter{\csname#2p\endcsname}{\MakeLowercase#3}
+\expandafter\providecommand\expandafter{\csname #2\endcsname}{\ref{#2}}
+\expandafter\providecommand\expandafter{\csname#2r\endcsname}{#3}
+\ifhyperref
+\ex.[\hypertarget{#2}{\thebpc}\hspace{-1em}]
+\renewcommand{\theExNo}{\csname#2\endcsname}
+\renewcommand{\theFnExNo}{\csname#2\endcsname}
+\if#1c \setlength{\abovedisplayskip}{1ex}\setlength{\belowdisplayskip}{2ex}\parbox{\centro}{\centering #3\philpunct} \else #3\fi \philpunct\par
+\else
+\ex.[\thebpc\hspace{-1em}]
+\renewcommand{\theSubExNo}{\csname#2\endcsname\subettan{SubExNo}}
+\if#1c \setlength{\abovedisplayskip}{1ex}\setlength{\belowdisplayskip}{2ex}\parbox{\centro}{\centering #3\philpunct} \else #3\fi\philpunct\par
+\fi
+}
-%Stand-alone sub-level initial sentence, sequence d:
-\newcommand{\lbpd}[3][n]{\ifdim\lastskip=.66\baselineskip\vspace{-1.2\baselineskip}\fi \refstepcounter{bpd}\label{#2} \immediate\write\@auxout{\unexpanded{\expandafter\gdef\csname#2p\endcsname{\MakeLowercase#3}\expandafter\gdef\csname #2\endcsname{\ref{#2}} \expandafter\gdef\csname #2r\endcsname{#3}}}\expandafter\providecommand\expandafter{\csname#2p\endcsname}{\MakeLowercase#3}\expandafter\providecommand\expandafter{\csname #2\endcsname}{\ref{#2}} \expandafter\providecommand\expandafter{\csname #2r\endcsname}{#3}\ex.[\lebrack\thebpd\ribrack\hspace{-1em}]\renewcommand{\theSubExNo}{\csname#2\endcsname\alph{SubExNo}} \if#1c \setlength{\abovedisplayskip}{1ex}\setlength{\belowdisplayskip}{1ex}\parbox{\centro}{\centering #3} \else #3\fi\par}
-%Top-level sentence with repeated and suffixed name or number:
-\newcommand{\lbu}[5][n]{\label{#2}\immediate\write\@auxout{\unexpanded{\expandafter\gdef\csname#2p\endcsname{\MakeLowercase#5}\expandafter\gdef\csname #2\endcsname{\csname#3\endcsname#4}\expandafter\gdef\csname #2r\endcsname{#5}}}\expandafter\providecommand\expandafter{\csname#2p\endcsname}{\MakeLowercase#5}\expandafter\providecommand\expandafter{\csname #2\endcsname}{\csname#3\endcsname#4}\expandafter\providecommand\expandafter{\csname #2r\endcsname}{#5}\ex.[(\csname#3\endcsname#4)\hspace{-1em}] \if#1c \setlength{\abovedisplayskip}{1ex}\setlength{\belowdisplayskip}{1ex}\parbox{\centro}{\centering #5\p} \else #5\p\fi\par}
+%Stand-alone sub-level initial sentence, sequence d:
+\newcommand{\lbpd}[3][n]{
+\ifdim\lastskip=\Extopsep\vspace{\Exredux}\fi
+\refstepcounter{bpd}\label{#2}
+\immediate\write\@auxout{\unexpanded{\expandafter\gdef\csname#2p\endcsname{\MakeLowercase#3}\expandafter\gdef\csname#2\endcsname{\ref{#2}} \expandafter\gdef\csname#2r\endcsname{#3}}}
+\expandafter\providecommand\expandafter{\csname#2p\endcsname}{\MakeLowercase#3}
+\expandafter\providecommand\expandafter{\csname #2\endcsname}{\ref{#2}}
+\expandafter\providecommand\expandafter{\csname#2r\endcsname}{#3}
+\ifhyperref
+\ex.[\hypertarget{#2}{\thebpd}\hspace{-1em}]
+\renewcommand{\theExNo}{\csname#2\endcsname}
+\renewcommand{\theFnExNo}{\csname#2\endcsname}
+\if#1c \setlength{\abovedisplayskip}{1ex}\setlength{\belowdisplayskip}{2ex}\parbox{\centro}{\centering #3\philpunct} \else #3\fi\philpunct\par
+\else
+\ex.[\thebpd\hspace{-1em}]
+\renewcommand{\theSubExNo}{\csname#2\endcsname\subettan{SubExNo}}
+\if#1c \setlength{\abovedisplayskip}{1ex}\setlength{\belowdisplayskip}{2ex}\parbox{\centro}{\centering #3\philpunct} \else #3\fi\philpunct\par
+\fi
+}
-%First sub-level sentence:
-\newcommand{\lba}[2]{\q\immediate\write\@auxout{\unexpanded{\expandafter\gdef\csname#1p\endcsname{\MakeLowercase#2}\expandafter\gdef\csname#1r\endcsname{#2} \expandafter\gdef\csname#1\endcsname{\ref{#1}}}} \expandafter\providecommand\csname#1p\endcsname{\MakeLowercase#2}\expandafter\providecommand\csname#1r\endcsname{#2} \expandafter\providecommand\csname#1\endcsname{\ref{#1}}\a.\label{#1}#2\pt}
-%Following sub-level sentence:
-\newcommand{\lbb}[2]{\immediate\write\@auxout{\unexpanded{\expandafter\gdef\csname #1p\endcsname{\MakeLowercase#2}\expandafter\gdef\csname #1r\endcsname{#2} \expandafter\gdef\csname #1\endcsname{\ref{#1}}}} \expandafter\gdef\csname #1p\endcsname{\MakeLowercase#2}\expandafter\gdef\csname #1r\endcsname{#2} \expandafter\gdef\csname #1\endcsname{\ref{#1}}\b. \label{#1}#2\pt}
+%Top-level sentence with repeated and suffixed name or number:
+\newcommand{\lbu}[5][n]{\ifdim\lastskip=\Extopsep\vspace{\Exredux}\fi
+\label{#2}
+\immediate\write\@auxout{\unexpanded{\expandafter\gdef\csname#2p\endcsname{\MakeLowercase#5}
+\expandafter\gdef\csname #2\endcsname{\csname#3\endcsname#4}
+\expandafter\gdef\csname #2r\endcsname{#5}}}
+\expandafter\providecommand\expandafter{\csname#2p\endcsname}{\MakeLowercase#5}
+\expandafter\providecommand\expandafter{\csname #2\endcsname}{\csname#3\endcsname#4}
+\expandafter\providecommand\expandafter{\csname #2r\endcsname}{#5}
+\ifhyperref
+\ex.[\lebrack\hypertarget{#2}{\csname#3\endcsname#4}\ribrack\hspace{-1em}]
+\renewcommand{\theExNo}{\csname#2\endcsname}
+\if#1c \setlength{\abovedisplayskip}{1ex}\setlength{\belowdisplayskip}{2ex}\parbox{\centro}{\centering #5\philpunct} \else #5\philpunct\fi\par
+\else
+\ex.[\lebrack\csname#3\endcsname#4\ribrack\hspace{-1em}]
+\renewcommand{\theExNo}{\csname#2\endcsname}
+\if#1c \setlength{\abovedisplayskip}{1ex}\setlength{\belowdisplayskip}{2ex}\parbox{\centro}{\centering #5\philpunct} \else #5\philpunct\fi\par \fi
+}
+
+%----------------- Sub-environments -------------------------------
+
+\newcommand{\philsemi}{;}
+
+\newcommand{\lba}[3][;]{\philempty
+\def\tempa{#1}
+\def\tempb{#1}
+\ifnum\theExDepth=0\def\tempc{\tempa}\fi
+\ifnum\theExDepth=1\def\tempc{\tempa} \else \ifnum \theExDepth=2\def\tempc{\tempb}\else\fi\fi
+\if \tempc\philsemi
+\immediate\write\@auxout{\unexpanded{\expandafter\gdef\csname#2p \endcsname{\MakeLowercase#3}\expandafter\gdef\csname#2r\endcsname{#3} \expandafter\gdef\csname#2\endcsname{\ref{#2}}}}
+\expandafter\providecommand\csname#2p\endcsname{\MakeLowercase#3}
+\expandafter\providecommand\csname#2r\endcsname{#3}
+\expandafter\providecommand\csname#2\endcsname{\ref{#3}}
+\a. \label{#2}#3\philsubpunct
+\else
+\immediate\write\@auxout{%
+\unexpanded{\expandafter\gdef\csname#2p\endcsname{\MakeLowercase#3}
+\expandafter\gdef\csname#2r\endcsname{#3}
+\expandafter\gdef\csname#2\endcsname{\theExNo#1}}}
+\ifnum\theExDepth=1 \renewcommand{\theSubExNo}{\theExNo#1}
+\else
+\ifnum\theExDepth=2 \renewcommand{\theSubSubExNo}{\theSubExNo\refdash#1} \else \fi\fi
+\expandafter\providecommand\csname#2p\endcsname{\MakeLowercase#3}
+\expandafter\providecommand\csname#2r\endcsname{#3}
+\expandafter\providecommand\csname#2\endcsname{\theExNo#1}
+\ifnum\theExDepth=1 \renewcommand{\theSubExNo}{\theExNo#1}\else
+\ifnum\theExDepth=2 \renewcommand{\theSubSubExNo}{\theSubExNo#1} \else \fi\fi
+\ifhyperref
+\a.[\hypertarget{#2}\lebrack#1\ribrack]\label{#2}#3\philsubpunct
+\else
+\a.[\lebrack#1\ribrack]\label{#2}#3\philsubpunct\fi
+\fi}
+
+
+\newcommand{\lbb}[3][;]{\philempty
+\def\tempa{#1}
+\def\tempb{#1}
+\ifnum\theExDepth=1\def\tempc{\tempa} \else \def\tempc{\tempb}\fi
+\if \tempc\philsemi
+\immediate\write\@auxout{\unexpanded{\expandafter\gdef\csname#2p \endcsname{\MakeLowercase#3}\expandafter\gdef\csname#2r\endcsname{#3} \expandafter\gdef\csname#2\endcsname{\ref{#2}}}}
+\expandafter\providecommand\csname#2p\endcsname{\MakeLowercase#3}
+\expandafter\providecommand\csname#2r\endcsname{#3}
+\expandafter\providecommand\csname#2\endcsname{\ref{#3}}
+ \b. \label{#2}#3\philsubpunct
+ \else \immediate\write\@auxout{\unexpanded{\expandafter\gdef\csname#2p \endcsname{\MakeLowercase#3}
+\expandafter\gdef\csname#2r\endcsname{#3}
+\expandafter\gdef\csname#2\endcsname{\theExNo#1}}}
+\ifnum\theExDepth=1 \renewcommand{\theSubExNo}{\theExNo#1}\else
+\ifnum\theExDepth=2 \renewcommand{\theSubSubExNo}{\theSubExNo#1} \else \fi\fi
+\expandafter\providecommand\csname#2p\endcsname{\MakeLowercase#3}
+\expandafter\providecommand\csname#2r\endcsname{#3}
+\expandafter\providecommand\csname#2\endcsname{\theExNo#1}
+\ifhyperref
+\b.[\hypertarget{#2}\lebrack#1\ribrack] \label{#2}#3\philsubpunct
+\else
+\b.[\lebrack#1\ribrack] \label{#2}#3\philsubpunct \fi
+\fi}
+
+\newcommand{\lbz}[3][;]{\philempty
+\def\tempa{#1}
+\def\tempb{#1}
+\ifnum\theExDepth=1\def\tempc{\tempa} \else \def\tempc{\tempb}\fi
+\if \tempc\philsemi
+\immediate\write\@auxout{\unexpanded{\expandafter\gdef\csname#2p \endcsname{\MakeLowercase#3}\expandafter\gdef\csname#2r\endcsname{#3} \expandafter\gdef\csname#2\endcsname{\ref{#2}}}}
+\expandafter\providecommand\csname#2p\endcsname{\MakeLowercase#3}
+\expandafter\providecommand\csname#2r\endcsname{#3}
+\expandafter\providecommand\csname#2\endcsname{\ref{#3}}
+ \b. \label{#2}#3\philsubpunct
+ \else \immediate\write\@auxout{\unexpanded{\expandafter\gdef\csname#2p \endcsname{\MakeLowercase#3}
+\expandafter\gdef\csname#2r\endcsname{#3}
+\expandafter\gdef\csname#2\endcsname{\theExNo-#1}}}
+\ifnum\theExDepth=1 \renewcommand{\theSubExNo}{\theExNo#1}\else
+\ifnum\theExDepth=2 \renewcommand{\theSubSubExNo}{\theSubExNo#1} \else \fi\fi
+\expandafter\providecommand\csname#2p\endcsname{\MakeLowercase#3}
+\expandafter\providecommand\csname#2r\endcsname{#3}
+\expandafter\providecommand\csname#2\endcsname{\theExNo#1}
+\ifhyperref
+\b.[\hypertarget{#2}\lebrack#1\ribrack] \label{#2}#3\philsubpunct
+\else
+\b.[\lebrack#1\ribrack] \label{#2}#3\philsubpunct \fi
+\fi
+\end{list}\addtocounter{ExDepth}{-1}\philsubempty}
-%Concluding sub-level sentence:
-\newcommand{\lbz}[2]{\immediate\write\@auxout{\unexpanded{\expandafter\gdef\csname #1p\endcsname{\MakeLowercase#2}\expandafter\gdef\csname #1r\endcsname{#2} \expandafter\gdef\csname #1\endcsname{\ref{#1}}}} \expandafter\gdef\csname #1p\endcsname{\MakeLowercase#2}\expandafter\gdef\csname #1r\endcsname{#2} \expandafter\gdef\csname #1\endcsname{\ref{#1}}\b. \label{#1}#2\pt\z.}
%Cross-reference
-\newcommand{\rf}[2][]{(\csname#2\endcsname#1)}
+\newcommand{\rf}[2][]{%
+\ifhyperref%
+(\hyperlink{#2}{\csname#2\endcsname}#1)%
+\else%
+(\csname#2\endcsname#1)%
+\fi}
%Cross-reference without brackets
-\newcommand{\rn}[1]{\csname#1\endcsname}
+\newcommand{\rn}[2][]{
+\ifhyperref
+\hyperlink{#2}{\csname#2\endcsname}#1%
+\else
+\csname#2\endcsname#1
+\fi}
%Repeating the sentence
\newcommand{\rp}[1]{\csname#1r\endcsname}
@@ -76,43 +336,63 @@
\newcommand{\ml}[1]{\csname#1p\endcsname}
%Repeating the sentence with name or number:
-\newcommand{\rff}[1]{\ex.[(\csname#1\endcsname)]\csname#1r\endcsname\p\par}
+\newcommand{\rff}[2][n]{\ifdim\lastskip=\Extopsep\vspace{\Exredux}\fi
+\ifhyperref
+\ex.[(\hyperlink{#2}{\csname#2\endcsname})]
+\if#1c \setlength{\abovedisplayskip}{1ex}\setlength{\belowdisplayskip}{1ex}\parbox{\centro}{\centering \csname#2r\endcsname\philpunct}
+\else \csname#2r\endcsname\philpunct\fi
+\else
+\ex.[(\csname#2\endcsname)]
+\if#1c \setlength{\abovedisplayskip}{1ex}\setlength{\belowdisplayskip}{1ex}\parbox{\centro}{\centering \csname#2r\endcsname\philpunct}
+\else \csname#2r\endcsname\philpunct\fi\fi
+\par}
%Repeating the sentence with name or number and bracket control:
\newcommand{\rfp}[1]{\ex.[\lebrack\csname#1\endcsname\ribrack\hspace{-1em}] \csname #1r\endcsname\par}
%Controlling numbering, prefix and suffix for SubExNo
-\newcommand{\subformat}[3]{\if#1a \else
-\if#1A \renewcommand{\alph}{\Alph} \else \if#11 \renewcommand{\alph}{\arabic} \else \if#1r \renewcommand{\alph}{\roman} \else \if#1R \renewcommand{\alph}{\Roman} \else \fi \fi \fi \fi \fi \renewcommand{\SubExLeftBracket}{#2} \renewcommand{\SubExRightBracket}{#3}}
+\newcommand{\subformat}[3]{\if#1a \renewcommand{\subettan}{\alph} \else
+\if#1A \renewcommand{\subettan}{\Alph} \else \if#11 \renewcommand{\subettan}{\arabic} \else \if#1r \renewcommand{\subettan}{\roman} \else \if#1R \renewcommand{\subettan}{\Roman} \else \fi \fi \fi \fi \fi \renewcommand{\SubExLBr}{#2}
+\renewcommand{\SubExRBr}{#3}
+\renewcommand{\SubExlabel}{\SubExLBr\subettan{SubExNo}\SubExRBr}
+\if@noftnote \renewcommand{\theSubExNo}{\theExNo\firstphildash\subettan{SubExNo}}
+\else \renewcommand{\theSubExNo}{\theFnExNo\firstphildash\subettan{SubExNo}} \fi
+\renewcommand{\theSubSubExNo}{\theSubExNo\secondphildash\Exroman{SubSubExNo}}
+}
%Ditto for stand-alone sequences, a-d:
\newcommand{\bota}{\alph}
-\newcommand{\bpaformat}[2]{\if#1a \else
-\if#1A \renewcommand{\bota}{\Alph} \else \if#11 \renewcommand{\bota}{\arabic} \else \if#1r \renewcommand{\bota}{\roman} \else \if#1R \renewcommand{\bota}{\Roman} \else \fi \fi \fi \fi \fi \renewcommand{\thebpa}{#2\bota{bpa}}}
+\newcommand{\bpaformat}[3]{\if#1a \else
+\if#1A \renewcommand{\bota}{\Alph} \else \if#11 \renewcommand{\bota}{\arabic} \else \if#1r \renewcommand{\bota}{\roman} \else \if#1R \renewcommand{\bota}{\Roman} \else \fi \fi \fi \fi \fi \renewcommand{\thebpa}{#2\bota{bpa}#3}}
\newcommand{\botb}{\alph}
-\newcommand{\bpbformat}[2]{\if#1a \else
-\if#1A \renewcommand{\botb}{\Alph} \else \if#11 \renewcommand{\botb}{\arabic} \else \if#1r \renewcommand{\botb}{\roman} \else \if#1R \renewcommand{\botb}{\Roman} \else \fi \fi \fi \fi \fi \renewcommand{\thebpb}{#2\botb{bpb}}}
+\newcommand{\bpbformat}[3]{\if#1a \else
+\if#1A \renewcommand{\botb}{\Alph} \else \if#11 \renewcommand{\botb}{\arabic} \else \if#1r \renewcommand{\botb}{\roman} \else \if#1R \renewcommand{\botb}{\Roman} \else \fi \fi \fi \fi \fi \renewcommand{\thebpb}{#2\botb{bpb}#3}}
\newcommand{\botc}{\alph}
-\newcommand{\bpcformat}[2]{\if#1a \else
-\if#1A \renewcommand{\botc}{\Alph} \else \if#11 \renewcommand{\botc}{\arabic} \else \if#1r \renewcommand{\botc}{\roman} \else \if#1R \renewcommand{\botc}{\Roman} \else \fi \fi \fi \fi \fi \renewcommand{\thebpc}{#2\botc{bpc}}}
+\newcommand{\bpcformat}[3]{\if#1a \else
+\if#1A \renewcommand{\botc}{\Alph} \else \if#11 \renewcommand{\botc}{\arabic} \else \if#1r \renewcommand{\botc}{\roman} \else \if#1R \renewcommand{\botc}{\Roman} \else \fi \fi \fi \fi \fi \renewcommand{\thebpc}{#2\botc{bpc}#3}}
\newcommand{\botd}{\alph}
-\newcommand{\bpdformat}[2]{\if#1a \else
-\if#1A \renewcommand{\botd}{\Alph} \else \if#11 \renewcommand{\botd}{\arabic} \else \if#1r \renewcommand{\botd}{\roman} \else \if#1R \renewcommand{\botd}{\Roman} \else \fi \fi \fi \fi \fi \renewcommand{\thebpd}{#2\bota{bpd}}}
+\newcommand{\bpdformat}[3]{\if#1a \else
+\if#1A \renewcommand{\botd}{\Alph} \else \if#11 \renewcommand{\botd}{\arabic} \else \if#1r \renewcommand{\botd}{\roman} \else \if#1R \renewcommand{\botd}{\Roman} \else \fi \fi \fi \fi \fi \renewcommand{\thebpd}{#2\botd{bpd}#3}}
+
+%Controlling numbering, prefix and suffix for SubSubExNo
+\newcommand{\subsubformat}[3]{\if#1r \renewcommand{\Exroman}{\roman} \else
+\if#1A\renewcommand{\Exroman}{\Alph} \else \if#11 \renewcommand{\Exroman}{\arabic} \else \if#1a \renewcommand{\Exroman}{\alph} \else \if#1R \renewcommand{\Exroman}{\Roman} \else \fi \fi \fi \fi \fi
+\renewcommand{\SubSubExLBr}{#2}
+\renewcommand{\SubSubExRBr}{#3}
+\renewcommand{\theSubSubExNo}{\theSubExNo\secondphildash\Exroman{SubSubExNo}}}
+
+%Fast changing between alphabetic, arabic and roman) for SubEx
+\newcommand{\sa}{\renewcommand{\SubExRBr}{.}\renewcommand{\SubExlabel}{\SubExLBr\alph{SubExNo}\SubExRBr}\renewcommand{\theSubExNo}{\arabic{ExNo}\alph{SubExNo}}}
+
+\newcommand{\sr}{\renewcommand{\SubExRBr}{)}\renewcommand{\SubExlabel}{\SubExLBr\roman{SubExNo}\SubExRBr}\renewcommand{\theSubExNo}{\arabic{ExNo}\roman{SubExNo}}}
-%Controlling prefix and suffix for SubSubExNo (not numbering for now)
-\newcommand{\bett}{\roman}
-\newcommand{\subsubformat}[3]{\if#1r \else
-\if#1A\renewcommand{\bett}{\Alph} \else \if#11 \renewcommand{\bett}{\arabic} \else \if#1a \renewcommand{\bett}{\alph} \else \if#1R \renewcommand{\bett}{\Roman} \else \fi \fi \fi \fi \fi \renewcommand{\theSubSubExNo}{\Alph{SubSubExNo}}\renewcommand{\SubSubExLeftBracket}{#2} \renewcommand{\SubSubExRightBracket}{#3}}
+\newcommand{\sab}{\renewcommand{\SubExRBr}{)}\renewcommand{\SubExlabel}{\SubExLBr\alph{SubExNo}\SubExRBr}\renewcommand{\theSubExNo}{\arabic{ExNo}\alph{SubExNo}}}
-%Fast changing between alphabetic. and roman) for SubEx
-\newcommand{\sa}{\renewcommand{\SubExRightBracket}{.}\renewcommand{\SubExlabel}{\SubExLeftBracket\alph{SubExNo}\SubExRightBracket}\renewcommand{\theSubExNo}{\arabic{ExNo}\refdash\alph{SubExNo}}}
-\newcommand{\sr}{\renewcommand{\SubExRightBracket}{)}\renewcommand{\SubExlabel}{\SubExLeftBracket\roman{SubExNo}\SubExRightBracket}\renewcommand{\theSubExNo}{\arabic{ExNo}\refdash\roman{SubExNo}}}
-\newcommand{\sab}{\renewcommand{\SubExRightBracket}{)}\renewcommand{\SubExlabel}{\SubExLeftBracket\alph{SubExNo}\SubExRightBracket}\renewcommand{\theSubExNo}{\arabic{ExNo}\refdash\alph{SubExNo}}}