quotepas.sty v1.0: LATEX2e Package for quoting predefined passages

Nicola Talbot

23rd Dec 2005


Contents

Introduction

The quotepas package was designed to allow you to quote predefined passages. It was originally designed to quote bible passages, but can be used for any quotations. The passages are stored in a database. The name of the database is specified using the command:



\quotepasdatabase{filename}



For example, if the database is contained in the file sampledb.tex, then the following should be placed in the preamble:

\quotepasdatabase{sampledb}

Within the database file, individual passages are stored using the command:



\newquotepas{label}{text}



For example:

\newquotepas{Gen1v1}{In the beginning God created
the heavens and the earth.}

Each passage can then be inserted into the document using the command:



\quotepas{label}



For example, to insert the above passage:

\quotepas{Gen1v1}
You can combine passages by using a comma-separated list of labels. For example, if your database contains the following:
\newquotepas{Gen1v1}{In the beginning God created
the heavens and the earth.}
                                                          
\newquotepas{Gen1v2}{Now the earth was a formless
void, there was darkness over the deep, and God's spirit
hovered over the water.}
                                                          
\newquotepas{Gen1v3}{\qupar God said, `Let there
be light', and there was light.}
then the three verses can be inserted using
\quotepas{Gen1v1,Gen1v2,Gen1v3}
The command \qupar indicates that this verse should start a new paragraph if it is not the first one in the list used in \quotepas. So,
\quotepas{Gen1v1,Gen1v2,Gen1v3}
will have a paragraph break between verse 2 and verse 3, but the following won't:
\quotepas{Gen1v1} \quotepas{Gen1v2} \quotepas{Gen1v3}

Of course, you could just define all three verses in one block:

\newquotepas{Gen1v1-3}{In the beginning God created
the heavens and the earth.
Now the earth was a formless
void, there was darkness over the deep, and God's spirit
hovered over the water.

God said, `Let there be light', and there was light.}
and use \quotepas{Gen1v1-3}. It all depends on how many of your documents are using an individual database. The advantage in storing each verse singly is that one document my quote, say, verse 1, but another may quote verses 1 and 2.

Customising the Output

The quotation will be inserted within the qupformat environment. This by default does nothing, but can be redefined. For example, to set the passage within double quotes:
\renewenvironment{qupformat}{``}{''}
Using the passages defined in the previous section, note the difference between \quotepas{Gen1v1,Gen1v2,Gen1v3}: ``In the beginning God created the heavens and the earth. Now the earth was a formless void, there was darkness over the deep, and God's spirit hovered over the water.

God said, `Let there be light', and there was light.'' and \quotepas{Gen1v1} \quotepas{Gen1v2} \quotepas{Gen1v3}: ``In the beginning God created the heavens and the earth.'' ``Now the earth was a formless void, there was darkness over the deep, and God's spirit hovered over the water.'' ``God said, `Let there be light', and there was light.''

As noted earlier, \qupar should be used in the quotation definition if there should be a paragraph break at that point, but only if this passage is not the first listed in the command \quotepas. If you want a paragraph break to be inserted at that point even if it is the first listed, use the starred version of \quotepas, e.g. \quotepas*{Gen1v3}.

The command \qupar can be redefined it you want any additional text to occur at the start of the paragraph. For example, if you have redefined qupformat as

\renewenvironment{qupformat}{``}{''}
it would also be advisable to redefine \qupar so that inserts a new opening double quote at the start of the new paragraphs:
\renewcommand{\qupar}{\par``}

The command \quotepassep is inserted between each passage. By default this is a space, but can be redefined.

Quotepas.pl

As with BiBTEX, you can have a large database, and use an application, in this case a Perl script called quotepas.pl, to select only the passages that have been referenced in the document. Each entry in this database should be entered in the form:



<quotepas>
<label>label</label> <block>text</block> </quotepas>



For example:



<quotepas> <label> Gen1v1</label> <block>In the beginning God created the heavens and the earth.</block> </quotepas>



The Perl script can either be called as:

quotepas.pl <aux file> <database>
or
perl quotepas.pl <aux file> <database>
depending on your system, where aux file is the name of the auxiliary file and database is the name of the database. The Perl script will determine the name of the output file (the file given in \quotepasdatabase) from the auxiliary file.

For example, if your document is saved in sample.tex, and the database is contained in database.qup, then do

latex sample
quotepas.pl sample.aux database.qup
latex sample

If you have a very large database, this is recommended as it reduces the memory requirements of TEX, since each \newquotepas command defines a new command containing the given text.

Contact Details

Dr Nicola Talbot
School of Computing Sciences
University of East Anglia
Norwich. Norfolk. NR4 7TJ.
United Kingdom
http://theoval.cmp.uea.ac.uk/~nlct/


Nicola L. C. Talbot. School of Computing Sciences. University of East Anglia. Last Modified: 2007-05-22