\documentclass[10pt]{article}
\usepackage[utf8]{inputenc}



\usepackage{linguex,philex}



\newcommand{\qut}[1]{`#1'}
\usepackage[english]{babel}

\usepackage{latexsym,amssymb,amsmath,amsthm,wasysym}
\usepackage{calc}

\newcounter{hour}
\newcounter{minute}



\newcommand{\emp}{\emph}
\newcommand{\note}{\footnote}
\setcounter{hour}{\time/60}
\setcounter{minute}{\time-60*\thehour}
\ifnum\thehour<10 \def\nowh{0\thehour} \else \def\nowh{\thehour}\fi
\ifnum\theminute<10\def\nowm{0\theminute} \else \def\nowm{\theminute}\fi
\def\now{\nowh:\nowm}
\def\aut{Peter Pagin}
\def\home{\begin{flushright}
\item Department of Philosophy
\item Stockholm University
\end{flushright}}
\usepackage{paralist}
\usepackage{hyperref}

\begin{document}
\title{The \tt philex \rm Package \\ version 0.3}
\author{\aut}
\date{\today, \now}
\maketitle
\setlength{\pltopsep}{3mm}
\setlength{\plitemsep}{2mm}
\setlength{\plparsep}{1mm}
\settowidth{\Exlabelwidth}{(110)}

The \verb+philex+ package is a small addition to Wolfgang Sternefeld's \verb+linguex+ package and requires \verb+linguex+. As of version 0.2 it also requires \verb+calc+. \verb+philex+ will load \verb+linguex+ if it is installed. The purpose of \verb+philex+ is to add functions for more flexible cross-referencing, for repeating and embedding named or numbered sentences and also a little bit for formatting.

As of version 0.3 \verb+philex+ creates a separate file in the same directory as the main file. If the typeset document is \emp{myfile}.tex, the file created by \verb+philex+ will be \emp{myfile}-px.tex. \verb+philex+ writes its command definitions to this file at typesetting, and reads from the created file at the beginning (AtBeginDocument) of the next round of typesetting. The purpose of this device is to allow forward cross-referencing to named sentences, in analogy to the label-reference system of LaTeX itself.

\verb+philex+ is called by \verb+\usepackage{philex}+. Its basic command is \verb+\lb{}{}+, which takes two obligatory arguments. The first argument is the label of the sentence, and the second is the sentence itself. \verb+lb+ uses the \verb+\ex.+ formatting of \verb+linguex+, and thereby the \verb+ExNo+ counter. Type 

\begin{verbatim}
\lb{nice}{This is a nice day}
\end{verbatim}
and the result will be

\lb{nice}{This is a nice day}
in case it is numbered sentence no \rn{nice} in your document (we will return in a second to the full stop issue). 

In \verb+linguex+ you leave a blank line after sentence to close the environment. The blank line gives a \verb+\par+-command to TeX. In \verb+philex+ the \verb+\par+-command is built into the top-level environments. So you leave a blank line after an \verb+\lb{}{}+-environment only if you want to start a new paragraph. The reason for this change, is that only this way will the \verb+philex+ package work together with the \verb+extract+ package by Hendri Adriaens, which can be used for extracting material, e.g. for generating a handout, from documents making use of \verb+philex+. \verb+linguex+ comes together with Sternefeld's \verb+linguho+ package, which has the function of generating a handout from documents using \verb+linguex+. \verb+linguho+ does not work with \verb+philex+, since the \verb+linguex+ environments are not explicit in the document. The corresponding function, only more flexible, can be served with the \verb+extract+ package.

For cross-referencing a numbered sentence you can use to ordinary \verb+\ref{}+-command, or the command \verb+\rf{}+ provided by \verb+philex+. Thus \verb+\rf{nice}+ produces the \verb+ExNo+ number of \rf{nice}. The command takes an optional argument. In case you want to add a suffix in the cross-reference, you provide it as the optional argument. \verb+\rf[a]{nice}+ produces \qut{\rf[a]{nice}}. This is normally not needed, since the usual reasons for doing this are accommodated by other means (see below).

A cross-reference with \verb+\rn{}+ will remove the brackets. \verb+\rn{nice}+ gives \qut{\rn{nice}}. This is equivalent to using the label itself as a command name: \verb+\nice+ gives \qut{\nice}.

You might want to repeat the sentence later. This can be done with the \verb+\rp{}+-command. Thus \verb+\rp{nice}+ produces \qut{\rp{nice}}. With the \verb+\ml{}+-command you can repeat the sentence with the initial letter made lowercase: \verb+\ml{nice}+ produces \qut{\ml{nice}}. This is useful in case you want to embed the sentence in a larger sentence, such as

\lb{great}{Elsa thinks that \ml{nice}, but Alfred does not}
This also illustrates the insertion of the full stop. You do not normally type in a full stop a the end of the named sentence, but let it be put in by the \verb+\lb+-command. This makes the call by means of the \verb+\ml+-command fully embeddable. The full-stop insertion can be turned off with \verb+\q+ and turned on again with \verb+\s+, and also transformed into a comma with \verb+\km+. These commands shall go before the relevant \verb+philex+ environment. The analogous functions for the first subordinate level are served by \verb+\qt+ (changing to nothing), \verb+\stp+ (changing to full stop), and \verb+\kmt+ (changing to comma). 

In case you want to repeat the sentence with its name or number you can use \verb+\rff{}+. \verb+\rff{nice}+ produces \rff{nice}

In many cases you will want to produce a variant of the original sentence, which will have the same name or number as the original, but with an added suffix, like a letter or a prime symbol. This is achieved with the \verb+\lbu{}{}{}{}+-command. It takes four obligatory arguments. The first is the label of the new sentence, the second is the label of the sentence you are giving a variant of, the third is the suffix you want to add, and the fourth is the new sentence itself.
\begin{verbatim}
\lbu{nicy}{nice}{\('\)}{But that was even nicer}
\end{verbatim}
produces \lbu{nicy}{nice}{\('\)}{But that was even nicer}
And a cross-reference will preserve the name: \verb+\rf{nicy}+ produces \qut{\rf{nicy}}.

You will also want to have named principles, such as
\lbp{life}{W}{Life is wonderful!}
These are produced with the \verb+\lbp{}{}{}+-command which makes use of the optional argument to \verb+\ex.[]+ in \verb+linguex+. Cross-references with \verb+\rf+, like to \rf{life}, and updates with \verb+\lbu+, like
 
\lbu{newlife}{life}{\textsuperscript{+}}{\q Life is terrific!} work as before. If you later change the name of the principle, or the formulation, the changes are reflected in the cross-references and repetitions after the next typesetting, as long as you do not change the labels. In the last example, the full stop function was turned off by means of \verb+\q+ inside the last argument, so as not to produce an extra full stop after the exclamation mark.

In case you don't want the brackets in the principle name, turn them off with \verb+\broff+, as in \rn{offer} (exemplifying forward cross-reference):\broff
\lbp{offer}{L}{Has a lot to offer!}
To turn them on again, type \verb+\bron+. \bron It is also possible to change the brackets with \verb+\renewcommand{\lebrack}{}+ and \verb+\renewcommand{\ribrack}{}+ (put in what you want), for the left and right bracket, respectively.

The cross-reference and repeat and update functions also work for subordinate clauses, corresponding to \verb+\a.+ and \verb+\b.+ of \verb+linguex+. For these purposes, \verb+philex+ has \verb+\lba{}{}+, \verb+\lbb{}{}+ and \verb+\lbz{}{}+. To illustrate, the code

\begin{verbatim}
\lbp{clauses}{PP}{Some main words, followed by 
\lba{first}{Time flies}	\lbb{second}{Like an arrow} 
\lbz{last}{And much too fast}}
\end{verbatim}
produces

\lbp{clauses}{PP}{Some main words, followed by 
\lba{first}{Time flies}	\lbb{second}{Like an arrow} \lbz{last}{And much too fast}}
It is in general not necessary to to switch from \verb+\lbb+ to \verb+\lbz+ for the last subordinate clause.

Notice that the subordinate environments are put \emp{into} the main \verb+\lbp+ environment. This is necessary, since the main environment has a \verb+\par+ command built in, which ends the  \verb+\ex.+ environment of \verb+linguex+. Also, there are no line-breaks in the code (even though that cannot be seen above), and that is again for the sake of the \verb+extract+ package, which extracts given command environments by command line. In these subordinate environments the full stop is put in. The closing one, \verb+\lbz+, turns off the the full stop that may come from the the main environment, so as not to produce doubles. 

We can now cross-reference a subordinate clause, as with \verb+\rf{second}+, to produce \qut{\rf{second}}. We can also repeat, as with \verb+\rff{last}+: \rff{last}
Similarly update.

There are some formatting options. The command \verb+\subformat{}{}{}+ takes three arguments. With the first argument you can control the numbering format. Default is lowercase alphabetic. Setting the first argument to \qut{A} gives uppercase alphabetic, to \qut{r} gives lowercase roman, to \qut{R} gives uppercase roman, and to \qut{1} gives arabic. Other argument values have no effect. The second argument controls the prefix. For instance, inserting a left bracket will produce left-bracket enumeration. The last argument produces the suffix. So, \verb+\sub{1}{}{)}+ will produce arabic enumeration with a closing bracket after the numeral. The \verb+\subformat+-command should be put in before the first \verb+\lba+-command.

There are some shorter fast-switching commands for this purpose: \verb+\sa+ produces lowercase alphabetic with dot (which is \verb+linguex+ default), \verb+\sab+ produces lowercase alphabetic followed by right bracket, and \verb+\sr+ produces lowercase roman followed by right bracket. If these commands, just as the  -verb+\subformat+-command, are put within the main\verb+philex+ environment (before the first subordinate clause), the changes are only local to that environment. Note that the longer command works by \emp{redefining} the \verb+\alph+-command which normally gives lowercase alphabetic, while the fast switching commands redefine \verb+\theSubExNO+ without redefining \verb+\alph+. So if \verb+\alph+ is locally redefined to mean \verb+\roman+, the command \verb+\sa+ will produce a roman numeral with dot in that local context.

Repeating an \verb+\lba+ command after a subordinate clause produces a new subordinate level, as designed in \verb+linguex+. We can have 

\lb{numclauses}{Much to do \subformat{a}{}{)}\lba{more}{So little time}\lba{late}{And one is always late}}
Clause \rf{late} is worth thinking about. Produced with the following code:
\begin{verbatim}
\lb{numclauses}{Much to do \subformat{a}{}{)}
\lba{more}{So little time}
\lba{late}{And one is always late}}
Clause \rf{late} is worth thinking about.
\end{verbatim}
Some formatting of the second subordinate level can be done by means of \verb+\subsubformat{}{}{}+. At present, however, only the second and third argument, controlling prefix and suffix, are operative. The enumeration style is not affected.

In case you wish a list of independently numbered principles with a shared name stem, use one  of the \verb+\lbpx+-commands, where \verb+x+ is one of \verb+a,b,c,d+. It takes two arguments, for label and content sentence. You first set the enumeration style and and the stem with \verb+\bpxformat{}{}+, where again \verb+x+ has the corresponding value. The first argument sets the numbering style, as above, and the second the stem. Then the \verb+\lbpx+-command picks it up: \bpaformat{1}{T}

\begin{verbatim}
\bpaformat{1}{T}
\lbpa{kno}{Alfred is in the know.} 
\lbpa{hu}{Elsa is, too.} 
\lbpa{kne}{John agrees.} 
\end{verbatim}
produces
\lbpa{kno}{Alfred is in the know.} \lbpa{hu}{Elsa is, too.} \lbpa{kne}{John agrees.}
These enumerations are independent of \verb+ExNO+ and of each other, and the counters (\verb+bpx+) are reset with the relevant \verb+\bpxformat+. They still work with sub-clauses, cross-references and the rest of the apparatus. Note that these enumerations do not have to be contiguous: \lbpa{glufs}{But he shouldn't.}

The top-level commands, \verb+\lb+, \verb+\lbp+, \verb+\lbpx+, and \verb+\lbu+, take an optional argument. If that argument is set to \qut{c}, as in \verb+\lb[c]{xx}{yy}+, the content sentence will be centered, as in  

\lb[c]{PoC}{\[P(\gamma (t)\geq\delta)|\textbf{A})=(0.5)^{\alpha (t)}\sum_{i=0}^{\epsilon(t)}\binom{\alpha(t)}{i}\]}
This is designed for equations and figures. It works both with \verb+\(\)+ and, as here, with \verb+\[\]+, which produces more space above and below.

Positioning text (left, center or right) on lower lines in a \verb+philex+-environment can be done by means of line-break and a \verb+\makebox[][]{}+-command on the new line. The first optional argument sets the width of the box. With the command \verb+\hcentro+, provided by \verb+philex+, the length is set to \verb+\textwidth+ (the current width of the entire text column) minus the \verb+linguex+ inset (width of the label + with of the separation between label and text). The length command \verb+\centro+ deducts that quantity twice. This second alternative is used for centering with respect to the entire text column (exemplifed in \rf{PoC} above), while the \verb+\hcentro+ command is used for left-, center- or right positioning within the interior text column of \verb+philex/linguex+. The positioning is chosen by the \LaTeX values \verb+l+, \verb+c+ and \verb+r+ in  the second optional argument.

Finally, \verb+philex+ provides an additional counter, \verb+bna+, for informal enumerations in the main text. The command \verb+\bn+ advances the counter and puts in a number with a quad space. The command \verb+\bns+ resets the counter to zero.

\bn The result is exemplified with first with this sentence.

\bn And then it is followed up here.

There are more possibilities in \verb+linguex+, described in its manual.


\bibliography{peter3}
\end{document} 