summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/phonrule/phonrule-doc.tex
blob: b4c88e5fb3a3066edbe174efaa3c8890d778c4e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
\documentclass[a4paper]{article}

\usepackage{fontspec}

\usepackage{polyglossia}
    \setmainlanguage{english}

\usepackage{listings}
    \lstset{basicstyle=\ttfamily}

\usepackage{phonrule}
\usepackage{gb4e}

\title{The \texttt{phonrule} package (v1.3.2)}
\author{Stefano Coretta \\ \texttt{stefano.coretta \textit{at} postgrad.manchester.ac.uk}}

\reversemarginpar

\begin{document}
\maketitle

\section{Purpose}
This package provides macros for typesetting phonological rules like those in \textit{Sound Pattern of English} (Chomsky, Noam \& Morris Halle. 1968.\textit{The sound pattern of English}. New York, Evanston, and London: Harper \& Row).

\section{Usage}

\begin{quote}
\begin{lstlisting}
\phon{〈input〉}{〈output〉}
\end{lstlisting}
\end{quote}

The command \verb+\phon+ has two arguments: the first one is the input of the rule and the second is its output.
Here is an example with the code and the result it produces:

\begin{exe}
\ex \verb+\phon{z}{r}+
\ex \phon{z}{r}
\end{exe}

\begin{quote}
\begin{lstlisting}
\phonc{〈input〉}{〈output〉}{〈context〉}
\end{lstlisting}
\end{quote}

\verb+\phonc+ adds a third argument for the context:

\begin{exe}
\ex \verb+\phonc{a}{ə}{[–stressed]}+
\ex \phonc{a}{ə}{[–stressed]}
\end{exe}

The commands \verb+\phonl+, \verb+\phonr+ and \verb+\phonb+ add a place holder line and put the context, respectively, on the left (l), on the right (r) and on both sides (b):

\begin{exe}
\ex
    \begin{xlist}
    \ex \verb+\phonl{k}{c}{i}+
    \ex \phonl{k}{tʃ}{i}
    \end{xlist}
\ex
    \begin{xlist}
    \ex \verb+\phonr{t}{ts}{u}+
    \ex \phonr{t}{ts}{u}
    \end{xlist}
\ex
    \begin{xlist}
    \ex \verb+\phonb{s}{z}{V}{V}+
    \ex \phonb{s}{z}{V}{V}
    \end{xlist}
\end{exe}

The \verb+\oneof+ command provides the possibility to compile several contexts, one per line, embraced by a left curly bracket.

\begin{exe}
\ex
\begin{lstlisting}
\phonc{t}{ts}{
    \oneof{
    \phold i \\
    \phold u}
    }
\end{lstlisting}
\ex \phonc{t}{ts}{
    \oneof{
    \phold i \\
    \phold u}
    }
\end{exe}

The \verb+\phonfeat+ command allows you to insert feature specifications.
The possible values are \texttt{[c]} for centre (the default), \texttt{[l]} for left-aligned, and \texttt{[r]} for right-aligned. 

\begin{exe}
\ex
\begin{lstlisting}
\phonc{t}{ts}{\phold
    \phonfeat[l]{
        −consonantal \\
        +high \\
        +front}
    }
\end{lstlisting}
\ex \phonc{t}{ts}{\phold
    \phonfeat[l]{
        −consonantal \\
        +high \\
        +front}
    }
\end{exe}

\verb+\phold+ typesets a place holder line. You can nest \verb|oneof| and \verb|phonfeat| commands for complex rules.
The \verb|oneof| command accepts an optional argument which tells the alignment of the context.

\begin{exe}
\ex
\begin{lstlisting}
\phonc{x}{y}{\oneof[l]{
    \phold z \\
    \phonfeat{
        +feature x \\
        −feature y
    } \phold
    }}
\end{lstlisting}
\ex \phonc{x}{y}{\oneof{
    \phold z \\
    \phonfeat{
        +feature x \\
        −feature y
    } \phold
    }}
\end{exe}

You can use \verb|\env|, \verb|\envl|, \verb|\envr|, \verb|\envb| for rules with more than one output: these commands typeset only the different outputs with their respective environments.
The possible values are \texttt{[c]} for centre (the default), \texttt{[l]} for left-aligned, and \texttt{[r]} for right-aligned.
The following example shows the use of the optional argument with \texttt{[l]}.
The \verb|\env|, \verb|\envl|, \verb|\envr|, \verb|\envb| have a starred version to be used when an optional argument is set in \verb|\oneof|.

\begin{exe}
\ex
\begin{lstlisting}
\phon{x}{\oneof[l]{
    \envr*{w}{z} \\
    \envl*{v}{\phonfeat{
        +feature x \\
        −feature y
    }}}}
\end{lstlisting}
\ex \phon{x}{\oneof[l]{
    \envr*{w}{z} \\
    \envl*{v}{\phonfeat{
        +feature x \\
        −feature y
    }}}}
\end{exe}

\section{Change log}

\subsection*{v1.3.2 - 2017-04-16}
\subsubsection*{Added}
\begin{itemize}
    \item optional argument for text alignment in \verb+\phonfeat+ command
\end{itemize}

\subsection*{v1.3.1 - 2017-01-02}
\subsubsection*{Added}
\begin{itemize}
    \item needs \TeX{} format \LaTeX2e
\end{itemize}
\subsubsection*{Removed}
\begin{itemize}
    \item \verb+\makeatletter+
    \item unused definition
\end{itemize}

\subsection*{v1.3.0 - 2016-12-26}
\subsubsection*{Added}
\begin{itemize}
    \item optional argument for text alignment in \verb+\oneof+ command
    \item starred version of the \verb+\env+ command family for use with optional argument in \verb+\oneof+
\end{itemize}
\subsubsection*{Changed}
\begin{itemize}
    \item definition of \verb+\phon+ command family
    \item header of \texttt{phonrule.sty}
    \item extension of README, now \texttt{.md}
\end{itemize}
\subsubsection*{Removed}
\begin{itemize}
    \item package \texttt{ragged2e}
\end{itemize}

\subsection*{v1.2.0}
\subsubsection*{Added}
\begin{itemize}
\item \texttt{ragged2e} package for \verb+\Centering+ command
\end{itemize}
\subsubsection*{Fixed}
\begin{itemize}
\item Fixed: now the content of the feature matrices is centred and not left aligned
\end{itemize}

\subsection*{v1.1.0}
\subsubsection*{Changed}
\begin{itemize}
\item definition of \verb+\phonfeat+ and \verb+\oneof+ with \verb+\pbox+ (requires package \texttt{pbox})
\subsubsection*{Fixed}
\item documentation typos
\end{itemize}

\subsection*{v1.0.0}
\subsubsection*{Added}
\begin{itemize}
\item new commands \verb|\env| for personalised outputs
\end{itemize}

\subsubsection*{Changed}
\begin{itemize}
\item definition of commands with \verb|\ensuremath|
\item environments to commands
\item place holder to 1.5ex length, -1.5pt vertical position
\item curly brackets to only left in \verb|\oneof| command
\end{itemize}




\end{document}