Logical markup.

Index entries.
diff --git a/Doc/lib/libframework.tex b/Doc/lib/libframework.tex
index 85e3156..6e77870 100644
--- a/Doc/lib/libframework.tex
+++ b/Doc/lib/libframework.tex
@@ -2,7 +2,7 @@
 \stmodindex{FrameWork}
 \label{module-FrameWork}
 
-The \code{FrameWork} module contains classes that together provide a
+The \module{FrameWork} module contains classes that together provide a
 framework for an interactive Macintosh application. The programmer
 builds an application by creating subclasses that override various
 methods of the bases classes, thereby implementing the functionality
@@ -11,18 +11,17 @@
 non-standard way it is not necessary to override the complete event
 handling.
 
-The \code{FrameWork} is still very much work-in-progress, and the
+The \module{FrameWork} is still very much work-in-progress, and the
 documentation describes only the most important functionality, and not
 in the most logical manner at that. Examine the source or the examples
 for more details.
 
-The \code{FrameWork} module defines the following functions:
+The \module{FrameWork} module defines the following functions:
 
-\setindexsubitem{(in module FrameWork)}
 
 \begin{funcdesc}{Application}{}
 An object representing the complete application. See below for a
-description of the methods. The default \code{__init__} routine
+description of the methods. The default \method{__init__()} routine
 creates an empty window dictionary and a menu bar with an apple menu.
 \end{funcdesc}
 
@@ -88,23 +87,25 @@
 Set the mouse cursor to an arrow.
 \end{funcdesc}
 
-\subsection{Application objects}
+\subsection{Application Objects}
+\label{application-objects}
+
 Application objects have the following methods, among others:
 
 \setindexsubitem{(Application method)}
 
 \begin{funcdesc}{makeusermenus}{}
 Override this method if you need menus in your application. Append the
-menus to \code{self.menubar}.
+menus to the attribute \member{menubar}.
 \end{funcdesc}
 
 \begin{funcdesc}{getabouttext}{}
 Override this method to return a text string describing your
-application. Alternatively, override the \code{do_about} method for
-more elaborate about messages.
+application.  Alternatively, override the \method{do_about()} method
+for more elaborate ``about'' messages.
 \end{funcdesc}
 
-\begin{funcdesc}{mainloop}{\optional{mask, wait}}
+\begin{funcdesc}{mainloop}{\optional{mask\optional{, wait}}}
 This routine is the main event loop, call it to set your application
 rolling. \var{Mask} is the mask of events you want to handle,
 \var{wait} is the number of ticks you want to leave to other
@@ -117,13 +118,14 @@
 windows and dialogs, handling drags and resizes, Apple Events, events
 for non-FrameWork windows, etc.
 
-In general, all event handlers should return 1 if the event is fully
-handled and 0 otherwise (because the front window was not a FrameWork
+In general, all event handlers should return \code{1} if the event is fully
+handled and \code{0} otherwise (because the front window was not a FrameWork
 window, for instance). This is needed so that update events and such
 can be passed on to other windows like the Sioux console window.
-Calling \code{MacOS.HandleEvent} is not allowed within \var{our_dispatch}
-or its callees, since this may result in an infinite loop if the
-code is called through the Python inner-loop event handler.
+Calling \function{MacOS.HandleEvent()} is not allowed within
+\var{our_dispatch} or its callees, since this may result in an
+infinite loop if the code is called through the Python inner-loop
+event handler.
 \end{funcdesc}
 
 \begin{funcdesc}{asyncevents}{onoff}
@@ -142,7 +144,8 @@
 \end{funcdesc}
 
 \begin{funcdesc}{_quit}{}
-Terminate the event \code{mainloop} at the next convenient moment.
+Terminate the running \method{mainloop()} call at the next convenient
+moment.
 \end{funcdesc}
 
 \begin{funcdesc}{do_char}{c, event}
@@ -165,6 +168,7 @@
 \end{funcdesc}
 
 \subsection{Window Objects}
+\label{window-objects}
 
 Window objects have the following methods, among others:
 
@@ -202,6 +206,7 @@
 \end{funcdesc}
 
 \subsection{ControlsWindow Object}
+\label{controlswindow-object}
 
 ControlsWindow objects have the following methods besides those of
 \code{Window} objects:
@@ -214,40 +219,41 @@
 \end{funcdesc}
 
 \subsection{ScrolledWindow Object}
+\label{scrolledwindow-object}
 
 ScrolledWindow objects are ControlsWindow objects with the following
 extra methods:
 
 \setindexsubitem{(ScrolledWindow method)}
 
-\begin{funcdesc}{scrollbars}{\optional{wantx, wanty}}
+\begin{funcdesc}{scrollbars}{\optional{wantx\optional{, wanty}}}
 Create (or destroy) horizontal and vertical scrollbars. The arguments
 specify which you want (default: both). The scrollbars always have
 minimum \code{0} and maximum \code{32767}.
 \end{funcdesc}
 
 \begin{funcdesc}{getscrollbarvalues}{}
-You must supply this method. It should return a tuple \code{x, y}
-giving the current position of the scrollbars (between \code{0} and
-\code{32767}). You can return \code{None} for either to indicate the
-whole document is visible in that direction.
+You must supply this method. It should return a tuple \code{(\var{x},
+\var{y})} giving the current position of the scrollbars (between
+\code{0} and \code{32767}). You can return \code{None} for either to
+indicate the whole document is visible in that direction.
 \end{funcdesc}
 
 \begin{funcdesc}{updatescrollbars}{}
 Call this method when the document has changed. It will call
-\code{getscrollbarvalues} and update the scrollbars.
+\method{getscrollbarvalues()} and update the scrollbars.
 \end{funcdesc}
 
 \begin{funcdesc}{scrollbar_callback}{which, what, value}
-Supplied by you and called after user interaction. \code{Which} will
-be \code{'x'} or \code{'y'}, \code{what} will be \code{'-'},
+Supplied by you and called after user interaction. \var{which} will
+be \code{'x'} or \code{'y'}, \var{what} will be \code{'-'},
 \code{'--'}, \code{'set'}, \code{'++'} or \code{'+'}. For
-\code{'set'}, \code{value} will contain the new scrollbar position.
+\code{'set'}, \var{value} will contain the new scrollbar position.
 \end{funcdesc}
 
 \begin{funcdesc}{scalebarvalues}{absmin, absmax, curmin, curmax}
 Auxiliary method to help you calculate values to return from
-\code{getscrollbarvalues}. You pass document minimum and maximum value
+\method{getscrollbarvalues()}. You pass document minimum and maximum value
 and topmost (leftmost) and bottommost (rightmost) visible values and
 it returns the correct number or \code{None}.
 \end{funcdesc}
@@ -270,6 +276,7 @@
 \end{funcdesc}
 
 \subsection{DialogWindow Objects}
+\label{dialogwindow-objects}
 
 DialogWindow objects have the following methods besides those of
 \code{Window} objects:
diff --git a/Doc/lib/libminiae.tex b/Doc/lib/libminiae.tex
index d898551..a1cd6f4 100644
--- a/Doc/lib/libminiae.tex
+++ b/Doc/lib/libminiae.tex
@@ -1,61 +1,63 @@
-\section{Standard Module \sectcode{MiniAEFrame}}
+\section{Standard Module \module{MiniAEFrame}}
 \stmodindex{MiniAEFrame}
 \label{module-MiniAEFrame}
 
-The module \var{MiniAEFrame} provides a framework for an application
-that can function as an OSA server, i.e. receive and process
-AppleEvents. It can be used in conjunction with \var{FrameWork} or
-standalone.
+The module \module{MiniAEFrame} provides a framework for an application
+that can function as an Open Scripting Architecture
+\index{Open Scripting Architecture}
+(OSA) server, i.e. receive and process
+AppleEvents\index{AppleEvents}. It can be used in conjunction with
+\module{FrameWork}\refstmodindex{FrameWork} or standalone.
 
 This module is temporary, it will eventually be replaced by a module
 that handles argument names better and possibly automates making your
 application scriptable.
 
-The \var{MiniAEFrame} module defines the following classes:
+The \module{MiniAEFrame} module defines the following classes:
 
-\setindexsubitem{(in module MiniAEFrame)}
 
-\begin{funcdesc}{AEServer}{}
+\begin{classdesc}{AEServer}{}
 A class that handles AppleEvent dispatch. Your application should
 subclass this class together with either
-\code{MiniAEFrame.MiniApplication} or
-\code{FrameWork.Application}. Your \code{__init__} method should call
-the \code{__init__} method for both classes.
-\end{funcdesc}
+\class{MiniApplication} or
+\class{FrameWork.Application}. Your \method{__init__()} method should
+call the \method{__init__()} method for both classes.
+\end{classdesc}
 
-\begin{funcdesc}{MiniApplication}{}
+\begin{classdesc}{MiniApplication}{}
 A class that is more or less compatible with
-\code{FrameWork.Application} but with less functionality. Its
-eventloop supports the apple menu, command-dot and AppleEvents, other
+\class{FrameWork.Application} but with less functionality. Its
+event loop supports the apple menu, command-dot and AppleEvents; other
 events are passed on to the Python interpreter and/or Sioux.
-Useful if your application wants to use \code{AEServer} but does not
+Useful if your application wants to use \class{AEServer} but does not
 provide its own windows, etc.
-\end{funcdesc}
+\end{classdesc}
+
 
 \subsection{AEServer Objects}
+\label{aeserver-objects}
 
-\setindexsubitem{(AEServer method)}
-
-\begin{funcdesc}{installaehandler}{classe, type, callback}
-Installs an AppleEvent handler. \code{Classe} and \code{type} are the
-four-char OSA Class and Type designators, \code{'****'} wildcards are
-allowed. When a matching AppleEvent is received the parameters are
+\begin{methoddesc}[AEServer]{installaehandler}{classe, type, callback}
+Installs an AppleEvent handler. \var{classe} and \var{type} are the
+four-character OSA Class and Type designators, \code{'****'} wildcards
+are allowed. When a matching AppleEvent is received the parameters are
 decoded and your callback is invoked.
-\end{funcdesc}
+\end{methoddesc}
 
-\begin{funcdesc}{callback}{_object, **kwargs}
+\begin{methoddesc}[AEServer]{callback}{_object, **kwargs}
 Your callback is called with the OSA Direct Object as first positional
 parameter. The other parameters are passed as keyword arguments, with
-the 4-char designator as name. Three extra keyword parameters are
+the 4-character designator as name. Three extra keyword parameters are
 passed: \code{_class} and \code{_type} are the Class and Type
 designators and \code{_attributes} is a dictionary with the AppleEvent
 attributes.
 
 The return value of your method is packed with
-\code{aetools.packevent} and sent as reply.
-\end{funcdesc}
+\function{aetools.packevent()} and sent as reply.
+\end{methoddesc}
 
 Note that there are some serious problems with the current
-design. AppleEvents which have non-identifier 4-char designators for
-arguments are not implementable, and it is not possible to return an
-error to the originator. This will be addressed in a future release.
+design. AppleEvents which have non-identifier 4-character designators
+for arguments are not implementable, and it is not possible to return
+an error to the originator. This will be addressed in a future
+release.