% \iffalse meta-comment
%
% Copyright 2002-2003 M. C. DeMarco
% Also copyright any individual authors listed in this file.
%
% This file provides the latex class sffms.cls and supporting files.
% ------------------------------------------------------------------
% 
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License, either version 1.2 of this license or
% (at your option) any later version.
% The latest version of this license is in
%    http://www.latex-project.org/lppl.txt
% and version 1.2 or later is part of all distributions of LaTeX 
% version 1999/12/01 or later.
%
% ** To produce the package documentation, run latex on this file. **
%
% \fi
% 
% \iffalse
%<*driver>
\documentclass{ltxdoc}
 \OnlyDescription % Comment out to print the code as well
\begin{document}
 \title{The \textsf{sffms} package}
 \author{M. C. DeMarco\\
         \texttt{mcd@sdf.lonestar.org}}
 \date{2003/03/13}
 \maketitle
 \DocInput{sffms.dtx}
\end{document}
%</driver>
% \section{Identification}
%    \begin{macrocode}
%<sffms>\NeedsTeXFormat{LaTeX2e}
%<sffms>\ProvidesClass{sffms}[2003/03/13 v2.0
%<smart>\ProvidesPackage{sffsmart}[2001/09/10 v1.0
%<dumb>\ProvidesPackage{sffdumb}[2001/09/23 v1.1
%<sffms> The SF/F manuscript class]
%<smart|dumb> Quotation mark utility for sffms.cls]
%    \end{macrocode}
% \fi
%
% \changes{v0.1}{2001/08/29}{Created sffms.cls from sfms.cls by Kevin
%    Russell} 
% \changes{v0.1}{2001/08/29}{Passed all options to report.cls, making
%    the non-submission format mostly transparent.  The only additions
%    were real typeset scene breaks (a blank line) and real book
%    headers (author and title on facing pages) for the twoside option.}  
% \changes{v0.1}{2001/08/29}{Changed the commands slightly, gave most
%    of them default values, and added commands for user configuration
%    of the scene separator and ``The End''.}  
% \changes{v0.1}{2001/08/29}{Reredefined chapter so that chapter*
%    works in submissions, changed fancyheader calls to non-deprecated
%    versions.}  
% \changes{v0.1}{2001/08/29}{Added rudimentary documentation to the
%    class file.}  
% \changes{v0.2}{2001/09/02}{Added the magic command from ulem.sty to
%    change boldface (\bf) to squiggly lines in submission format}  
% \changes{v0.2}{2001/09/02}{Added quote smartening option (using
%    quote.sty), novel option and notitle option}  
% \changes{v0.2}{2001/09/02}{Fixed the a4paper option, I hope} 
% \changes{v0.2}{2001/09/02}{Added the ifsubmission command to mask
%    fancy markup (and text)}  
% \changes{v0.2}{2001/09/02}{Added the synopsis environment for book
%    synopses}  
% \changes{v0.2}{2001/09/02}{Changed spacing to 1.83 and neatened the
%    code} 
% \changes{v0.3}{2001/09/04}{Added quote dumbing option} 
% \changes{v0.3}{2001/09/04}{Ported sffms.cls and support files to
%    dtx file, added more documentation}  
% \changes{v0.3}{2001/09/04}{Switched from doublespace package to
%    setspace}  
% \changes{v1.0}{2001/09/10}{Improved documentation}  
% \changes{v1.0}{2001/09/10}{Reworked submission title page spacing and
%    added the disposable command}  
% \changes{v1.1}{2001/09/23}{Cut back on non-submission formatting}  
% \changes{v1.1}{2001/09/23}{Fixed spacing for ``The End''}  
% \changes{v1.1}{2001/09/23}{Quote spacing fixed and code for sffdumb
%    improved, thanks to Donald Arsenault and Martin Vaeth}   
% \changes{v1.2}{2002/03/17}{Added documentation}
% \changes{v1.2}{2002/03/17}{Code cleanup, thanks to Daniel Richard G.}
% \changes{v1.2}{2002/03/17}{Added submit, nosubmit and msheading
%    commands}
% \changes{v1.3}{2002/03/17}{Double underline for textsc}
% \changes{v1.3}{2002/03/18}{Added undocumented command pageofpages}
% \changes{v1.3}{2002/03/18}{Made a rough automatic word count}
% \changes{v1.3}{2002/03/23}{Fixed automatic word count}
% \changes{v1.3}{2002/03/23}{Hid some internal defs and cleaned up code}
% \changes{v1.3}{2002/03/23}{Documented LaTeX spacing commands}
% \changes{v2.0}{2003/03/13}{Removed dependencies on ifthen and geometry 
%    packages, made geometry an option} 
% \changes{v2.0}{2003/03/13}{Added baen, daw and wotf options}
% \changes{v2.0}{2003/03/13}{Added troubleshooting section, a table of
%    contents, and various other improvements to the documentation}
%
%
% \newcommand{\DescribeOption}[1]{\DescribeEnv{[#1]}}
%
% \begin{abstract}\noindent
% Documentation for |sffms|, a \LaTeX\ class for typesetting fiction
% manuscripts in the standard formats used in science-fiction/fantasy
% publishing.
% \end{abstract}
%
% \noindent
% This \LaTeX\ class was modified from |sfms.cls|, copyright Kevin Russell
% 2000, under the terms of the \LaTeX\ Project Public License.
% The file |sffms.dtx| may be redistributed and/or modified under the
% terms of the \LaTeX\ Project Public License, distributed from CTAN 
% archives in the directory macros/latex/base/lppl.txt---either
% version 1.2 of the License, or any later version.
%
% 
% \newif\ifmulticols
% \IfFileExists{multicol.sty}{\multicolstrue}{}
% \ifmulticols
% \addtocontents{toc}{%
% \protect\setlength{\columnsep}{3pc}%
% \protect\begin{multicols}{2}}
% \fi
% {\parskip 0pt 
% \tableofcontents
% }
%
% \section{About {\tt sffms}}
%
%  The |sffms| package produces a double-spaced manuscript in a 12-point 
%  monospaced font with one-inch margins and running headers of the form 
%  |Author/TITLE/n|, where |n| is the current page number.  
%  On the title page, the author's name and address appear in the upper 
%  left corner, the word count and an optional note that the manuscript 
%  is disposable in the upper right, and the title and author in the 
%  center of the page. For a short story, the text begins four lines 
%  below, and for a novel, on the next page.  Some publisher-specific 
%  variants of the format are also supported.
%
%  Other features of |sffms| include an optional single-spaced synopsis,
%  automatic conversion of italics, boldface, and small caps to
%  appropriately underlined text, and a rough automatic word count.
%  Simply by including the |nonsubmission| option,
%  the same document may be typeset in \LaTeX's usual professional 
%  way.  The non-submission format can be customized without 
%  affecting the appearance of the version for submission, allowing 
%  the user to print both camera-ready copies and submission 
%  manuscripts from a single story file.
%  
%  The \LaTeX\ document preparation system is free and available for 
%  all operating systems. This package and all supporting packages 
%  are available from \textsc{ctan}.  To obtain any recent version of 
%  |sffms|, copies of the supporting packages, sample input and output 
%  files, a list of known issues, and more information about manuscript 
%  format, see |http://mcd.freeshell.org/|.  If you still have questions 
%  or suggestions after reading through this documentation, feel free to 
%  email the author at |mcd@sdf.lonestar.org|.
%
% \section{Getting Started}
%
%  If you are already familiar with \LaTeX, you may wish to skip 
%  this section.
%
% \subsection{Installing \LaTeX}
%
%    \LaTeX\ is available for all operating systems, in a bewildering
%    variety of implementations.  For the beginner, I recommend the 
%    following popular combinations of an underlying \TeX\ engine and
%    a nice front-end and/or text editor:
%
%    For Windows, MiKTeX (|www.miktex.org|) and WinEdt (|www.winedt.com|).
%
%    For MacOS X, TeXLive-teTeX and TeXShop (both available at \\
%    |www.uoregon.edu/~koch/texshop/texshop.html|).
%
%    For MacOS 9 and below, OzTeX and Alpha.  (See
%    |www.esm.psu.edu/mac-tex/| for links.)
%
%    For Unix systems, emacs and \TeX\ should come pre-installed, but
%    you might want to look into teTeX (|www.tug.org/tetex|).
%
%    Some of these packages use A4 as their default paper size.  See the
%    Troubleshooting section for more details.
%
% \subsection{Installing {\tt sffms}}
%
%    If you use a \TeX\ package management system to install |sffms|, you 
%    need not follow the rest of the steps in this section, but you will 
%    probably need to install the supporting packages listed below.
%    Be sure that you get the most recent version of |sffms|.  The 
%    version can be identified either by the date or the version 
%    number.
%
%    The |sffms| class is distributed as two files, |sffms.dtx| and 
%    |sffms.ins|.
%    To install the class manually, run \LaTeX\ on |sffms.ins|.  
%    You can do this either by opening |sffms.ins| in your front-end 
%    (WinEdt or TeXShop) and hitting the \LaTeX\ button,
%    or by typing the following at the command line:
%\begin{verbatim}
%latex sffms.ins
%\end{verbatim}
%    \LaTeX\ will automatically create the style files
%    |sffms.cls|, |sffsmart.sty| and |sffdumb.sty|.   At this point, 
%    you may either move the new files into the appropriate directory 
%    of your \LaTeX\ distribution, or leave them in the directory
%    where your source files (stories) will be.
%
%    The |sffms| class requires several supplemental style files which
%    may or may not be included in your \LaTeX\ or |sffms| distribution.
%    Try running a sample story file through \LaTeX\ (see below).  
%    If \LaTeX\ asks for any of the following files, you will need 
%    to download them and place them in the directory where you put 
%    |sffms.cls|.  The files are:
%\begin{verbatim}
%fancyhdr.sty
%setspace.sty
%ulem.sty
%\end{verbatim}
%    As of version 2.0 of |sffms|, the |geometry| package is no longer 
%    required.  If you decide to use it, obtain |geometry.dtx| and 
%    |geometry.ins| and latex the latter, as you did with |sffms.ins|.
%
%    All of the files mentioned above 
%    are available through {\sc ctan} (|www.ctan.org|).
%
%
% \subsection{Using {\tt sffms}}
%
%  All you need to use |sffms| is a plain text file with the following
%  contents:
%\begin{verbatim}
%\documentclass{sffms}
%\author{Lois McMaster Bujold}
%\title{Komarr}
%\begin{document}
%Your story goes here.
%\end{document}
%\end{verbatim}
%
%    Call this source file |filename.tex| and latex it by typing
%\begin{verbatim}
%latex filename.tex
%latex filename.tex
%\end{verbatim}
%    \LaTeX\ should be run twice in order to get the correct word count.
%
%    Depending on your \LaTeX\ installation, this command may produce
%    an output file in |dvi|, |ps|, or |pdf| format.  If you prefer |pdf|
%    output, you may find it more convenient to use the |pdflatex| command.
%
% 
% \subsection{\LaTeX\ Basics}
%
%    A \LaTeX\ file is essentially a text file.  If you take a plain
%    text version of your story and insert the lines mentioned in the
%    previous section (|\documentclass|, {\em etc.}), it will be almost
%    ready for \LaTeX.  Just keep the following requirements in mind:
%
%    Paragraphs should be separated by a blank line.
%
%    Use |-| for a hyphen, |--| for an en-dash (for ranges, like
%    18--65), and |---| for an em-dash---the one used as punctuation. 
%
%    Normal \LaTeX\ ``smart
%    quotes'' are produced using a pair of accents (usually found 
%    under the $\sim$ key) and a pair of
%    apostrophes, like so:  |``smart quotes''|.  A good \LaTeX\ editor
%    ({\it e.g.}, emacs) will insert smart quotes automatically when
%    you strike the dumb quote (|"|) key.  You may also use dumb
%    quotes with |sffms|---see the section on handling quotation
%    marks, below.  Note that |```| becomes ``\thinspace`.  To produce 
%    `\thinspace{``} instead, use braces, like so:  |`{``}|.  Likewise,
%    use |'{''}| if |'''| fails to do the job. 
%
%    Certain characters are reserved by \LaTeX\ for special purposes: 
%\begin{verbatim}
%# $ % & ~ _ ^ \ { }
%\end{verbatim}
%    To use a reserved character in a story, you must put a backslash 
%    in front of it (|\$|, |\%|, {\em etc.}), except for |\\|, |\~|, 
%    and |\^|, which have their own special meanings.  
%    (The first is used to force a line break and the latter two 
%    create accent marks over the following character.)  
%    The command |$\backslash$| produces the backslash itself and 
%    |$\sim$| the tilde alone.
%
%    The percent-sign is particularly dangerous because it's the 
%    comment character in \LaTeX.  Anything between an unescaped |%|
%    and the end of the line will be silently ignored by \LaTeX\ 
%    when it processes your file.
%
%\subsection{\LaTeX\ Tricks}
%
%    Depending on your \LaTeX\ installation, you may be able to produce some 
%    common accent marks thus:
%\begin{center}
% \'{a}~~|\'{a}| \hfill \`{e}~~|\`{e}| \hfill  \"{\i}~~|\"{\i}| \hfill
%    \~{o}~~|\~{o}| \hfill \^{u}~~|\^{u}| \hfill \c{c}~~|\c{c}|
%\end{center}
%If you want something a little more alien, try some of the following:
%\begin{verbatim}
%\.{h}  \^{m}  \u{n}  \v{q}  \H{r}  \d{v}  \b{x}  
%\i  \j  \ae  \OE  \l  \o  \ss  \S  ?`  !`  \pounds
%\end{verbatim}
%    Many more symbols are available in \LaTeX's math mode, but keep in 
%    mind that such gimmicks are likely to annoy your editor.
%
%    If you need finer control of your text layout, you can use the
%    |\noindent| command before a paragraph to keep it from
%    being indented.  You can use the |\\| symbol to force a line 
%    break without starting a new paragraph.  (These two methods will have 
%    the same effect for submissions, but not in |nonsubmission| mode.)
%
%    \LaTeX\ ignores all extra spaces between words and sentences, then
%    inserts (approximately) two spaces between sentences.  If you
%    prefer one space after all punctuation, include the command
%\begin{verbatim}
%\frenchspacing
%\end{verbatim}
%    at the beginning of your document.  To force a single space in
%    those rare cases where \LaTeX\ chooses the wrong spacing, use
%    |\ | (a backslash followed by a space) or |~|.
%\begin{verbatim}
%``Put only one space after a quote!''\ she demanded.
%
%``Of course, Dr.~Jones!''
%\end{verbatim}
%    The |~| also prevents a linebreak from occurring between the two 
%    words.  Use it with caution.
%
%    All \LaTeX\ commands begin with a backslash, as in 
%    |\documentclass{sffms}| or |\frenchspacing|.  \LaTeX\ environments
%    begin with a |\begin| command and end with an |\end| command.
%    Two \LaTeX\ environments that may be of use are
%    |verse| and |quotation|:
%\begin{verbatim}
%\begin{verse}
%First line of your verse,\\
%Second line\\
%Third line
%
%Beginning of a new stanza\\
%Etc.
%\end{verse}
%\end{verbatim}
%
%\begin{verbatim}
%\begin{quotation}
%Put normal paragraphs of text here, separated by blank lines as usual.
%They will be indented from the margins, and each paragraph will
%be indented.
%\end{quotation}
%\end{verbatim}
%    Long quotes or verse can be single-spaced, but by default they are
%    not.  See the section
%    on environments for details.  Underlining and boldface are also 
%    discussed in a later section.
%
%
% \section{Declaration of Options}
%
%    The |sffms| class has several {\em options} which change the 
%    appearance of the output.  To use an option, enclose it in 
%    brackets in the |documentclass| declaration in the first line 
%    of your story file.  Separate multiple options with commas.  
%    For example, to use the |novel| and |baen| options, the first line 
%    of the file should read: 
%\begin{verbatim}
%\documentclass[novel,baen]{sffms}
%\end{verbatim}
%
% \subsection{The Submission Options}
%
%\DescribeOption{submission}
%    The |submission| option is now the default and need not be 
%    declared.  This option causes the document to be typeset in 
%    manuscript format, with double spacing, one-inch margins, 
%    and a fixed-width font.  All |sffms| 
%    options except |nonsubmission| may be used with the submission
%    option, though |submission| plus |notitle| will make the output
%    format nonstandard.  (Editors want titles.) 
%
%\DescribeOption{novel}
%    There isn't much difference between a novel and a short story in
%    sf/f manuscripts.  The short story begins on the title page,
%    while the novel begins on a fresh page.  A novel may also have a
%    synopsis. 
%    Use the |novel| option for a novel.  If the |novel| option is
%    {\em not\/} used, the text will be typeset as a short story.
%
%    The |sffms| class now includes publisher-specific options for
%    certain publishers whose
%    requirements differ slightly from the default |submission| style.
%    In all other respects, the story is treated as a normal submission.
%    Publishers' guidelines may change, so check that these options do
%    what you need them to do before using them.
%
%\DescribeOption{baen}
%    The |baen| option uses $1\,\frac{1}{2}$|"| margins rather than 1|"|.
%    Baen Books' requirements are available on-line (|www.baen.com/FAQS.htm|).
%\begin{verbatim}
%\documentclass[baen]{sffms}
%\end{verbatim}
%
%\DescribeOption{daw}
%    The |daw| option typesets the address and wordcount on the 
%    right-hand side of the first page rather than splitting it across
%    the page.  The DAW Books manuscript requirements are available 
%    on-line\\
%    (|www.penguinputnam.com/static/packages/us/about/dawsub.htm|).
%\begin{verbatim}
%\documentclass[daw]{sffms}
%\end{verbatim}
%
%\DescribeOption{wotf}
%    The |wotf| option uses a full cover page (like that of the novel 
%    option) and alters the running header to omit the author's surname,
%    as required by the rules of the Writers of the Future contest 
%    (|www.writersofthefuture.com|).
%    Also, the full title is used in the running header, and page 
%    numbering begins with the first story page, rather than 
%    counting the title page.
%\begin{verbatim}
%\documentclass[wotf]{sffms}
%\end{verbatim}
%
%    To my knowledge, the default submission format does not violate 
%    the guidelines of Tor Books (|www.tor.com/torfaq.html|),\\
%    Analog (|www.analogsf.com/information/submissions.shtml|),\\
%    Asimov's (|www.asimovs.com/info/guidelines.shtml|),\\
%    Fantasy \& Science Fiction (|www.sfsite.com/fsf/glines.htm|),
%    or the Star Trek Strange New Worlds contest.
%
%    Please be sure to include all required contact information within
%    the |address| command, described below.
%
%
% \subsection{Options for Quotation Marks}
%
%    The |sffms| class provides two options for handling ``legacy'' 
%    quotes, be they dumb quotes in a plain text file you want 
%    smartened up for a good copy of your latest novel, or \LaTeX\ 
%    quotes you want to dumb down to give your manuscript that 
%    genuine Courier 12-point typewriter feel. 
%
%    Please note that neither of these options will handle
%    non-{\sc ascii} ``smart'' quotation marks in your source file.
%    All non-{\sc ascii} characters must be eliminated by saving 
%    the file as plain text.  Note that the changes explained below
%    appear in the output only---the source file is never
%    altered. 
%
%\DescribeOption{smart}
%    The |smart| option turns pairs of normal {\sc ascii}
%    quotation marks (|"|dumb quotes|"|) into \LaTeX\  quotation 
%    marks (|``|smart quotes|''|), so that the output file
%    will show true ``smart quotes.''  This option also correctly handles
%    quotations continued between paragraphs.
%
%\DescribeOption{dumb}
%    The |dumb| option suppresses \LaTeX\ |``|smart quotes,|''| 
%    producing dumb, typewriter-style quotes in the output file
%    rather than the slanted ones that are the default in
%    submission mode.
%    The |dumb| option is not useful with the |nonsubmission|
%    option because only monospaced fonts like Courier include
%    a true dumb quotation mark (|"|) at all.
%    Other fonts may substitute a curly close-quote ('') instead, 
%    which looks ''dumber than dumb.''
%   
%    These options are not particularly robust, so they may cause more
%    problems than they solve.  {\em Caveat emptor}.
%    They can handle mixed quotation mark styles (\LaTeX\ smart with
%    {\sc ascii} dumb) if the two sorts of marks are balanced---for
%    example, if some chapters use {\sc ascii} quotes and others
%    \LaTeX\ ones, or even if some sentences are smart and others
%    dumb.
%
%    If these options do not work for you, you can always
%    change the quotation marks in your source file with a good text
%    editor like emacs.
%
%
% \subsection{Non-submission Options}
%
%\DescribeOption{nonsubmission}
%    To force a document to be typeset as a normal book or article
%    (that is, without double-spacing or the fixed-width font), use the 
%    |nonsubmission| option in your |documentclass| declaration:
%\begin{verbatim}
%\documentclass[nonsubmission]{sffms}
%\end{verbatim}
%
%\DescribeOption{notitle}
%    When the |nonsubmission| option is chosen, the |sffms|
%    class creates a default title page.  The |notitle| option will
%    remove it, allowing the user to specify his own \LaTeX\ layout; 
%    |notitle| is also useful for saving paper.
%
%    Because |sffms| is based on the standard \LaTeX\ report class, any
%    other \LaTeX\ report class options may be used for non-submissions,
%    including font size
%    options (|10pt|, |12pt|, {\em etc.}), paper size and other useful
%    typesetting options (|twoside|, |twocolumn|, {\em etc.}).  Using
%    report-class options together with a |submission| option  may
%    generate unexpected results.
%
% \subsection{Other Options}
%
%\DescribeOption{courier}
%    The |courier| option switches to a 12-point, 10-pitch Courier font
%    that may look better than \LaTeX's default monospaced font, 
%    depending on your local \LaTeX\ setup.  Try this option if you want
%    a fatter font than the default or if your |pdf| files are looking
%    grainy.
%
%\DescribeOption{geometry}
%    The |geometry| option forces |sffms| to use the |geometry| package
%    for page layout.  This option is useful for getting around 
%    page size problems.  See the Troubleshooting section for
%    details.
%
%\DescribeOption{a4paper}
%\DescribeOption{letterpaper}
%    If you use geometry with the intent of fixing your papersize,
%    you should declare the desired paper size explicitly.  
%    A4 and letter are the most common choices, but other 
%    paper sizes may also be used.  See the documentation of
%    the geometry package for the full list.
%
%
%  \section{Commands}
%
%  \subsection{Title}
%
%
%\DescribeMacro\title
%    Every story should have a title.  You must specify the title 
%    using the \LaTeX\ |title| command thus:
%\begin{verbatim}
%\title{The Hobbit: or There and Back Again}
%\end{verbatim}
%
%\DescribeMacro\runningtitle
%    In |submission| format, a short form of
%    the title is placed in the page header at the top right of 
%    each page.
%    If your title is long, specify the desired short form thus:
%\begin{verbatim}
%\runningtitle{The Hobbit}
%\end{verbatim}
%    If you fail to provide a |runningtitle|, your |title| will be
%    used instead, no matter how long it is.
%    
%   \subsection{Author}
%
%\DescribeMacro\author
%	Every story must also have an author.  The name included in the
%       \LaTeX\ |author| command is used in the bylines on the title
%       page and synopsis page.  
%       If you use a pseudonym, you may wish to put it here.
%\begin{verbatim}
%\author{Lois McMaster Bujold}
%\end{verbatim}
%
%\DescribeMacro\authorname
%	A separate command, |authorname|, is provided for use with
%       your mailing address.  It might be wise to put your real name
%       here.  If you omit the |authorname| command, the value of
%       |author| will be used with your mailing address.
%\begin{verbatim}
%\authorname{Lois Bujold}
%\end{verbatim}
%
%\DescribeMacro\surname
%	Like |runningtitle|, |surname| is used in page headers.  Whose
%	surname goes in |surname| is up to you.  
%\begin{verbatim}
%\surname{Bujold}
%\end{verbatim}
%       If you omit |surname|, the full value of |author| will be used.
%
%    \subsection{Other Information}
%
%\DescribeMacro\address
%	Your mailing address for the title page is specified with
%	the |address| command.  Separate lines with the \LaTeX\ 
%	linebreak symbol |\\| thus: 
%\begin{verbatim}
%\address{One Vor Way\\
%         Vor. Surleau\\
%         VKD 28945}
%\end{verbatim}
%       Other requested contact information (such as a phone number
%       or email address) should be included here.
%
%\DescribeMacro\wordcount
%	Your word count should also be included on the title page.
%	An approximate word count based on the number of pages will
%       appear automatically.  However, the automatic word count is
%       not rounded off (much) and ought to be replaced by your own
%       rounded-up opinion of the word count.  The |\wordcount| command
%  	is used to set the value manually thus:
%\begin{verbatim}
%\wordcount{85,000}
%\end{verbatim}
%	The automatic word count is generated by multiplying the page
%	count (not including a novel synopsis) by either 250 or 295, 
%       depending on the font pitch and margin size.  The latter
%       figure was obtained by taking a typical page of one of the
%	author's stories, finding the average number of characters
%	per line (71), dividing by six (a ``word''), multiplying by
%	the number of lines on a full page (25), and rounding off.  
%       You may wish to repeat this process or a similar one for your 
%       own stories, since a4 paper and partial pages (among other 
%       things) were not taken into account.
%
%\DescribeMacro\disposable
%       The |disposable| command causes the words ``Disposable Copy''
%       to be printed under the word count on the title page of
%       submissions. 
%
%  \subsection{Sectioning Commands}
%
%\DescribeMacro\newscene
%	For short stories, the only breaks should be scene breaks.
%	Place the |newscene| command wherever you want a scene break.
%\begin{verbatim}
%...the last few words of the previous scene.
%
%\newscene
%
%Time to start a new scene...
%\end{verbatim}
%	This command inserts the proper scene break character, a
%	centered hash mark (|#|), in
%	submissions, and a blank line in non-submissions.
%
%\DescribeMacro\sceneseparator
%	If you would prefer to use a different scene separator, such
%       as |*****|, the |sceneseparator| command will change it.
%\begin{verbatim}
%\sceneseparator{$\star\star\star\star\star$}
%\end{verbatim}
%       Beware of \LaTeX\ special characters when using this command. 
%
%\DescribeMacro\chapter
%	For a novel, you can use both chapters and scenebreaks.  The
%	\LaTeX\ chapter commands have been redefined in |sffms| to 
%	fit the |submission| format.  Begin a new chapter thus: 
%\begin{verbatim}
%\chapter{Miles High}
%\end{verbatim}
%\DescribeMacro{\chapter*}
%	The \LaTeX\ |\chapter*| command also works in submissions.
%	It creates an unnumbered chapter, such as a preface or
%	appendix. 
%\begin{verbatim}
%\chapter*{Preface}
%\end{verbatim}
%
%\DescribeMacro\thirty
%	Last, but not least, comes the end.  The default
%	end-of-story symbol, five hash marks (|# # # # #|), is inserted
%	automatically at the end of your story.  To change it, use the
%	|thirty| command. 
%\begin{verbatim}
%\thirty{The End}
%\end{verbatim}
%
% \subsection{Italics, Boldface and Small Caps}
%
%	In submission mode, italicized text is automatically converted
%       to underlined text.  Boldface is replaced 
%       by wavy underlining and small caps by double underlining.
%
%\DescribeMacro\em
%       The |\em| command may be used for single italicized words; it 
%	goes inside the braces with the word, thus:
%\begin{verbatim}
%I can't believe that {\em you}, of all people...
%\end{verbatim}
%       This produces underlining by default and italics in
%       non-submissions.
%\DescribeMacro\emph
%       To underline (italicize) anything from a word to a paragraph,
%       use the |\emph| command.  With |\emph|, the curly braces come
%       after the command.  
%\begin{verbatim}
%\emph{I can't believe that they, of all people...}
%\end{verbatim}
%\DescribeMacro\thought
%       The |\thought| command works exactly like |\emph|, but may
%       be useful to the author for distinguishing between normal 
%       italics and italicized thoughts within the source file. 
%       To italicize more than one paragraph, use one |\emph|
%       or |\thought| per paragraph.
%
%\DescribeMacro\bfseries
%\DescribeMacro\textbf
%       The |\bfseries| font declaration and the |\textbf| font command
%       will produce boldface in
%       non-submissions and wavy underlines in |submission| mode.  The 
%       font declaration goes inside the curly braces and the font 
%       command outside, thus: 
%\begin{verbatim}
%I can't believe that {\bfseries you}, of \textbf{all people}...
%\end{verbatim}
%
%\DescribeMacro\scshape
%\DescribeMacro\textsc
%       The |\scshape| font declaration and the |\textsc| font command 
%       will produce small caps in
%       |nonsubmission| mode and double-underlined text in submissions.
%       They work exactly like the corresponding boldface commands:
%\begin{verbatim}
%I can't believe that {\scshape you}, of \textsc{all people}...
%\end{verbatim}
%
%	Since they can be used for individual words as well as phrases 
%	and paragraphs, you may wish to use |\emph{}|, |\textbf{}|,
%	and |\textsc{}| in all cases to avoid confusion.
%
% \subsection{Other Commands}
%
%\DescribeMacro\ifsubmission
%	The |ifsubmission| command is used to hide latex code or text.
%	The first argument is evaluated for submissions, and ignored
%	otherwise, and vice versa for the second.  It can be used in
%	various ways.
%\begin{verbatim}
%\ifsubmission{}{Some comments to myself...}
%\end{verbatim}
%\begin{verbatim}
%\ifsubmission{\thirty{-30-}}{
%  \setlength{\textheight}{8.5in}
%  \setlength{\topmargin}{0in}
%}
%\end{verbatim}
%
%\DescribeMacro\submit
%        Two commands are provided as a convenient shorthand for the 
%        |\ifsubmission| command.  They take one argument each.  
%        Text or commands inside a |\submit| command will be used
%        only for submissions, 
%\DescribeMacro\nosubmit
%        and that in a |\nosubmit| will be used only for
%        non-submissions.  For example, the following command is 
%        equivalent to the first |\ifsubmission| command above.
%\begin{verbatim}
%\nosubmit{Some comments to myself...}
%\end{verbatim}
%
%\DescribeMacro\msheading
%       If for some reason you wish to deviate from the standard running
%       page headings, you can use the |\msheading| command to change
%	them.  To remove headings entirely, use the command:
%\begin{verbatim}
%\msheading{}
%\end{verbatim}
%       To keep just the page number, use: 
%\begin{verbatim}
%\msheading{\thepage}
%\end{verbatim}
%       To add more space between the default heading parts, use:
%\begin{verbatim}
%\msheading{\getsurname\ /\ \getrunningtitle\ /\ \thepage}
%\end{verbatim}
%	For page numbers of the form ``Page 3 of 135,'' use:
%\begin{verbatim}
%\msheading{\pageofpages}
%\end{verbatim}
%       (Check the code for |\pageofpages| to see how it was done.)
%       Reckless use of the |\msheading| command may cause \LaTeX\ 
%       errors.
%
%	Any other \LaTeX\ commands may be used for non-submissions.
%	Using them for submissions may generate unexpected results.
%
%
%  \section{Environments}
%
%\DescribeEnv{synopsis}
%    The only new \LaTeX\ environment in |sffms| is |synopsis|, 
%    intended for use with novels.  
%    In |submission| mode, the synopsis is typeset
%    single-spaced with roman numerals for page numbers to distinguish
%    it from the rest of the novel.
%\begin{verbatim}
%\begin{synopsis}
%Summarize your novel here.
%\end{synopsis}
%\end{verbatim}
%    The synopsis can be placed anywhere after the |\begin{document}|
%    command.    The synopsis environment can
%    also be used without the |novel| option.
%
%\DescribeEnv{singlespace}
%    The |singlespace| and |doublespace| environments are inherited
%    from the |setspace| package which is provides the doublespacing 
%    for |sffms|.  The following will single-space a poem, for example:
%\begin{verbatim}
%\begin{singlespace}
%\begin{verse}
%Oh, what a bore,\\
%To be a Vor.
%\end{verse}
%\end{singlespace}
%\end{verbatim}
%    (See the \LaTeX\ Tricks section for an explanation of the |verse|
%    and |quotation| environments.)
%    You should not need the |doublespace| environment, but it works the 
%    same way.  
%
%
%  \section{Troubleshooting}
%
%	Problems with |sffms| are usually caused by typos in the source 
%	file or by a local \LaTeX\ misconfiguration.  This section
%	covers the most common issues.
%
%  \subsection{Processing Errors}
%
%       If \LaTeX\ complains that it cannot find one or more of |sffms|, 
%	|fancyhdr|, |setspace|, |ulem|, or |geometry|, they may not 
%	have been installed in the correct directory.  If you cannot find
%	the correct spot, or if you are working on a public server
%	where you do not have permission to install new \LaTeX\ packages,
%	you can always put all required files in the folder where the
%       the story file itself is located.  \LaTeX\ will find them 
%	automatically.
%
%	If, in particular, \LaTeX\ cannot find |sffms.cls|, 
%	|sffdumb.sty|, |sffsmart.sty|, or
%	|geometry.sty|, these files may not have been extracted from
%	|sffms.dtx| or |geometry.dtx|.  To create the appropriate files,
%	run latex on |sffms.ins| or |geometry.ins|, respectively,
%	as described in the section on installing |sffms|.
%
%	The first time you run latex on a new story, you may see a 
%	warning that `sffmswc' is undefined and a message telling you
%	to latex the file a second time.  This is normal latex behavior.
%	You should latex the file a second time.
%
%       If \LaTeX\ gives you underfull errors, you can ignore them.
%       If you get overfull errors, you can ignore the small ones
%       (under 5 or 10 points), but for large ones, you should locate 
%       the problem line in the source file (by line number) or in the 
%	output (by looking for lines that poke out into the margin or
%	end suddenly in with black box).  If the overflow is large 
%       you may want to split the problematic line or a word manually 
%       using |\\|.
%	Normally, \LaTeX\ hyphenates words on its own, but hyphenation
%	is suppressed in submission mode.  You should wait until your 
%	story is in a final form before twiddling with overfull errors.
%
%	Font errors can generally be ignored.  If you do not like the
%	appearance of the default font, see the section below on appearance 
%	issues.
%
%	In cases where \LaTeX\ halts with an error, read the error
%	message carefully and then type |x| at the question-mark prompt 
%	to exit.
%	Return to your story file and locate the section that caused 
%	the problem, using either the wording or the line number
%	shown in the error message to help you track it down.
%       Check that you have closed all curly braces and have not
%       accidentally used a special character like |$| or |&|, or 
%       misspelled a command.  See the \LaTeX\ Basics section for
%	a full list of reserved characters.
%
%	If you get a cryptic error like ``There's no line here to end'' 
%	while using the |daw| option,
%	be sure you've included at least a |title|, |author|, and
%	|address|.
%
% \subsection{Margin Problems}
%
%	Margin problems are almost always caused by an incorrect default 
%	paper size setting within your \LaTeX\ installation.  Several
%	popular \LaTeX\ installations come with |a4| set as the default
%	paper size.  Before you blame \LaTeX, however, be sure you 
%	understand what |sffms| is supposed to do.
%
%	For a submission, the bottom margin should be about the same 
%	as the side margins---one inch.  The running page header with
%	your name, title and the page number pokes up into the top
%	margin, making it appear to be less than an inch on the right
%	side.  Everywhere else, however, it should be an inch, or an
%	inch and a half if you are using the |baen| option.
%
% 	If you still think your top margin is too small and the bottom 
%	too big, the problem is almost certainly due to your default
%       paper size setting.  You can use the |geometry| option to
%	attempt to force the correct paper size, thus:
%\begin{verbatim}
%\documentclass[geometry,letterpaper]{sffms}
%\end{verbatim}
%
%	You can add papersize flags to certain commands, such as |dvips|,
%	to work around these problems, but the best approach
%	is to fix your default paper size once and for all, especially if
%	you intend to use the |nonsubmission| option
%	or if the geometry option fails.
%
%	If you are using MiKTeX or a version of teTeX besides the one 
%	installed with TeXShop, you may need to change your
%	default paper size to letter paper.
%	For teTeX, you should be able to adjust this setting
%	either during the installation process or afterwards
%	with the |texconfig| command:
%\begin{verbatim}
%texconfig dvips paper letter
%texconfig xdvi us 
%\end{verbatim}
%	You may also need to edit the \\
%	|/usr/local/teTeX/share/texmf/pdftex/config/pdftex.cfg|
%	file as described below for MiKTeX.  The changes are the same.
%
%	You can fix pdf output in MiKTeX by editing the file \\
%       |\texmf\pdftex\config\pdftex.cfg| in your
%	text editor, replacing the lines
%\begin{verbatim}
%page_width 210 true mm
%page_height 297 true mm
%\end{verbatim}
%	with the following:
%\begin{verbatim}
%page_width 8.5 true in
%page_height 11 true in
%\end{verbatim}
%	You can fix postscript output by editing the file \\
%	|\texmf\dvips\config\config.ps|, changing
%\begin{verbatim}
%@ A4size 210mm 297mm
%@+ %%PaperSize: A4
%
%@ letterSize 8.5in 11in
%\end{verbatim}
%to read only:
%\begin{verbatim}
%@ letterSize 8.5in 11in
%@+ %%PaperSize: Letter
%\end{verbatim}
%	You may still see a problem if you view dvi files in Yap.
%	In that case, open View $\vert$ Options... $\vert$ Display in the
%	Yap menu and change the paper size setting to letter paper.
%	Another possible, but unlikely, culprit is 
%	|\texmf\dvipdfm\config\config|, in which you may wish to change
%	|p a4| to |p letter|.
%
%
%
% \subsection{Other Appearance Issues}
%
%       If your PDF output looks grainy, try using the |courier| option.
%
%       If you get a wordcount of |??|, you probably forgot to latex
%       your file twice.  Latex the file a second time.
%
%	Problems with underlining for italics and boldface have a 
%	couple of likely causes.  
%	The (required) |ulem.sty| package does not officially 
%       support underlining across paragraph breaks, so for 
%       long stretches of underlined text, you should use a separate 
%	font command for each paragraph.  You should use the |\emph|
%	|\textbf| or |\textsc| font commands for multiple words, rather
%	than the |\em|, |\bfseries| or |\scshape| font declarations.
%       Also, other \LaTeX\ font commands which produce boldface, 
%       italics or slanted text, such as |\bf|, |\it|, or |\slshape|,
%       are not supported by |sffms| and will not be converted
%	properly to underlined text.
%
%
%  \section{Credits}
%
%       Many thanks to Kevin Russell for writing |sfms.cls|, which
%       was itself inspired by code posted by Michael Grant
%       to {\tt rec.arts.sf.composition} in July 2000.
%
%	The code for |sffsmart.sty| was adapted from |quote.sty| by
%       Hunter Goatley, available from {\sc ctan}.
%
%	The code for |sffdumb.sty| was adapted from code posted to
%       |comp.text.tex| by Donald Arseneau and improved by advice from
%       the same source.
%
%	Manuscript-style underlining is provided by |ulem.sty| by
%       Donald Arseneau.  Double-spacing is provided by |setspace.sty|
%       by (at least) Geoffrey Tobin and Erica Harris.  Running
%       headers are provided by |fancyhdr.sty| by Piet van Oostrum.
%	The geometry option loads |geometry.sty| by Hideo Umeki.
%
%	Posts to |comp.text.tex| and |rec.arts.sf.composition|,
%       and email from users, notably Daniel Richard G., aided the 
%       development of |sffms|.  Any remaining errors are my own.
%
% \StopEventually{%
%  \ifmulticols
%  \addtocontents{toc}{\protect\end{multicols}}
%  \fi
% }
%
%    \begin{macrocode}
%<*sffms>

\newcounter{wordcounter}
\newcount\wordc
\newif\ifsffms@submit
\newif\ifsffms@novel
\newif\ifsffms@smart
\newif\ifsffms@dumb
\newif\ifsffms@notitle
\newif\ifsffms@courier
\newif\ifsffms@baen
\newif\ifsffms@daw
\newif\ifsffms@wotf
\newif\ifsffms@runningtitle
\newif\ifsffms@surname
\newif\ifsffms@afour
\newif\ifsffms@geometry
\sffms@submittrue

\sfcode`\" = 0

\def\word@count{\ref{sffmswc}}
\def\author@name{\@author}
\def\author@address{}
\def\sur@name{}
\def\running@title{}
\def\scenesepstring{\#}
\def\thirtystring{\# \# \# \# \#}
\def\disposablestring{}
\def\pageofpages{Page {\thepage} of \pageref{sffmswc}}
\def\msheadstring{\getsurname\hspace{.5ex}/\hspace{.5ex}\getrunningtitle\hspace{.5ex}/\hspace{.5ex}\thepage}

\DeclareOption{courier}{%
   \sffms@couriertrue%
   \AtBeginDocument{
        \fontfamily{pcr}\selectfont
     	\renewcommand{\ttdefault}{pcr}
   	\renewcommand{\bfdefault}{pcr}
   	\renewcommand{\itdefault}{pcr}
   	\renewcommand{\sldefault}{pcr}
   	\renewcommand{\scdefault}{pcr}
   	\renewcommand{\updefault}{pcr}
   }
}

\DeclareOption{nonsubmission}{\sffms@submitfalse}
\DeclareOption{submission}{\sffms@submittrue}%obsolete
\DeclareOption{novel}{\sffms@noveltrue}

\DeclareOption{smart}{%
   \sffms@smarttrue%
   \AtBeginDocument{\begindoublequotes}
   \AtEndDocument{\enddoublequotes}
}                         

\DeclareOption{dumb}{\sffms@dumbtrue}
\DeclareOption{notitle}{\sffms@notitletrue}

\DeclareOption{baen}{\sffms@baentrue}
\DeclareOption{daw}{\sffms@dawtrue}
\DeclareOption{wotf}{\sffms@wotftrue}

\DeclareOption{geometry}{\sffms@geometrytrue}

\DeclareOption{a4paper}{
  \sffms@afourtrue%
  \PassOptionsToClass{\CurrentOption}{geometry}
  \PassOptionsToClass{\CurrentOption}{report}}

\DeclareOption{letterpaper}{
  \sffms@afourfalse%
  \PassOptionsToClass{\CurrentOption}{geometry}
  \PassOptionsToClass{\CurrentOption}{report}}


\DeclareOption*{\PassOptionsToClass{\CurrentOption}{report}}
\ProcessOptions



\ifsffms@submit%
 \LoadClass[12pt]{report}
 \RequirePackage[T1]{fontenc}
 \RequirePackage{fancyhdr}
 \RequirePackage{ulem}
 \RequirePackage{setspace}\setstretch{1.83}
 \ifsffms@geometry 
    \ifsffms@baen \RequirePackage[hmargin=1.5in,bmargin=1.5in,tmargin=1.5in,headheight=.38in,headsep=.12in,nofoot]{geometry}%
    \else \RequirePackage[hmargin=1in,bmargin=1in,tmargin=1in,headheight=.88in,headsep=.12in,nofoot]{geometry}%
     \fi%endbaenif
     \fi%endgeometryif
\else\LoadClass{report}%
 \RequirePackage{setspace} \fi

\ifsffms@smart \RequirePackage{sffsmart} \fi
\ifsffms@dumb \RequirePackage{sffdumb} \fi

\ifsffms@submit%
  \ifsffms@geometry%    then margins are all set so do nothing
    \sffms@geometrytrue
  \else% 		have to set margins manually from paperdim
  \setlength\headheight{.38in}
  \setlength\headsep{.12in}
  \setlength\textwidth{\paperwidth}
  \newlength{\sffms@margin}
  \setlength{\sffms@margin}{0in}
  \ifsffms@baen \addtolength{\sffms@margin}{.5in} \fi
  \setlength\textwidth{\paperwidth}
  \addtolength\textwidth{-2in}
  \addtolength\textwidth{-2\sffms@margin}
  \setlength\oddsidemargin{\sffms@margin}
  \setlength\textheight{\paperheight}
  \addtolength\textheight{-2in}
  \addtolength\textheight{-2\sffms@margin}
  \setlength\topmargin{\sffms@margin}
  \addtolength\topmargin{-.5in}
  \fi%
\fi%


\newcommand{\authorname}[1]{\def\author@name{#1}}
\newcommand{\address}[1]{\def\author@address{#1}}
\newcommand{\wordcount}[1]{\def\word@count{#1}}
\newcommand{\surname}[1]{\def\sur@name{#1} \sffms@surnametrue}
\newcommand{\runningtitle}[1]{\def\running@title{#1} \sffms@runningtitletrue}
\newcommand{\sceneseparator}[1]{\def\scenesepstring{#1}}
\newcommand{\thirty}[1]{\def\thirtystring{#1}}
\newcommand{\disposable}{\def\disposablestring{Disposable~Copy}}
\ifsffms@wotf%
  \def\msheadstring{\MakeUppercase{\@title}\hspace{.5ex}/\hspace{.5ex}\thepage} \fi%
\newcommand{\msheading}[1]{\def\msheadstring{#1}}

\newcommand{\penname}[1]{}		% obsolete
\newcommand{\getpenname}{\@author}	% obsolete

\newcommand{\getrunningtitle}{\ifsffms@runningtitle%
  \MakeUppercase{\running@title}%
  \else \MakeUppercase{\@title}%
\fi}

\newcommand{\getsurname}{\ifsffms@surname%
  \sur@name \else \@author \fi}

\ifsffms@submit%
\newcommand{\newscene}{\centerline {\scenesepstring}}
 \newcommand{\ifsubmission}[2]{#1}%
\else \newcommand{\newscene}{\vspace{1\baselineskip}}
 \newcommand{\ifsubmission}[2]{#2} \fi

\newcommand{\submit}[1]{\ifsubmission{#1}{}}
\newcommand{\nosubmit}[1]{\ifsubmission{}{#1}}

\newcommand{\scenebreak}{\newscene}

\newcommand{\thought}[1]{\emph{#1}}


\ifsffms@submit
 \AtBeginDocument{
   \ttfamily
   \useunder{\uwave}{\bfseries}{\textbf}%ulem command for boldface
   \useunder{\uuline}{\scshape}{\textsc}%ulem command for smallcaps
   \renewcommand\chapter{\if@openright\clearpage\else\cleardoublepage\fi
                        \secdef\@chapter\@schapter}
    \def\@makechapterhead#1{\vspace*{4\baselineskip} 
        \begin{center}\@chapapp\space\thechapter\\ #1 \end{center}
        \vspace*{1\baselineskip}} 
    \def\@schapter#1{%
        \if@twocolumn\@topnewpage[\@makeschapterhead{#1}]%
        \else\@makeschapterhead{#1}\@afterheading\fi}
    \def\@makeschapterhead#1{\vspace*{4\baselineskip} 
        \begin{center} #1 \end{center} \vspace*{1\baselineskip}}
    }%
\fi

\ifsffms@novel%
 \newcounter{tempcounter}
 \newenvironment{synopsis}
  {\setcounter{tempcounter}{\value{page}}
   \pagenumbering{roman}
   \singlespace 
   \chapter*{Synopsis of \MakeUppercase{\@title}}}
  {\clearpage \setcounter{page}{\value{tempcounter}}
   \pagenumbering{arabic} \pagestyle{fancy}}%
\else \newenvironment{synopsis}{SYNOPSIS:  }{\scenebreak} \fi

\newcommand{\sffms@commonsubsetup}%
{\pagestyle{fancy}
 \fancyhead[r]{{\ttfamily \msheadstring}}
 \fancyfoot{}
 \renewcommand{\headrulewidth}{0pt}
 \renewcommand{\footrulewidth}{0pt}
 \raggedright
 \settowidth{\parindent}{\texttt{~~~~~}}
}


\AtBeginDocument{
\ifsffms@notitle%
    \ifsffms@submit \sffms@commonsubsetup \fi%
 \else%
   \ifsffms@submit%beginning of + 2nd submit if
    \sffms@commonsubsetup
    \thispagestyle{empty}
    \newsavebox{\sffms@fronttopsavebox}
    \begin{lrbox}{\sffms@fronttopsavebox}
    \begin{minipage}[t]{\textwidth}
    \begin{singlespace}%
    \ifsffms@daw \hfill\parbox[t]{.40\textwidth}{\raggedright\author@name\\%
        \author@address\\[\baselineskip]%
        \word@count\ words\\ \disposablestring}%
    \else%
     \parbox[t]{.65\textwidth}{\author@name\\\author@address}\hfill
     \parbox[t]{.30\textwidth}{\raggedleft\word@count\ words\\[\baselineskip]%
     \disposablestring}%
    \fi%
    \end{singlespace}
    \end{minipage}
    \end{lrbox}
    \noindent\raisebox{0pt}[0pt][0pt]{\usebox{\sffms@fronttopsavebox}}
    \vspace{0.39\textheight}
    \begin{center}\MakeUppercase{\@title}\\by \@author\end{center}
    \vspace{1\baselineskip}%
   \else \maketitle \setcounter{page}{2} \fi%
  \ifsffms@wotf \setcounter{page}{0} \clearpage%
  \else \ifsffms@novel\clearpage\fi%
  \fi%
\fi%
}

\AtEndDocument{\vspace{12pt}\centerline{\thirtystring}%
  \ifsffms@submit%
     	\wordc=\thepage%
	\ifsffms@courier \multiply\wordc by 250%
	   \else \ifsffms@baen \multiply\wordc by 250%
           \else \multiply\wordc by 295 \fi \fi%
	\setcounter{wordcounter}{\the\wordc}%
	\addtocounter{wordcounter}{-1}%
	\refstepcounter{wordcounter}%
  \fi%
  \label{sffmswc}%
}
%</sffms>
%    \end{macrocode}
%    \begin{macrocode}
%<*smart>
{%
\catcode`\"=\active	
\catcode`\@=11			
\gdef\begindoublequotes{%
    \global\catcode`\"=\active
    \global\chardef\dq=`\"
    \global\let\dblqu@te=L
    }	
\gdef"{\ifinner\else\ifvmode\let\dblqu@te=L\fi\fi
	\if L\dblqu@te``\global\let\dblqu@te=R%
	\else
	   \let\xxx=\spacefactor	
	   ''\global\let\dblqu@te=L%
	   \spacefactor\xxx	
	\fi		
	}		
}			

\gdef\enddoublequotes{\catcode`\"=12}
%</smart>
%<*dumb>
\def\dumbquote{\afterassignment"\let\next= }
\sfcode`\" = 0
\def\rquote{'}
\def\lquote{`}
\catcode`'=\active \def'{\actrq}
\catcode``=\active \def`{\actlq}
\def\rqtest{\ifx\next'\let\next=\dumbquote\else\let\next=\rquote\fi\next}
\def\lqtest{\ifx\next`\let\next=\dumbquote\else\let\next=\lquote\fi\next}
\def\actrq{\futurelet\next\rqtest}
\def\actlq{\futurelet\next\lqtest}
%</dumb>
%    \end{macrocode}
%
% \Finale
\endinput