summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/drs/drsdoc.tex
blob: 2258359908883ff97cf7998b3642b2e5339e2e7f (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
231
232
233
234
235
236
\documentclass[11pt]{article}

% 10 Jun 2010: Added memoir/array compatibility, switched to pict2e, changed some flags.
%              Updated documentation to describe the new features.

% 17 Feb 2004: Corrected some typos in documentation

\usepackage{drs,pict2e}
\usepackage{times}

\chardef\BS=`\\ % It only works in \tt font     

\def\ctt#1{{\texttt{\BS #1}}} % \ctt command  --> \command (in tt)
\def\citem[#1 #2]{\item[\ctt{#1}{\textsl{#2}}]} % header of command plus argument

\advance\textheight by 0.7in
\advance\textwidth by 0.8 in
\advance\oddsidemargin by -0.4in
\topmargin=-0.3in

\begin{document}

\begin{center}
{\bfseries Drs.sty, a \LaTeX\ package for  Discourse Representation Structures} 
\\[6pt]
Alexis Dimitriadis \\[6pt]
Version 1.1\\[6pt]
June 10, 2010 \\[1.5ex]
\end{center}

\noindent 
This package draws Discourse Representation Structures (DRSs).  It can draw
embedded DRSs, if-then conditions and quantificational ``duplex conditions''
(with a properly scaled connecting diamond).  Formatting parameters allow the
user to control the appearance and placement of DRSs, and of DRS variables and
conditions.

You should use this package together with \emph{pict2e.sty,} which allows better diagonal lines to be drawn. It is not automatically loaded by \emph{drs.sty,} but will be utilized if it you do load it.

\section{History}

This package is derived from the DRS macros in the style \emph{covington.sty,}
written by Michael A. Covington.  I am grateful to him for allowing
modification and redistribution of his code.  The present style retains the
basic design (command syntax, use of the \verb|tabular| environment to
construct the DRSs) and is intended to be backward compatible.  It 
adds commands for duplex conditions and logical connectives, formatting
options, better spacing, and an absurdly elaborate algorithm for calculating
the size of the diamond used in duplex conditions.

Please direct suggestions, bug reports, or other comments to Alexis
Dimitriadis, \emph{a.dimitriadis} \emph{@uu.nl.}
As usual, 
I cannot promise this package will do what you want it to, but I will 
try to help if there is a problem.


\section{Box-building commands}
These commands can be embedded in each other as desired.  

\begin{description}
\citem [drs \{variables\}\{conditions\}]~

        Typesets a DRS in a box according to the formatting options in
effect (see below).  Conditions should be separated by \verb|\\|.  If the
variables argument is completely empty (given as \verb|{}|), no space is
provided for variables at the top of the box.  To leave an empty line, give a
space as the list of variables (\verb|{ }| or \verb|{~}|).

\begin{verbatim}
\drs{x y}{Jones(x) \\ Ulysses(y) \\ x owns y}
\end{verbatim}
\drs{x y}{Jones(x) \\ Ulysses(y) \\ x owns y}

\newpage
\citem[drs* \{variables\}\{conditions\}]~

Top-level DRSs are positioned on the page according to a number of formatting
parameters (see next section).  To generate a DRS without the extra spacing,
define it using \verb|\drs*| rather than \verb|\drs|.

\citem[ifdrs \{lvar\}\{lcond\}\{rvar\}\{rcond\}]

Forms two DRSs joined by an arrow. This command is just a special case of \verb|\condrs|.

\begin{verbatim}
\drs{x}{Jones(x) \\
  \ifdrs{y}{donkey(y)\\x owns y} 
        {z w}{z = x\\ w = y\\ z feeds w}} 
\end{verbatim}

\drs{x}{Jones(x) \\
  \ifdrs{y}{donkey(y)\\x owns y} {z w}{z = x\\ w = y\\ z feeds w}}
%If Jones owns a donkey, he feeds it.

\citem[condrs \{lvar\}\{lcond\}\{connective\}\{rvar\}\{rcond\}]~

Connects two DRSs with the middle argument, presumably a logical connective
like \verb|$\vee$| or \verb|$\wedge$|.  (You must manually switch to math mode
if it's needed).  This is provided as a separate
command because the spacing needs certain adjustments.  The connective is always put in size \verb|\large|, which is appropriate for normal-sized text. If the text of your DRS is in a different size, manually resize the connective to be one step larger; for example, 
\verb|{\LARGE $\vee$}| if the DRS text is \verb|\Large|.

\citem[qdrs \{lvar\}\{lcond\}\{quantifier\}\{qvar\}\{rvar\}\{rcond\}]~\par

Forms a duplex condition.  The arguments \emph{quantifier} and \emph{qvar} are
placed in the diamond connecting the left and right DRSs, which is sized to
fit them.  The \emph{quantifier} argument may contain newlines (\verb|\\|), if necessary.

\begin{verbatim}
\drs{X}{ the lawyers(X) \\
    \qdrs{x}{x $\in$ X} 
         {every}{x} 
         {y}{secretary(y) \\ x hired y}}
\end{verbatim}
\drs{X}{ the lawyers(X) \\
         \qdrs{x}{x $\in$ X}  {every}{x} {y}{secretary(y) \\ x hired y}}

\citem[negdrs \{variables\}\{conditions\}]~

Produces a DRS preceded by the negation symbol.

\citem[drsdiamond \{quantifier\}\{variable\}] ~ 

Produces the
automatically scaling diamond used by \verb|\qdrs|.  Perhaps it is useful to call it
directly for specialized uses.  An absurdly fancy scaling algorithm
draws a diamond of the right size and places the text at the right height.
The algorithm is optimized for cases where the variable is narrower than the
quantifier text, but works well for a variety of shapes, including multi-line
quantifier names (use {\tt \BS\BS} to break lines, as in: {\tt
at~least\BS\BS one}).  If it does the wrong thing 
for you, try padding the text with non-breaking spaces (\verb|~|).

\end{description}

\noindent
For compatibility with the \emph{covington.sty} macros, the following commands
are also supported:

\begin{description}
\citem[sdrs \{sentence\}\{variables\}\{conditions\}] ~

Just like \verb|\drs|, but 
the first argument is a sentence to be displayed above the DRS.

\citem[alifdrs \{lvar\}\{lcond\}\{rvar\}\{rcond\}]~

Just like \verb|\ifdrs|, but shifted to the left so that the conditions in it,
if left-adjusted, will line up with unembedded DRS conditions.

\end{description}

\section{Formatting parameters}

The following commands may be redefined to control the appearance of the DRS
boxes. 

\begin{description}

\citem[drscondfont ]  The font used for the DRS conditions. Default:
\verb|\rm|. If necessary, it can be redefined to a macro that takes an argument, e.g.:

 \verb|\renewcommand\drscondfont[1]{\emph{#1}}| 
 
 The font properties selected with this macro (e.g., italics) will also apply to the DRS variables, except as overridden by \verb|\drsvarfont|.

\citem[drsvarfont ]  Additional font settings used for the DRS variables. This macro modifies the font style already in effect from \verb|\drscondfont|.  Default:
 \verb|\it|.   If necessary, it can be redefined to a macro that takes an argument.

\citem[drsseparator ] The separator between variables and conditions.  By
default it is \verb|\hline|, but can be redefined to suppress the line (or to draw
other line styles, if appropriate).   To suppress the line, put the following
in the preamble of your document:

\verb|\renewcommand\drsseparator{\relax}|

\citem[drsalignment ] Alignment of the contents of the DRS, in the form of a
\{tabular\} alignment parameter.  The default is {\tt c} (centered) but can be
changed to {\tt l} (or even {\tt r} if you wish).

\citem[drsboxalignh ]   Horizontal alignment of the top-level DRS box in the surrounding text.
You can ask for left-aligned ({\tt l}) or centered boxes.  The default is {\tt c.}

\citem[drsboxalignv ]  Vertical alignment of the top-level DRS box with the
baseline of the text.  The default is {\tt c} (centered on the baseline); {\tt t} and
{\tt b} are also available.  Embedded DRS boxes are always centered on the
baseline.

\citem[drsarraystretch ]  This parameter gives the value of
\verb|\arraystretch| used when making DRS boxes.  Undefined by default, which
is equivalent to the value~\emph{1.0.} You can change it to other numbers (without a dimension) to stretch or compress linespacing.

\citem[drslinewidth ] The thickness of the lines used to draw the DRS boxes. The default is the current value of \verb|\arrayrulewidth| (which controls the width of table borders), normally 0.4pt. If you redefine this you should definitely load the package \emph{pict2e.sty} (recommended anyway), which will allow LaTeX to set the diagonal lines of the quantifier diamond to the same thickness.

\end{description}


\subsection{Compatibility with \emph{covington.sty}}

Although this package should accept DRSs written for the \emph{covington.sty}
macros, the appearance of the output is not the same by default.  To match
that style, specify the following formatting parameters:

\begin{itemize}
\item[]
\begin{verbatim}
\renewcommand\drscondfont{\it} 
\renewcommand\drsalignment{l}   
\renewcommand\drsboxalignh{l}       
\end{verbatim}
\end{itemize}


\section{Other packages}

I recommend that you use \emph{drs.sty} in conjunction with \emph{pict2e.sty,}
which improves \LaTeX's picture drawing capabilities.  Your DRS diamonds will look a lot
better if you do. \emph{Drs.sty} is also compatible with \emph{eepic.sty,} which has similar
function but only works for DVI output (with PostScript enhancements). \emph{Drs.sty} will not
automatically load either package, but will take advantage of their capabilities if one is  loaded.

I have tried to make \emph{drs.sty} work well with doublespacing.  Because of
shortcomings of the doublespacing macros, the boxes might still be placed
too close to each other.  Perhaps some day this will be corrected in future versions
of \emph{setspace.sty} (but I requested the fix years ago, so don't hold your breath).  Until then, I have provided a work-around which you
can use if you are using \emph{setspace.sty.}  Place the command
\verb|\drshacksetspace| in your document preamble, somewhere after both packages
have been included, to redefine certain \emph{setspace} internals so that
boxes can be properly spaced.   This is turned off by default since it
is a hack and might cause unexpected problems.

Starting with version 1.1, \emph{drs.sty} is compatible with \emph{memoir.cls} and the reimplementation of the \emph{tabular} and \emph{array} environments used by \emph{memoir} and \emph{array.sty.} However, the extra column types these provide cannot be used with \emph{drs} commands. Only {\tt c, l} and {\tt r} are accepted.

\end{document}