summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/philex/philex.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-09-21 21:37:26 +0000
committerKarl Berry <karl@freefriends.org>2013-09-21 21:37:26 +0000
commit74e7c8b0e6d77f0d143fac7754168b84747ef59b (patch)
treecc584c69e26f78cc49c3ff3c4bc761d99d37969c /Master/texmf-dist/tex/latex/philex/philex.sty
parent1dea1e19a1e5863c4874cd5fdb37c2bc20eadd2d (diff)
philex (21sep13)
git-svn-id: svn://tug.org/texlive/trunk@31717 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/philex/philex.sty')
-rw-r--r--Master/texmf-dist/tex/latex/philex/philex.sty233
1 files changed, 190 insertions, 43 deletions
diff --git a/Master/texmf-dist/tex/latex/philex/philex.sty b/Master/texmf-dist/tex/latex/philex/philex.sty
index 9da8c792932..608d6ed988a 100644
--- a/Master/texmf-dist/tex/latex/philex/philex.sty
+++ b/Master/texmf-dist/tex/latex/philex/philex.sty
@@ -1,8 +1,8 @@
-%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.
+%This is a small package with additions to Wolfgang Sternefeld's linguex package (adapted to version 4.3). 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: 2012.09.22
-%Version: 1.01
+%Date: 2013.09.09
+%Version: 1.1
\NeedsTeXFormat{LaTeX2e}
@@ -20,6 +20,13 @@
\DeclareOption{hyper}{\hyperreftrue}
\ProcessOptions
+\newcounter{altsub}
+\newcounter{altsubsub}
+\renewcommand{\thealtsub}{\subettan{altsub}}
+%\renewcommand{\thealtsubsub}{\thealtsub\refdash\Exroman{altsubsub}}
+\renewcommand{\Exroman}{\roman}
+\newcommand{\refdash}{-}
+
%Spacing and formatting commands
\setlength{\Exredux}{-\baselineskip}
\renewcommand{\philarge}{3em}
@@ -76,7 +83,7 @@
%Removing brackets from ExNo and SubExNo
\renewcommand{\theExNo}{\arabic{ExNo}}
-\renewcommand{\theSubExNo}{\theExNo\alph{SubExNo}}
+\renewcommand{\theSubExNo}{\theExNo\firstphildash\alph{SubExNo}}
\renewcommand{\theSubSubExNo}{\theSubExNo\roman{SubSubExNo}}
\newcommand{\ncentro}{\columnwidth-(\Exindent+\Exlabelsep+\Exlabelwidth)}
\newcommand{\wcentro}{\columnwidth-(\Exindent*2+\Exlabelsep*2+\Exlabelwidth*2)}
@@ -101,6 +108,7 @@
\parbox{\centro}{\centering #3\philpunct}\else #3\philpunct\fi\par%
\fi}
+
%Top-level named sentence:
\newcommand{\lbp}[4][n]{
\ifdim\lastskip=\Extopsep\vspace{\Exredux}\fi
@@ -230,81 +238,185 @@
%----------------- Sub-environments -------------------------------
-\newcommand{\philsemi}{;}
-
-\newcommand{\lba}[3][;]{\philempty
+\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}}}}
+\ifnum\theExDepth=1\def\tempc{\tempa}
+\setcounter{altsub}{0}
+\refstepcounter{altsub}\label{#2q}
+\renewcommand{\thealtsubsub}{\thealtsub\secondphildash\Exroman{altsubsub}}
+\else \ifnum \theExDepth=2\def\tempc{\tempb}
+\setcounter{altsubsub}{0}
+\refstepcounter{altsubsub}\label{#2q}
+\else\fi\fi
+\if \tempc\philsemi
+\immediate\write\@auxout{\unexpanded{%
+\expandafter\gdef\csname#2p\endcsname{\MakeLowercase#3}
+\expandafter\gdef\csname#2r\endcsname{#3}
+\expandafter\global\expandafter\def\csname#2\endcsname{\ref{#2}}
+\expandafter\global\expandafter\def\csname#2q\endcsname{\ref{#2q}}
+}}
\expandafter\providecommand\csname#2p\endcsname{\MakeLowercase#3}
\expandafter\providecommand\csname#2r\endcsname{#3}
-\expandafter\providecommand\csname#2\endcsname{\ref{#3}}
+\expandafter\providecommand\csname#2\endcsname{\ref{#2}}
+\expandafter\providecommand\csname#2q\endcsname{\ref{#2q}}
\a. \label{#2}#3\philsubpunct
-\else
+\else
+\ifnum\theExDepth=1
+\renewcommand{\thealtsub}{#1}
+\renewcommand{\theSubExNo}{\theExNo\firstphildash#1}
+\refstepcounter{SubExNo}
\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}
+\expandafter\gdef\csname#2\endcsname{\ref{#2}}
+\expandafter\global\expandafter\def\csname#2q\endcsname{#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
+\ifnum\theExDepth=2
+\renewcommand{\thealtsubsub}{\thealtsub\secondphildash#1}
+\refstepcounter{altsubsub}\label{#2q}
+\renewcommand{\theSubSubExNo}{\theSubExNo\secondphildash#1}
+\refstepcounter{SubSubExNo}
+\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\global\expandafter\def\csname#2q\endcsname{\ref{#2q}}
+}}
+ \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}
+\a.[\lebrack#1\ribrack]\label{#2}#3\philsubpunct
+\fi
+\ifnum\theExDepth=2
+\renewcommand{\theSubExNo}{\theExNo\firstphildash\subettan{SubExNo}}
+\renewcommand{\theSubSubExNo}{\theSubExNo\secondphildash\Exroman{SubSubExNo}}
+\setcounter{altsub}{0}
+\renewcommand{\thealtsub}{\subettan{altsub}}
+\fi
+\ifnum\theExDepth=3
+\renewcommand{\thealtsubsub}{\thealtsub\secondphildash\Exroman{altsubsub}}
+\setcounter{altsubsub}{0}
+\setcounter{SubSubExNo}{0}
+\fi
+\fi
+}
-\newcommand{\lbb}[3][;]{\philempty
+\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}}}}
+\if \tempc\philsemi
+\ifnum\theExDepth=1
+\def\tempc{\tempa}\fi
+\ifnum\theExDepth=2
+\def\tempc{\tempb}
+\renewcommand{\thealtsub}{\subettan{altsub}}
+\renewcommand{\thealtsubsub}{\thealtsub\secondphildash\Exroman{altsubsub}}
+\refstepcounter{altsub}\label{#2q}
+\else
+\refstepcounter{altsubsub}\label{#2q}
+\renewcommand{\theSubSubExNo}{\theSubExNo\secondphildash\Exroman{SubSubExNo}}
+\def\tempc{\tempb}
+\fi
+\immediate\write\@auxout{\unexpanded{\expandafter\gdef\csname#2p \endcsname{\MakeLowercase#3}\expandafter\gdef\csname#2r\endcsname{#3} \expandafter\global\expandafter\def\csname#2\endcsname{\ref{#2}}
+\expandafter\global\expandafter\def\csname#2q\endcsname{\ref{#2q}}
+}}
\expandafter\providecommand\csname#2p\endcsname{\MakeLowercase#3}
\expandafter\providecommand\csname#2r\endcsname{#3}
-\expandafter\providecommand\csname#2\endcsname{\ref{#3}}
+\expandafter\providecommand\csname#2\endcsname{\ref{#2}}
+\expandafter\providecommand\csname#2q\endcsname{\ref{#2q}}
\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\gdef\csname#2\endcsname{ref{#2}}
+\expandafter\global\expandafter\def\csname#2q\endcsname{#1}
+}}
+\ifnum\theExDepth=1 \renewcommand{\theSubExNo}{\theExNo\firstphildash#1}
+\refstepcounter{SubExNo}
+\renewcommand{\thealtsub}{#1}
+\renewcommand{\thealtsubsub}{#1\Exroman{altsubsub}}
+\else
+\ifnum\theExDepth=2
+\renewcommand{\thealtsub}{#1}
+\renewcommand{\theSubExNo}{\theExNo\firstphildash#1}
+\refstepcounter{altsub}\label{#2q}
+\else
+\renewcommand{\thealtsubsub}{\thealtsub\secondphildash#1}
+\refstepcounter{altsubsub}\label{#2q}
+\renewcommand{\theSubSubExNo}{\theSubExNo\secondphildash#1}
+\refstepcounter{SubSubExNo}
+\fi\fi
\expandafter\providecommand\csname#2p\endcsname{\MakeLowercase#3}
\expandafter\providecommand\csname#2r\endcsname{#3}
-\expandafter\providecommand\csname#2\endcsname{\theExNo#1}
+\expandafter\providecommand\csname#2\endcsname{\ref{#2}}
+\expandafter\providecommand\csname#2q\endcsname{\ref{#2q}}
\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
+\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}}}}
+\renewcommand{\thealtsub}{\subettan{altsub}}
+\renewcommand{\thealtsubsub}{\thealtsub\secondphildash\Exroman{altsubsub}}
+\ifnum\theExDepth=1
+\def\tempc{\tempa}\fi
+\ifnum\theExDepth=2
+\def\tempc{\tempb}
+\refstepcounter{altsub}\label{#2q}
+\else
+\renewcommand{\thealtsub}{\subettan{altsub}}
+\renewcommand{\thealtsubsub}{\thealtsub\secondphildash\Exroman{altsubsub}}
+\refstepcounter{altsubsub}\label{#2q}
+\renewcommand{\theSubSubExNo}{\theSubExNo\secondphildash\Exroman{SubSubExNo}}
+\def\tempc{\tempb}\fi
+\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\global\expandafter\def\csname#2q\endcsname{\ref{#2q}}}}
\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}
+ \else
+\ifnum\theExDepth=1
+\renewcommand{\theSubExNo}{\theExNo\firstphildash#1}
+\refstepcounter{SubExNo}
+\renewcommand{\thealtsub}{#1}
+\renewcommand{\thealtsubsub}{\thealtsub\secondphildash#1}
+\else
+\ifnum\theExDepth=2
+\renewcommand{\theSubExNo}{\theExNo\firstphildash#1}
+\refstepcounter{SubExNo}
+\renewcommand{\thealtsub}{#1}
+\refstepcounter{altsub}\label{#2q}
+\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\global\expandafter\def\csname#2q\endcsname{\ref{#2q}}
+}}
+\else
+\ifnum\theExDepth=3
+\renewcommand{\thealtsubsub}{\thealtsub\secondphildash#1}
+\refstepcounter{altsubsub}\label{#2q}
+\renewcommand{\theSubSubExNo}{\theSubExNo\secondphildash#1}
+\refstepcounter{SubSubExNo}\label{#2}
+\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\gdef\csname#2\endcsname{\ref{#2}}
+\expandafter\global\expandafter\def\csname#2q\endcsname{\ref{#2q}}
+}}
+\fi\fi\fi
\expandafter\providecommand\csname#2p\endcsname{\MakeLowercase#3}
\expandafter\providecommand\csname#2r\endcsname{#3}
-\expandafter\providecommand\csname#2\endcsname{\theExNo#1}
+\expandafter\providecommand\csname#2\endcsname{\ref{#2}}
+\expandafter\providecommand\csname#2q\endcsname{\ref{#2q}}
\ifhyperref
\b.[\hypertarget{#2}\lebrack#1\ribrack] \label{#2}#3\philsubpunct
\else
@@ -321,6 +433,14 @@
(\csname#2\endcsname#1)%
\fi}
+%Cross-reference to subsentence without main number:
+\newcommand{\rfx}[2][]{%
+\ifhyperref%
+(\hyperlink{#2}{\csname#2q\endcsname}#1)%
+\else%
+(\csname#2q\endcsname#1)%
+\fi}
+
%Cross-reference without brackets
\newcommand{\rn}[2][]{
\ifhyperref
@@ -329,6 +449,14 @@
\csname#2\endcsname#1%
\fi}
+%Cross-reference to subsentence without brackets and main number:
+\newcommand{\rnx}[2][]{%
+\ifhyperref%
+\hyperlink{#2}{\csname#2q\endcsname}#1%
+\else%
+\csname#2q\endcsname#1%
+\fi}
+
%Repeating the sentence
\newcommand{\rp}[1]{\csname#1r\endcsname}
@@ -347,6 +475,21 @@
\else \csname#2r\endcsname\philpunct\fi\fi
\par}
+%Repeating the sentence with name or number but without footnote:
+\newcommand{\rffnot}[2][n]{
+\ifdim\lastskip=\Extopsep\vspace{\Exredux}\fi
+\ifhyperref
+\ex.[(\hyperlink{#2}{\csname#2\endcsname})]
+\renewcommand{\footnote}[1]{}
+\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)]
+\renewcommand{\footnote}[1]{}
+\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}
@@ -362,19 +505,23 @@
%Ditto for stand-alone sequences, a-d:
\newcommand{\bota}{\alph}
-\newcommand{\bpaformat}[3]{\if#1a \else
+\newcommand{\bpaformat}[3]{\setcounter{bpa}{0}%
+\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}[3]{\if#1a \else
+\newcommand{\bpbformat}[3]{\setcounter{bpb}{0}%
+\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}[3]{\if#1a \else
+\newcommand{\bpcformat}[3]{\setcounter{bpc}{0}%
+\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}[3]{\if#1a \else
+\newcommand{\bpdformat}[3]{\setcounter{bpd}{0}%
+\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