%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). %email: peter.pagin@philosophy.su.se %Date: 2007.12.04 %Version: 0.6 \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{\lebrack}{(} \newcommand{\ribrack}{)}\def\broff{\def\lebrack{}\def\ribrack{}} \def\bron{\def\lebrack{(}\def\ribrack{)}} \newcounter{bpa} \newcounter{bpb} \newcounter{bpc} \newcounter{bpd} \newcounter{bna} \newcommand{\bn}{\refstepcounter{bna}\thebna.\quad} \newcommand{\bns}{\setcounter{bna}{0}} %Removing brackets from ExNo and SubExNo \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)} %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} %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} %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} %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} %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} %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} %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} %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)} %Cross-reference without brackets \newcommand{\rn}[1]{\csname#1\endcsname} %Repeating the sentence \newcommand{\rp}[1]{\csname#1r\endcsname} %Repeating the sentence with lowercase initial letter \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} %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}} %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{\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{\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{\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}}} %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}} %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}}}