summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/camel
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/camel
Initial commit
Diffstat (limited to 'macros/latex/contrib/camel')
-rw-r--r--macros/latex/contrib/camel/CATALOG15
-rw-r--r--macros/latex/contrib/camel/MANIFEST20
-rw-r--r--macros/latex/contrib/camel/README87
-rw-r--r--macros/latex/contrib/camel/bibtex.ch768
-rw-r--r--macros/latex/contrib/camel/camel.dtx5872
-rw-r--r--macros/latex/contrib/camel/camel.ins126
l---------macros/latex/contrib/camel/index.dtx1
l---------macros/latex/contrib/camel/index.ins1
-rw-r--r--macros/latex/contrib/camel/law.dtx1774
-rw-r--r--macros/latex/contrib/camel/law.ins105
10 files changed, 8769 insertions, 0 deletions
diff --git a/macros/latex/contrib/camel/CATALOG b/macros/latex/contrib/camel/CATALOG
new file mode 100644
index 0000000000..0e9bcf5739
--- /dev/null
+++ b/macros/latex/contrib/camel/CATALOG
@@ -0,0 +1,15 @@
+Name: camel
+Problems-To: fb@soas.ac.uk
+Author: Frank G Bennett, Jr
+Version: 1.0r 1996/01/09
+Description: Camel is a style package for LaTeX2e that lays the
+ foundation for greatly improved handling of bibliographic
+ material. It is the only fully supported bibliography package to
+ offer support for legal citation styles, and the only system
+ within reach of handling other styles that require 'ibid.' and
+ the like. A programmer's library for BibTeX that includes
+ functions supporting streamlined entry of citation details
+ and dates is contained in the package. Treat this as ALPHA
+ software, but alpha software with a future.
+Keywords: law, legal, lawyer, bibliography, BibTeX,
+ cross-referencing, EndNote, ProCite, Reference Manager, citations
diff --git a/macros/latex/contrib/camel/MANIFEST b/macros/latex/contrib/camel/MANIFEST
new file mode 100644
index 0000000000..b1f17e0227
--- /dev/null
+++ b/macros/latex/contrib/camel/MANIFEST
@@ -0,0 +1,20 @@
+9 January 1997
+
+The full Camel package consists of the following
+files:
+
+ camel.dtx
+ camel.ins
+ law.dtx
+ law.ins
+ index.dtx (pre-release, by David M. Jones)
+ index.ins (pre-release, by David M. Jones)
+ bibtex.ch (sample change file for enlarging JBibTeX.
+ Use diff to identify changes specific to
+ normal, Occidental BibTeX.)
+ MANIFEST
+ README
+ CATALOG
+
+If all of these files are not available to you, contact
+me on fb@soas.ac.uk.
diff --git a/macros/latex/contrib/camel/README b/macros/latex/contrib/camel/README
new file mode 100644
index 0000000000..7cd1e1f76b
--- /dev/null
+++ b/macros/latex/contrib/camel/README
@@ -0,0 +1,87 @@
+Last updated: 17 Feb 1997
+
+Welcome to version 1.0t of camel.sty and its friends. Camel is a
+LaTeX2e macro package that will, if all goes according to plan,
+one day drastically simplify the typesetting of citations and
+bibliographies in (potentially) a wide variety of styles and
+formats. This release is a *prototype*, and should be treated
+as ALPHA software; I hope that you will experiment with it and
+send me your comments, but you should not assume that it is
+perfect, and you should not assume that it will not change.
+
+Using Camel, citations are referred to in a way similar to that
+used in `standard BibTeX', but with a number of significant
+enhancements; citation tags can be used to generate subdivided
+bibliographies, separate bibliographies for each subdivision of a
+larger work are supported, as are in-footnote cross-referenced
+citations, bibliographies indexed to the pages where citations to
+the relevant work occur, and much else. This is also the only
+supported LaTeX2e bibliography style that supports legal
+citation styles (using the law.dtx module). The package also
+provides genuinely helpful error messages and an extremely simple
+syntax for adding details like page numbers and the like to
+citation tags.
+
+To use Camel, you will need to fetch camel.dtx and its extractor,
+camel.ins, and law.dtx with its extractor law.ins. You will also
+need to fetch and extract index.dtx/index.ins, the (pre-release)
+index support package for LaTeX2e by David M. Jones, and the
+"keyval" package that can be found on CTAN in latex/packages/graphics.
+To typeset the documentation (by running camel.dtx and law.dtx
+themselves directly through LaTeX), you will need the array.sty
+package. Also, and most important, you will need a BibTeX that
+has a wizard-defined function space of over 7,000. The standard
+BibTeX (with a function space of 3,000) is too small to handle
+the .bst files used by the Camel style modules.
+
+*** Notes on version 1.0s ***
+
+In the past year there have been a few bug fixes in the 1.0r
+code. Since some people are using the package (!), I'm
+releasing these fixes as version 1.0s. The new release
+includes a sample bibtex.ch file, based on jbibtex.ch (NOT
+the usual bibtex.ch --- use only as a reference.)
+
+*** Notes on version 1.0r ***
+
+FOR USERS UPDATING THEIR CAMEL: In this version, I have fixed a
+small bug in the @ARTICLE entry type in law.dtx, and have
+cut out the code used to show case holdings, comments, questions
+and fact patterns (a whip-round asking who wanted to preserve
+these features received no response, so out they went).
+I have also fixed a fatal bug in the code that handles pinpoints
+in parallel citations. Please note that this release calls on
+the new index.sty for LaTeX2e distributed by David Jones as the
+index.dtx package. You will need this new version of index.sty
+to run version 1.0q of Camel. The previous prerelease of that
+file, 'indexdmj.sty' can be deleted from your system. Note that
+you also do need the "keyval" package from CTAN.
+
+NOTE ON FUTURE CHANGES: This version (v1.0r) will is the last
+of its kind --- but this does not mean the end of Camel.
+Rather, it marks a new beginning. As many of you will know,
+Oren Patashnik is at work on an upgrade of BibTeX to
+version 1.0. As things look at present, the new BibTeX will
+make a further rationalization of the structure of the Camel
+code. Not only will this make the editing of styles easier,
+but it will also increase the overall speed of processing
+a document, and reduce the amount of memory required in LaTeX.
+
+On a rough guess, these changes will about double the size of
+the (already large) BibTeX style file for legal citations, and
+render about half of the existing LaTeX style code in Camel
+redundant (sniff, sniff). The inputs --- your documents and
+your bibliographies --- should work equally well with the new-style
+package, but fairness dictates that I at least let folks know
+what's going to happen.
+
+The most immediate effect of these plans is that I will do
+nothing to enhance the existing code until BibTeX 1.0 comes
+out. Given that Oren Patashnik has a large amount of work to
+do on BibTeX, and given the scale of the changes contemplated
+for Camel, this could all take awhile. So there you have it;
+a curious form of `stability'.
+
+Have a nice ride!
+
+FB@soas.ac.uk
diff --git a/macros/latex/contrib/camel/bibtex.ch b/macros/latex/contrib/camel/bibtex.ch
new file mode 100644
index 0000000000..df54f2e2d6
--- /dev/null
+++ b/macros/latex/contrib/camel/bibtex.ch
@@ -0,0 +1,768 @@
+% Change file for BibTeX in C, originally by Howard Trickey, for
+% Berkeley Unix.
+%
+% History:
+% 05/28/84 Initial implementation, version 0.41 of BibTeX
+% 07/01/84 Version 0.41a of BibTeX.
+% 12/17/84 Version 0.97c of BibTeX.
+% 02/12/85 Version 0.98c of BibTeX.
+% 02/25/85 Newer version 0.98c of BibTeX.
+% 03/25/85 Version 0.98f of BibTeX
+% 05/23/85 Version 0.98i of BibTeX
+% 02/11/88 Version 0.99b of BibTeX
+% 04/04/88 Version 0.99c; converted for use with web2c (ETM).
+% 11/30/89 Use FILENAMESIZE instead of 1024 (KB).
+% 03/09/90 `int' is a bad variable name.
+% (more recent changes in ../ChangeLog.W2C)
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% [1] banner
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@x
+@d banner=='This is BibTeX, Version 0.99c' {printed when the program starts}
+@y
+@d banner=='This is BibTeX, Version 0.99c' {more is printed later}
+@z
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% [2] `term_in' and `term_out' are standard input and output. But
+% there is a complication: BibTeX passes `term_out' to some routines as
+% a var parameter. web2c turns a var parameter f into &f at the calling
+% side -- and stdout is sometimes implemented as `&_iob[1]' or some
+% such. An address of an address is invalid.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@x
+@d term_out == tty
+@d term_in == tty
+@y
+@d term_out == standard_output
+@d term_in == standard_input
+@z
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% [4] Turn debug..gubed et al. into #ifdef's.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@x
+@d debug == @{ { remove the `|@{|' when debugging }
+@d gubed == @t@>@} { remove the `|@}|' when debugging }
+@f debug == begin
+@f gubed == end
+@#
+@d stat == @{ { remove the `|@{|' when keeping statistics }
+@d tats == @t@>@} { remove the `|@}|' when keeping statistics }
+@f stat == begin
+@f tats == end
+@#
+@d trace == @{ { remove the `|@{|' when in |trace| mode }
+@d ecart == @t@>@} { remove the `|@}|' when in |trace| mode }
+@f trace == begin
+@f ecart == end
+@y
+@d debug == ifdef('DEBUG')
+@d gubed == endif('DEBUG')
+@f debug == begin
+@f gubed == end
+@#
+@d stat == ifdef('STAT')
+@d tats == endif('STAT')
+@f stat==begin
+@f tats==end
+@#
+@d trace == ifdef@&('TRACE')
+@d ecart == endif@&('TRACE')
+@f trace == begin
+@f ecart == end
+@z
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% [10] Don't print the banner unless verbose.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@x
+print_ln(banner);@/
+@y
+if verbose then begin
+ print (banner);
+ print_ln (version_string);
+end;
+@z
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% [10] Possibly exit with bad status. It doesn't seem worth it to move
+% the definitions of the |history| values to above this module; hence
+% the 1.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@x
+exit_program:
+end.
+@y
+exit_program:
+if (history > 1) then uexit (history);
+end.
+@z
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% [11] Remove compiler directives.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@x
+@{@&$C-,A+,D-@} {no range check, catch arithmetic overflow, no debug overhead}
+@!debug @{@&$C+,D+@}@+ gubed {but turn everything on when debugging}
+@y
+@z
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% [13] Remove nonlocal goto.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@x
+ goto exit_program;
+@y
+ uexit (1);
+@z
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% [14] Increase some constants.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@x
+@!buf_size=1000; {maximum number of characters in an input line (or string)}
+@y
+@!buf_size=3000; {maximum number of characters in an input line (or string)}
+@z
+@x
+@!max_bib_files=20; {maximum number of \.{.bib} files allowed}
+@y
+@!max_bib_files=1000; {maximum number of \.{.bib} files allowed}
+@z
+@x
+@!pool_size=65000; {maximum number of characters in strings}
+@y
+@!pool_size=512000; {maximum number of characters in strings}
+@z
+@x
+@!max_strings=4000; {maximum number of strings, including pre-defined;
+ must be |<=hash_size|}
+@y
+@!max_strings=20000; {maximum number of strings, including pre-defined;
+ must be |<=hash_size|}
+@z
+@x
+@!max_cites=750; {maximum number of distinct cite keys; must be
+ |<=max_strings|}
+@y
+@!max_cites=3000; {maximum number of distinct cite keys; must be
+ |<=max_strings|}
+@z
+@x
+@!min_crossrefs=2; {minimum number of cross-refs required for automatic
+ |cite_list| inclusion}
+@y
+{|min_crossrefs| can be set at runtime now.}
+@z
+@x
+@!wiz_fn_space=3000; {maximum amount of |wiz_defined|-function space}
+@y
+@!wiz_fn_space=10000; {maximum amount of |wiz_defined|-function space}
+@z
+@x
+@!single_fn_space=100; {maximum amount for a single |wiz_defined|-function}
+@y
+@!single_fn_space=200; {maximum amount for a single |wiz_defined|-function}
+@z
+@x
+@!max_ent_ints=3000; {maximum number of |int_entry_var|s
+ (entries $\times$ |int_entry_var|s)}
+@y
+@!max_ent_ints=25000; {maximum number of |int_entry_var|s
+ (entries $\times$ |int_entry_var|s)}
+@z
+@x
+@!max_ent_strs=3000; {maximum number of |str_entry_var|s
+ (entries $\times$ |str_entry_var|s)}
+@y
+@!max_ent_strs=10000; {maximum number of |str_entry_var|s
+ (entries $\times$ |str_entry_var|s)}
+@z
+@x
+@!max_fields=17250; {maximum number of fields (entries $\times$ fields,
+ about |23*max_cites| for consistency)}
+@y
+@!max_fields=69000; {maximum number of fields (entries $\times$ fields,
+ about |23*max_cites| for consistency)}
+@z
+@x
+@d hash_size=5000 {must be |>= max_strings| and |>= hash_prime|}
+@y
+@d hash_size=21000 {must be |>= max_strings| and |>= hash_prime|}
+@z
+@x
+@d hash_prime=4253 {a prime number about 85\% of |hash_size| and |>= 128|
+ and |< @t$2^{14}-2^6$@>|}
+@y
+@d hash_prime=16319 {a prime number about 85\% of |hash_size| and |>= 128|
+ and |< @t$2^{14}-2^6$@>|}
+@z
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% [15] Use the system constant.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@x
+@d file_name_size=40 {file names shouldn't be longer than this}
+@y
+@d file_name_size == PATH_MAX
+@z
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% [22, 23, 27, 28] Allow any character as input.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@x [22]
+@!ASCII_code=0..127; {seven-bit numbers}
+@y
+@!ASCII_code=0..255; {eight-bit numbers}
+@z
+
+@x [23]
+@d text_char == char {the data type of characters in text files}
+@d first_text_char=0 {ordinal number of the smallest element of |text_char|}
+@d last_text_char=127 {ordinal number of the largest element of |text_char|}
+
+@<Local variables for initialization@>=
+i:0..last_text_char; {this is the first one declared}
+@y
+@d text_char == ASCII_code {the data type of characters in text files}
+@d first_text_char=0 {ordinal number of the smallest element of |text_char|}
+@d last_text_char=255 {ordinal number of the largest element of |text_char|}
+
+@<Local variables for initialization@>=
+i:integer;
+@z
+
+@x [27]
+for i:=1 to @'37 do xchr[i]:=' ';
+xchr[tab]:=chr(tab);
+@y
+for i:=0 to @'37 do xchr[i]:=chr(i);
+for i:=@'177 to @'377 do xchr[i]:=chr(i);
+@z
+
+@x [28]
+for i:=first_text_char to last_text_char do xord[chr(i)]:=invalid_code;
+for i:=1 to @'176 do xord[xchr[i]]:=i;
+@y
+for i:=first_text_char to last_text_char do xord[xchr[i]]:=i;
+@z
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% [32] Make RET a `white_space' character, so we won't choke on DOS
+% files, which end in a CR/LF pair.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@x
+lex_class[tab] := white_space;
+@y
+lex_class[tab] := white_space;
+lex_class[13] := white_space;
+@z
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% [36] Define `alpha_file' in C.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@x
+@!alpha_file=packed file of text_char; {files that contain textual data}
+@y
+@z
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% [37] Can't do arithmetic with |file_name_size| any longer, sigh.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@x
+@!name_ptr:0..file_name_size+1; {index variable into |name_of_file|}
+@y
+@!name_ptr:integer; {index variable into |name_of_file|}
+@z
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% [38] File opening.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@x
+The \ph\ compiler with which the present version of \TeX\ was prepared has
+extended the rules of \PASCAL\ in a very convenient way. To open file~|f|,
+we can write
+$$\vbox{\halign{#\hfil\qquad&#\hfil\cr
+|reset(f,@t\\{name}@>,'/O')|&for input;\cr
+|rewrite(f,@t\\{name}@>,'/O')|&for output.\cr}}$$
+The `\\{name}' parameter, which is of type `\ignorespaces|packed
+array[@t\<\\{any}>@>] of text_char|', stands for the name of
+the external file that is being opened for input or output.
+Blank spaces that might appear in \\{name} are ignored.
+
+The `\.{/O}' parameter tells the operating system not to issue its own
+error messages if something goes wrong. If a file of the specified name
+cannot be found, or if such a file cannot be opened for some other reason
+(e.g., someone may already be trying to write the same file), we will have
+|@!erstat(f)<>0| after an unsuccessful |reset| or |rewrite|. This allows
+\TeX\ to undertake appropriate corrective action.
+
+\TeX's file-opening procedures return |false| if no file identified by
+|name_of_file| could be opened.
+
+@d reset_OK(#)==erstat(#)=0
+@d rewrite_OK(#)==erstat(#)=0
+
+@<Procedures and functions for file-system interacting@>=
+function erstat(var f:file):integer; extern; {in the runtime library}
+@#@t\2@>
+function a_open_in(var f:alpha_file):boolean; {open a text file for input}
+begin reset(f,name_of_file,'/O'); a_open_in:=reset_OK(f);
+end;
+@#
+function a_open_out(var f:alpha_file):boolean; {open a text file for output}
+begin rewrite(f,name_of_file,'/O'); a_open_out:=rewrite_OK(f);
+end;
+@y
+@ File opening will be done in C.
+@d no_file_path = -1
+@z
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% [39] Do file closing in C.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@x
+@<Procedures and functions for file-system interacting@>=
+procedure a_close(var f:alpha_file); {close a text file}
+begin close(f);
+end;
+@y
+File closing will be done in C, too.
+@z
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% [47] web2c doesn't understand f^.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@x
+ buffer[last]:=xord[f^];
+ get(f); incr(last);
+ end;
+ get(f);
+@y
+ buffer[last] := xord[getc (f)];
+ incr (last);
+ end;
+ vgetc (f); {skip the eol}
+@z
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% [77] The predefined string array starts at zero instead of one.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@x
+for i:=1 to len do
+ buffer[i] := xord[pds[i]];
+@y
+for i:=1 to len do
+ buffer[i] := xord[pds[i-1]];
+@z
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% [97] Can't do this tangle-time arithmetic.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@x
+@!aux_name_length : 0..file_name_size+1; {\.{.aux} name sans extension}
+@y
+@!aux_name_length : integer;
+@z
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% [100] Reading the aux file name and command-line processing.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@x
+This procedure consists of a loop that reads and processes a (nonnull)
+\.{.aux} file name. It's this module and the next two that must be
+changed on those systems using command-line arguments. Note: The
+|term_out| and |term_in| files are system dependent.
+
+@<Procedures and functions for the reading and processing of input files@>=
+procedure get_the_top_level_aux_file_name;
+label aux_found,@!aux_not_found;
+var @<Variables for possible command-line processing@>@/
+begin
+check_cmnd_line := false; {many systems will change this}
+loop
+ begin
+ if (check_cmnd_line) then
+ @<Process a possible command line@>
+ else
+ begin
+ write (term_out,'Please type input file name (no extension)--');
+ if (eoln(term_in)) then {so the first |read| works}
+ read_ln (term_in);
+ aux_name_length := 0;
+ while (not eoln(term_in)) do
+ begin
+ if (aux_name_length = file_name_size) then
+ begin
+ while (not eoln(term_in)) do {discard the rest of the line}
+ get(term_in);
+ sam_you_made_the_file_name_too_long;
+ end;
+ incr(aux_name_length);
+ name_of_file[aux_name_length] := term_in^;
+ get(term_in);
+ end;
+ end;
+ @<Handle this \.{.aux} name@>;
+aux_not_found:
+ check_cmnd_line := false;
+ end;
+aux_found: {now we're ready to read the \.{.aux} file}
+end;
+@y
+@<Procedures and functions for the reading and processing of input files@>=
+procedure get_the_top_level_aux_file_name;
+label aux_found,@!aux_not_found;
+var @<Variables for possible command-line processing@>@/
+begin
+loop
+ begin
+ {initialize the path variables}
+ set_paths (BIB_INPUT_PATH_BIT + BST_INPUT_PATH_BIT);
+ if (argc > 1) then
+ @<Process a possible command line@>
+ else begin
+ write (term_out,'Please type input file name (no extension)--');
+ aux_name_length := 0;
+ while (not eoln(term_in)) do begin
+ if (aux_name_length = file_name_size) then begin
+ readln(term_in);
+ sam_you_made_the_file_name_too_long;
+ end;
+ name_of_file[aux_name_length+1] := getc(term_in);
+ incr(aux_name_length);
+ end;
+ if (eof(term_in)) then begin
+ writeln(term_out);
+ writeln(term_out,
+ 'Unexpected end of file on terminal---giving up!');
+ uexit(1);
+ end;
+ readln(term_in);
+ end;
+ @<Handle this \.{.aux} name@>;
+aux_not_found:
+ argc := 0;
+ end;
+aux_found: {now we're ready to read the \.{.aux} file}
+end;
+@z
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% [101] Don't need this variable; we use argc to check if we have a
+% command line.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@x
+@<Variables for possible command-line processing@>=
+@!check_cmnd_line : boolean; {|true| if we're to check the command line}
+@y
+@z
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% [102] Get the aux file name from the command line.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@x
+@<Process a possible command line@>=
+begin
+do_nothing; {the ``default system'' doesn't use the command line}
+end
+@y
+@<Process a possible command line@>=
+begin
+ if argc > n_options + arg_options + 3
+ then begin
+ print ('Usage: bibtex ');
+ print ('[-verbose] ');
+ print ('[-min-crossrefs=<number>] ');
+ print_ln ('[<aux file>].');
+@.Usage: ...@>
+ uexit (1);
+ end;
+
+ @<Initialize the option variables@>;
+ @<Parse arguments@>;
+
+ argv (optind, name_of_file);
+ aux_name_length := 1;
+ while name_of_file[aux_name_length] <> ' '
+ do incr (aux_name_length);
+ decr (aux_name_length);
+end
+@z
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% [106] Don't use a path to find the aux file.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@x
+if (not a_open_in(cur_aux_file)) then
+ sam_you_made_the_file_name_wrong;
+@y
+if (not a_open_in(cur_aux_file,no_file_path)) then
+ sam_you_made_the_file_name_wrong;
+@z
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% [110] Be silent unless verbose.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@x
+print ('The top-level auxiliary file: ');
+print_aux_name;
+@y
+if verbose then begin
+ print ('The top-level auxiliary file: ');
+ print_aux_name;
+end;
+@z
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% [123] Use BIBINPUTS to search for the .bib file.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@x
+if (not a_open_in(cur_bib_file)) then
+ begin
+ add_area (s_bib_area);
+ if (not a_open_in(cur_bib_file)) then
+ open_bibdata_aux_err ('I couldn''t open database file ');
+ end;
+@y
+if (not a_open_in(cur_bib_file,BIB_INPUT_PATH)) then
+ open_bibdata_aux_err ('I couldn''t open database file ');
+@z
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% [127] Use BSTINPUTS/TEXINPUTS to search for .bst files.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@x
+add_extension (s_bst_extension);
+if (not a_open_in(bst_file)) then
+ begin
+ add_area (s_bst_area);
+ if (not a_open_in(bst_file)) then
+ begin
+ print ('I couldn''t open style file ');
+ print_bst_name;@/
+ bst_str := 0; {mark as unused again}
+ aux_err_return;
+ end;
+ end;
+@y
+add_extension (s_bst_extension);
+if (not a_open_in(bst_file,BST_INPUT_PATH)) then
+ begin
+ print ('I couldn''t open style file ');
+ print_bst_name;@/
+ bst_str := 0; {mark as unused again}
+ aux_err_return;
+ end;
+@z
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% [127] Be silent unless verbose.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@x
+print ('The style file: ');
+print_bst_name;
+@y
+if verbose then begin
+ print ('The style file: ');
+ print_bst_name;
+end;
+@z
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% [141] Don't use a path to search for subsidiary aux files, either.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@x
+if (not a_open_in(cur_aux_file)) then
+@y
+if (not a_open_in(cur_aux_file, no_file_path)) then
+@z
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% [151] This goto gets turned into a setjmp/longjmp by ./convert --
+% unfortunately, it is a nonlocal goto. ekrell@ulysses@att.com
+% implemented the conversion.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@x
+buf_ptr2 := last; {to get the first input line}
+loop
+ begin
+ if (not eat_bst_white_space) then {the end of the \.{.bst} file}
+ goto bst_done;
+ get_bst_command_and_process;
+ end;
+bst_done: a_close (bst_file);
+@y
+buf_ptr2 := last; {to get the first input line}
+hack1;
+ begin
+ if (not eat_bst_white_space) then {the end of the \.{.bst} file}
+ hack2;
+ get_bst_command_and_process;
+ end;
+bst_done: a_close (bst_file);
+@z
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% [198] A variable named `int' is no good in C.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@x
+@<Procedures and functions for handling numbers, characters, and strings@>=
+@y
+@d int == the_int
+
+@<Procedures and functions for handling numbers, characters, and strings@>=
+@z
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% [223] Be silent unless verbose.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@x
+ print ('Database file #',bib_ptr+1:0,': ');
+ print_bib_name;@/
+@y
+ if verbose then begin
+ print ('Database file #',bib_ptr+1:0,': ');
+ print_bib_name;
+ end;
+@z
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% [388] bibtex.web has mutually exclusive tests here; Oren said he
+% doesn't want to fix it until 1.0, since it's obviously of no practical
+% import (or someone would have found it before GCC 2 did). Changing
+% the second `and' to an `or' makes all but the last of multiple authors
+% be omitted in the bbl file, so I simply removed the statement.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@x
+while ((ex_buf_xptr < ex_buf_ptr) and
+ (lex_class[ex_buf[ex_buf_ptr]] = white_space) and
+ (lex_class[ex_buf[ex_buf_ptr]] = sep_char)) do
+ incr(ex_buf_xptr); {this removes leading stuff}
+@y
+@z
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% [467] System-dependent changes: option handling.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@x
+@* System-dependent changes.
+@^system dependencies@>
+This section should be replaced, if necessary, by changes to the program
+that are necessary to make \BibTeX\ work at a particular installation.
+It is usually best to design your change file so that all changes to
+previous sections preserve the section numbering; then everybody's version
+will be consistent with the printed program. More extensive changes,
+which introduce new sections, can be inserted here; then only the index
+itself will get a new section number.
+@y
+@* System-dependent changes. We want to parse a Unix-style command line.
+@^system dependencies@>
+
+This macro tests if its argument is the current option, as represented
+by the index variable |option_index|.
+
+@d argument_is (#) == (strcmp (long_options[option_index].name, #) = 0)
+
+@<Parse arguments@> =
+begin
+ @<Define the option table@>;
+ repeat
+ getopt_return_val := getopt_long_only (argc, gargv, '', long_options,
+ address_of_int (option_index));
+ if getopt_return_val <> -1
+ then begin
+ if getopt_return_val = "?"
+ then uexit (1); {|getopt| has already given an error message.}
+
+ if argument_is ('min-crossrefs')
+ then begin
+ min_crossrefs := atoi (optarg);
+ end
+
+ else
+ {It was just a flag; |getopt| has already done the assignment.}
+ do_nothing;
+
+ end;
+ until getopt_return_val = -1;
+
+ {Now |optind| is the index of first non-option on the command line.}
+end
+
+
+@ The array of information we pass in. The type |getopt_struct| is
+defined in C, to avoid type clashes. We also need to know the return
+value from getopt, and the index of the current option.
+
+@<Variables for possible command-line...@> =
+@!long_options: array[0..n_options] of getopt_struct;
+@!getopt_return_val: integer;
+@!option_index: c_int_type;
+@!current_option: 0..n_options;
+
+@ Here is the first of the options we allow.
+@.-verbose@>
+
+@<Define the option...@> =
+current_option := 0;
+long_options[0].name := 'verbose';
+long_options[0].has_arg := 0;
+long_options[0].flag := address_of_int (verbose);
+long_options[0].val := 1;
+incr (current_option);
+
+@ The global variable |verbose| determines whether or not we print
+progress information.
+
+@<Glob...@> =
+@!verbose: c_int_type;
+
+@ It starts off |false|.
+
+@<Initialize the option...@> =
+verbose := false;
+
+
+@ Here is an option to change the minimum number of cross-refs required
+for automatic |cite_list| inclusion.
+@.-min-crossrefs@>
+
+@<Define the option...@> =
+long_options[current_option].name := 'min-crossrefs';
+long_options[current_option].has_arg := 1;
+long_options[current_option].flag := 0;
+long_options[current_option].val := 0;
+incr (current_option);
+
+@
+@<Glob...@> =
+@!min_crossrefs: integer;
+
+@ Set |min_crossrefs| to two by default, so we match the
+documentation (\.{btxdoc.tex}).
+
+@<Initialize the option...@> =
+min_crossrefs := 2;
+
+
+@ An element with all zeros always ends the list.
+
+@<Define the option...@> =
+long_options[current_option].name := 0;
+long_options[current_option].has_arg := 0;
+long_options[current_option].flag := 0;
+long_options[current_option].val := 0;
+
+
+@ Pascal compilers won't count the number of elements in an array
+constant for us. This doesn't include the zero-element at the end,
+because this array starts at index zero.
+
+@<Constants...@> =
+@!n_options = 2;
+@!arg_options = 1;
+@z
diff --git a/macros/latex/contrib/camel/camel.dtx b/macros/latex/contrib/camel/camel.dtx
new file mode 100644
index 0000000000..a780437cb7
--- /dev/null
+++ b/macros/latex/contrib/camel/camel.dtx
@@ -0,0 +1,5872 @@
+% \iffalse
+%<*driver>
+\documentclass{ltxdoc}
+\usepackage{camel}
+\usepackage{array}
+\pagenumbering{roman}
+
+\def\fileversion{1.0t}
+\def\filedate{97/02/17}
+
+%\EnableCrossrefs
+\DisableCrossrefs % Say \DisableCrossrefs if index is ready
+\RecordChanges % Gather update information
+\CodelineIndex % Index code by line number
+%\OnlyDescription % comment out for implementation details
+\begin{document}
+\citationstyle{law}
+\citationdata{camel}
+\title{User's Guide to the {\sc Camel} Citator\thanks{%
+ This file is version number \fileversion{}. The
+ documentation was last revised on \filedate.}}
+\author{Frank G. Bennett, Jr.\thanks{The text and source code
+ contained in this file are \copyright~1992--1995 by Frank G.
+ Bennett, Jr. This file can be freely distributed; the sole
+ condition of use is that acknowledgement to the author be
+ made in any published work produced using {\sc Camel}. The
+ author wishes to thank Pedro Aphalo, Steve Bellovin, George
+ Greenwade and Boris Pevzner and David Rhead for their helpful
+ comments on versions of \LexiTeX, the predecessor to {\sc
+ Camel}. In addition, David Rhead provided a mass of
+ information on bibliographic conventions, which was used in
+ shaping the options supported by this package. Gratitude is
+ also owed to Marcia Elliot and Yoshiko Makino, LL.B.
+ finalists in the Law Department of the School of Oriental and
+ African Studies in 1993 and 1994 respectively, who prepared
+ extended essays using early releases of \LexiTeX.}}
+ \maketitle
+ \DocInput{camel.dtx}
+\end{document}
+%</driver>
+% \fi
+% \CheckSum{3488}
+%
+%\iffalse
+%
+% Copyright (C) 1992-1995 by Frank Bennett. All rights reserved.
+%
+% IMPORTANT NOTICE:
+%
+% You are not allowed to change this file. You may however copy
+% this file to a file with a different name and then change the
+% copy if (a) you do not charge for the modified code, (b) you
+% acknowledge Camel and its author(s) in the new file, if it
+% is distributed to others, and (c) you attach these same
+% conditions to the new file.
+%
+% You are not allowed to distribute this file alone. You are not
+% allowed to take money for the distribution or use of this file
+% (or a changed version) except for a nominal charge for copying
+% etc.
+%
+% You are allowed to distribute this file under the condition that
+% it is distributed with all of its contents, intact.
+%
+% For error reports, or offers to help make Camel a more powerful,
+% friendlier, and altogether more thrilling package, please contact me on
+% fb@soas.ac.uk
+%
+%\fi
+%
+%
+% \DoNotIndex{\@,\@@par,\@beginparpenalty,\@empty}
+% \DoNotIndex{\@flushglue,\@gobble,\@input}
+% \DoNotIndex{\@makefnmark,\@makeother,\@maketitle}
+% \DoNotIndex{\@namedef,\@ne,\@spaces,\@tempa}
+% \DoNotIndex{\@tempb,\@tempswafalse,\@tempswatrue}
+% \DoNotIndex{\@thanks,\@thefnmark,\@topnum}
+% \DoNotIndex{\@@,\@elt,\@forloop,\@fortmp,\@gtempa,\@totalleftmargin}
+% \DoNotIndex{\",\/,\@ifundefined,\@nil,\@verbatim,\@vobeyspaces}
+% \DoNotIndex{\|,\~,\ ,\active,\advance,\aftergroup,\begingroup,\bgroup}
+% \DoNotIndex{\cal,\csname,\def,\documentstyle,\dospecials,\edef}
+% \DoNotIndex{\egroup}
+% \DoNotIndex{\else,\endcsname,\endgroup,\endinput,\endtrivlist}
+% \DoNotIndex{\expandafter,\fi,\fnsymbol,\futurelet,\gdef,\global}
+% \DoNotIndex{\hbox,\hss,\if,\if@inlabel,\if@tempswa,\if@twocolumn}
+% \DoNotIndex{\ifcase}
+% \DoNotIndex{\ifcat,\iffalse,\ifx,\ignorespaces,\index,\input,\item}
+% \DoNotIndex{\jobname,\kern,\leavevmode,\leftskip,\let,\llap,\lower}
+% \DoNotIndex{\m@ne,\next,\newpage,\nobreak,\noexpand,\nonfrenchspacing}
+% \DoNotIndex{\obeylines,\or,\protect,\raggedleft,\rightskip,\rm,\sc}
+% \DoNotIndex{\setbox,\setcounter,\small,\space,\string,\strut}
+% \DoNotIndex{\strutbox}
+% \DoNotIndex{\thefootnote,\thispagestyle,\topmargin,\trivlist,\tt}
+% \DoNotIndex{\twocolumn,\typeout,\vss,\vtop,\xdef,\z@}
+% \DoNotIndex{\,,\@bsphack,\@esphack,\@noligs,\@vobeyspaces,\@xverbatim}
+% \DoNotIndex{\`,\catcode,\end,\escapechar,\frenchspacing,\glossary}
+% \DoNotIndex{\hangindent,\hfil,\hfill,\hskip,\hspace,\ht,\it,\langle}
+% \DoNotIndex{\leaders,\long,\makelabel,\marginpar,\markboth,\mathcode}
+% \DoNotIndex{\mathsurround,\mbox,\newcount,\newdimen,\newskip}
+% \DoNotIndex{\nopagebreak}
+% \DoNotIndex{\parfillskip,\parindent,\parskip,\penalty,\raise,\rangle}
+% \DoNotIndex{\section,\setlength,\TeX,\topsep,\underline,\unskip,\verb}
+% \DoNotIndex{\vskip,\vspace,\widetilde,\\,\%,\@date,\@defpar}
+% \DoNotIndex{\[,\{,\},\]}
+% \DoNotIndex{\count@,\ifnum,\loop,\today,\uppercase,\uccode}
+% \DoNotIndex{\baselineskip,\begin,\tw@}
+% \DoNotIndex{\a,\b,\c,\d,\e,\f,\g,\h,\i,\j,\k,\l,\m,\n,\o,\p,\q}
+% \DoNotIndex{\r,\s,\t,\u,\v,\w,\x,\y,\z,\A,\B,\C,\D,\E,\F,\G,\H}
+% \DoNotIndex{\I,\J,\K,\L,\M,\N,\O,\P,\Q,\R,\S,\T,\U,\V,\W,\X,\Y,\Z}
+% \DoNotIndex{\1,\2,\3,\4,\5,\6,\7,\8,\9,\0}
+% \DoNotIndex{\!,\#,\$,\&,\',\(,\),\+,\.,\:,\;,\<,\=,\>,\?,\_}
+% \DoNotIndex{\discretionary,\immediate,\makeatletter,\makeatother}
+% \DoNotIndex{\meaning,\newenvironment,\par,\relax,\renewenvironment}
+% \DoNotIndex{\repeat,\scriptsize,\selectfont,\the,\undefined}
+% \DoNotIndex{\arabic,\do,\makeindex,\null,\number,\show,\write,\@ehc}
+% \DoNotIndex{\@author,\@ehc,\@ifstar,\@sanitize,\@title,\everypar}
+% \DoNotIndex{\if@minipage,\if@restonecol,\ifeof,\ifmmode}
+% \DoNotIndex{\lccode,\newtoks,\onecolumn,\openin,\p@,\SelfDocumenting}
+% \DoNotIndex{\settowidth,\@resetonecoltrue,\@resetonecolfalse,\bf}
+% \DoNotIndex{\clearpage,\closein,\lowercase,\@inlabelfalse}
+% \DoNotIndex{\selectfont,\mathcode,\newmathalphabet,\rmdefault}
+% \DoNotIndex{\bfdefault}
+% \setcounter{StandardModuleDepth}{1}
+% \MakeShortVerb{\"}
+%
+%
+% \def\bs{\char`\\}
+% \begin{abstract}
+% \noindent This is the core
+% documentation for {\sc Camel}, a \LaTeX{} macro package
+% that drastically simplifies the typesetting of
+% citations and bibliographies in a wide variety of styles and formats.
+% {\sc Camel} is similar in look and feel to standard \BibTeX{},
+% but introduces a number of long-desired enhancements.
+% When the document is printed,
+% {\sc Camel} allows the generation of
+% subdivided bibliographies,
+% separate bibliographies for each subdivision
+% of a larger work, in-footnote cross-referenced
+% citations, bibliographies indexed to the pages where
+% citations to the relevant work occur, and much else. This is
+% the only fully supported bibliography package for \LaTeX{} that
+% provides full support for legal citations.
+% The package also provides genuinely helpful error messages
+% and an extremely simple syntax for adding details like page
+% numbers and the like to citation tags.
+% {\sc Camel} provides the logical engine and
+% skeleton macros that make these things possible;
+% a separate style package is required to actually typeset documents.
+% For an example of a working style
+% package, see {\tt law.dtx} in the {\tt camel}
+% subdirectory on CTAN.
+% \end{abstract}
+%
+%
+% \tableofcontents
+% \newpage
+%
+%
+%
+% \bigskip
+% \forcefootnotes
+% \hfill {``Now comes the fun part.''}\par
+% \smallskip
+% {\hfill ---Donald Knuth}\source{knuth}[176].%
+%
+% \bigskip
+%
+% \section*{Preface to release 1.0}
+% Welcome to {\sc Camel}, a comprehensive bibliography
+% manager developed as a prototype citation engine
+% for the \LaTeX3 project.
+% The {\sc Camel} engine offers a highly flexible
+% yet straightforward syntax for entering citation
+% keys into a \LaTeX{} document. The {\sc Camel} engine
+% is designed to support a wide range of
+% citation styles. Documents prepared
+% for {\sc Camel} can be converted into virtually any
+% supported bibliography or citation style, usually by editing only
+% a few toggles at the top of the document.\footnote{This is
+% potentially exciting (he said), but as of this writing only one
+% module --- {\tt law.dtx}, the legal citation module used for
+% beta-testing the {\sc Camel} engine --- exists. Some followers
+% of {\sc Camel} development have expressed serious interest in
+% developing other modules, but I cannot make any promises
+% about when additional styles will appear. I've done my work,
+% it is now up to the wider world.}
+%
+% Within the \LaTeX3 project, an extensive
+% survey of bibliographic styles was carried out by
+% David Rhead. Pedro Aphalo, Task Coordinator
+% for bibliographic support on the \LaTeX3 Project,
+% first proposed adopting
+% a unified syntax for all bibliographic
+% styles. {\sc Camel} itself
+% is the brainchild of Frank Bennett, and is
+% based upon his earlier work on the \LexiTeX{} style
+% engine for legal materials.
+% This package completely supercedes \LexiTeX{}, and that
+% earlier style package will no longer be supported.
+% The new package should be referred to as
+% ``the {\sc Camel} citator''.\footnote{%
+% Why {\sc Camel}?
+% The first point to make, I suppose, is that the {\sc Camel}
+% citator has absolutely \textit{nothing} to do with
+% \texttt{Perl}. I had never heard of \texttt{Perl} when {\sc
+% Camel} development began, and scarcely knew anything about it
+% by the time most of {\sc Camel} had been finished. I didn't
+% even realize I was in Larry Wall's space when I used the
+% \texttt{Perl} camel logo for the {\sc Camel} home page!
+%
+% That aside, I can offer several reasons for the name,
+% and users may take their pick.
+% The style operates by gathering citation details
+% that it carries with it through the desert of plain
+% text, until the bibliography engine reaches its oasis
+% at document's end. Alternatively, in his daily work
+% the author uses
+% the multi-lingual enchancement of Emacs,
+% which is called ``Mule''. It's nice for one critter to
+% have the company of another in the stable. A third
+% arbitrary explanation is that the Japanese word for
+% ``camel'' is {\em rakuda}. These syllables, with a
+% different intonation, mean ``dead easy''. Since the
+% design goal of {\sc Camel} is to make bibliography
+% management as easy, as fool-proof and as robust
+% as possible, this cross-lingual pun seems fitting.}
+%
+% The core {\sc Camel} package provides hooks for the development of
+% style options that satisfy all bibliographic requirements
+% that have come to the attention of the \LaTeX3 bibliography
+% team.
+% The foundation
+% has been laid, but much work remains to
+% be done in drafting {\sc Camel} modules to meet
+% all known bibliographic requirements in all fields
+% (and in all languages) for which \LaTeX{} is used.
+% This work will involve the drafting or modification
+% of {\tt .bst} files in the reverse polish notation
+% used by \BibTeX{}, and of {\sc Camel} style
+% modules written in \TeX{}. If you want to contribute to
+% a project that will dramatically enhance the
+% utility of \LaTeX{} as an author's productivity tool,
+% get involved! The
+% developers' email addresses are as follows:
+%
+% \begin{itemize}
+% \item Frank
+% Bennett: {\tt fb@soas.ac.uk}.
+% \item Pedro Aphalo: {\tt aphalo@cc.joensuu.fi}.
+% \item David Rhead: {\tt David\_Rhead@vme.ccc.nottingham.ac.uk}.
+% \end{itemize}
+%
+% A programmer's reference
+% guide for drafting {\sc Camel} styles is included in this
+% manual.
+% Don't delay---start coding today.
+%
+% \newpage
+% \pagenumbering{arabic}
+%
+% \section{Introduction}
+% This guide explains the use of the {\sc Camel} Citator.
+% It covers all commands available in the style. This should be
+% the only user manual that you need to prepare a document for
+% use with any {\sc Camel} bibliography style.
+% The package provides eight commands, listed in the table at the
+% bottom of this page. The opening commands may be combined in a
+% variety of ways, but a typical document heading might look like
+% this:
+%
+% \begin{quote}
+% \begin{verbatim}
+% \documentclass{article}
+% \usepackage{camel}
+% \citationsubject{english}{Materials in English}
+% \citationsubject{german}{Materials in German}
+% \begin{document}
+% \citationstyle{law}
+% \citationdata{gorp,slush,fodder}
+% \forcefootnotes
+% \end{verbatim}
+% \end{quote}
+%
+% You should be careful to decide on the subject classification,
+% if any,
+% that you wish to apply to your citations, before you begin
+% your writing. With that in hand, you can begin entering
+% "\source" commands into the document, adjusting the style
+% parameters at print time. A detailed description of command
+% usage follows. Throughout this guide, it is assumed that
+% the
+% reader has a general familiarity with \BibTeX{}
+% and its use in preparing bibliographies with
+% standard-issue \LaTeX{}. If you need to learn more about
+% \BibTeX, a number of excellent sources of information are
+% available.\source{latex-book},
+% \source{latex-companion}, \source{oren-user} and
+% \source{oren-hackers} The treatment given to the
+% programming language tends to be quite brief, but you should
+% not be put off by this; the language is, in fact, quite simple
+% to use, and the {\sc Camel} programming library makes things
+% even easier.
+%
+% \begin{table}[b]
+% {\small
+% \setlength{\extrarowheight}{3pt}
+% \begin{tabular}{|lll|}
+% \hline
+% \multicolumn{3}{|c|}{\large\bf {\sc Camel} commands}\\\hline\hline
+% "\citationsubject["\meta{options}"]{"\meta{nickname}"}{"\meta{heading text}"}" & optional & preamble \\
+% "\citationstyle{"\meta{style package name}"}" & required &
+% doc top\\\hline
+% "\citationdata{"\meta{bib1,bib2\ldots}"}" & alternative &
+% doc top\\
+% "\bibliographymanager{"\meta{product name}"}" & alternative &
+% doc top\\\hline
+% "\forcefootnotes" & optional & doc top\\
+% "\newinterword{"\meta{nickname}"}{"\meta{text}"}" & optional &
+% doc top\\
+% "\printbibliography{"\meta{nickname}"}" & optional & anywhere\\
+% "\source["\meta{options}"]{"\meta{nickname}"}["\meta{page numbers}"]"
+% & n/a & anywhere\\\hline
+% \end{tabular}
+% }
+% \end{table}
+%
+% \subsection{Commands}
+% \DescribeMacro{\citationstyle}
+% The "\citationstyle" command is used to tell both
+% \BibTeX{} and the {\sc Camel} engine how your citations
+% should be formatted; its argument is the name of a {\sc Camel}
+% module (contained in a {\tt .cst}, a {\tt .cit} and a {\tt
+% .bst} file) such as `{\tt law}'.
+% In this respect, it is similar to
+% a ``document class'', but for citations instead of whole
+% documents.
+% This declaration may be make more than once.\footnote{This
+% feature (support for multiple citation styles in a single
+% document) will be added after the release of \BibTeX~1.0.}
+%
+% \DescribeMacro{\citationdata}
+% This command is used to indicate the ".bib" files
+% from which citation entries should be drawn.
+% As in the "\bibliography" command of standard
+% \LaTeX{}, the "\citationdata" command
+% takes one option, which is a comma-separated list
+% of bibliographies for use in the documents. Each
+% refers to a {\tt .bib} file, each of which should
+% be in the path of your local \BibTeX{}.
+%
+% \DescribeMacro{\bibliographymanager}
+% While we hope that you find \BibTeX{} the most satisfactory
+% means of formatting your citations, you might prefer to use
+% some other software product
+% for the separate task of
+% managing a large citation database.
+% {\sc Camel} has been designed so that it can be used
+% with a number of such utilities. If you are using an
+% external bibiliography manager, you should declare
+% the name of the package at the top of the document
+% using the "\bibliographymanager" command. Supported
+% managers, and their corresponding nicknames for this
+% command, are:
+%
+% \begin{itemize}
+% \item Reference Manager ({\tt referencemanager})
+% \item Papyrus ({\tt papyrus})
+% \item ProCite ({\tt procite})
+% \item EndNote ({\tt endnote})
+% \end{itemize}
+%
+% The details on how
+% to join external bibliography managers with
+% {\sc Camel} are
+% below at page \pageref{processing:documents}.
+%
+% If you use the "\bibliographymanager" command,
+% you should not use the "\citationdata" command.
+% This is not felt to be a serious limitation; if you use a
+% bibliography manager, you might as well put
+% {\em all\/} of your citations into it anyway, and use
+% it as the sole source of citations in your
+% documents.
+%
+% \DescribeMacro{\citationsubject}
+% You may wish to produce a bibliography classified
+% into subheadings by subject or by type of
+% material. To do this, place a set of "\citationsubject"
+% commands at the top of your document, or after a
+% "\printbibliography" command. Each command takes
+% two mandatory arguments and one optional argument. The first
+% mandatory argument indicates the nickname that you
+% will use in your document to attach a citation to
+% the category. The second is the section heading
+% that you wish to see displayed for that section
+% of the bibliography.
+%
+% The optional argument may be used for two purposes. First, you
+% may want to further divide your bibliography into
+% sub-subheadings. You can specify a such a subcategory by
+% putting a "2" as the optional argument to the
+% "\citationsubject" command. Otherwise, a first-level header is used.
+% Where the "\printbibliography" command is issued,
+% the parts and sub-parts of the bibiliography will be produced in the
+% order in which they were declared.
+%
+% For some types of citation, you may wish to produce
+% a table that shows more detail about citations made.
+% With {\sc
+% Camel}, simply add an optional argument to
+% the "\citationsubject" command applicable to your desired table
+% which includes an {\tt o=} argument of three letters (giving
+% the extension of the raw data output file), and an {\tt i=}
+% argument of three letters (giving the extension of the {\tt
+% makeindex}-processed input file). Optionally, you may also
+% include arguments of {\tt p} or {\tt P}.
+% With {\tt p}, the output
+% file will be passed the page or section numbers given in
+% pinpoint arguments to the "\source" command.
+% With {\tt P}, index-style page references to the main text are turned
+% on.
+% With or without the {\tt P} or {\tt p},\footnote{The syntax of these options is the same as for
+% options to the {\tt\bs source} command, discussed above.} the
+% export file should be processed with {\tt makeindex} using
+% {\sc Camel}'s own "camel.ist" file to produce the
+% import file.
+% This table-creation feature exists principally for typesetting
+% tables of statutes.
+%
+% \DescribeMacro{\forcefootnotes}
+% If you are preparing a document that is to be, or may
+% be, prepared with citations in footnotes at the bottom
+% of the page, you can save yourself some typing (and
+% make it easier to produce the same document in other
+% formats) by using the "\forcefootnotes" command at
+% the top of the document. In some styles this command
+% has no effect since, for example,
+% a footnote containing only
+% ``[2]'' would look rather peculiar.
+%
+% \DescribeMacro{\newinterword}
+% In a string citation, you may want to use a connecting
+% word that is not already in {\sc Camel}'s internal list.
+% You can add a word to this list with the "\newinterword"
+% command. This command takes two mandatory arguments.
+% The first is the nickname you wish to give to the
+% word and its associated punctuation. The second is
+% the text to be inserted when you use the new
+% connecting word between two "\source" commands.
+%
+% The connecting word may appear either at the beginning
+% of a citation string (as the argument to a
+% {\tt !=} option in the first "\source" command of a
+% string), or in the middle, between
+% two citations. Two special characters are used to
+% control the appearance of the word in these two
+% positions. A leading punctuation mark should be
+% preceded by a {\tt\string_} character. This will
+% suppress such a punctuation mark, and the space
+% following it, if the connecting word is used
+% as a prefix to an initial citation in a string.
+% The {\tt\string^} character should precede the
+% first word of the phrase associated with the
+% connecting word, and that character should be
+% capitalized. The first character of the phrase will
+% then be forced to lower case if the connecting word
+% is used between two "\source" commands.
+%
+% The following examples may be useful for guidance:
+%
+% \begin{itemize}
+% \item "\newinterword{cf}{_; ^C.f.~}"
+%
+% \item "\newinterword{see-generally}{_. ^See generally\ }"
+% \end{itemize}
+%
+% \DescribeMacro{\printbibliography}
+% Place a "\printbibliography" command in your document
+% wherever you would like the bibliography to appear.
+% The "\printbibliography" command takes one optional argument,
+% "labels". In the "keyval=" syntax, this may be set to either
+% {\tt labels=false} or {\tt labels=true}. This toggles the
+% appearance of bracketed numerical or shorthand labels in front
+% of each bibliography item.
+%
+% If no "\citationsubject" commands are used at the top of
+% the document, "\printbibliography{all}" will produce
+% a full bibliography of all references made in the
+% document up to that point. If "\citationsubject" has been
+% used, then "\printbibliography{all}" will produce the
+% same bibliography, but classified by subject, with the headers
+% specified in the "\citationsubject" commands at the top of the
+% document.
+%
+% You may also specify a subject to the "\printbibliography"
+% command, instead of "all". This will produce a bibliography
+% formatted as requested in the "\citationsubject" command. Note
+% that, if the "i=" and "o=" options are used with
+% "\citationsubject", "makeindex" must be used to generate the
+% input file that will be expected for that subject. Note also
+% that such external tables will be ignored by
+% "\printbibliography{all}" where citation subjects are used.
+%
+%
+% \DescribeMacro{\source}
+% The most common command for {\sc Camel} users is the "\source"
+% command, which replaces the "\cite" command of standard \LaTeX.
+% It is used to identify the citation in the {\tt .bib} data
+% files, and to provide a logical description of any
+% `fine-tuning' of the citation form that the user might desire.
+% Because it is frequently used, and must be accessible to
+% authors with more interest in the content of what they are
+% writing than the inner workings of \LaTeX, much
+% effort has gone into making the command as simple to use as
+% possible.
+%
+% \subsubsection*{Options}
+% The valid options that may be placed inside the
+% first set of square braces are shown below.
+%
+% \medskip
+% \label{sourceoptions}
+% \newcommand{\PreserveBackslash}[1]{\let\temp=\\#1\let\\=\temp}
+% {\hyphenpenalty=200\setlength{\extrarowheight}{3pt}
+% \noindent\begin{tabular}
+% {|>{\tt }r@{ --- }
+% >{\small}p{4.4in}|}\hline
+% \multicolumn{2}{|c|}{\large\bf Single character options}\\
+% \hline\hline
+% a & Supress printing of author's name in the document.\\
+% t & Suppress printing of the title in the document.\\
+% l & Force automatically generated abbreviations to
+% lower case.\\
+% n & Suppress printing of the citation in the document
+% (equivalent to {\tt \char`\\nocite} in standard
+% \LaTeX{}).\\
+% f & Force the full form of the citation to be printed
+% in the document.\\
+% h & Suppress automated footnote generation and the use of
+% interwords for the current and following citations. This
+% option should not be used in the middle of a string of
+% citations linked with interwords.\\\hline
+% \multicolumn{2}{l}{}\\\hline
+% \multicolumn{2}{|c|}{\large\bf String options}\\
+% \hline\hline
+% s= & Associate the citation with the specified subject.
+% This option can be freely specified, but only has
+% significance when a classified bibliography is
+% being produced. When these subject tags are being
+% used for that purpose, they must be declared at
+% the top of the document, and a given source must
+% be associated with the same subject throughout
+% the document; specifying a different subject
+% from that used in the first use of the citation will
+% produce an error message from \LaTeX{}.\\
+% v= & Give a volume number for use in the citation.
+% {\tt BOOK} entries in a \BibTeX{} database
+% may be given a volume number. Such citations are
+% assumed to be multi-volume works, and a volume
+% number should be supplied when citing them; the volume
+% number given in a {\tt BOOK} entry itself ignored, and an
+% error message will be produced if an explicit volume
+% number is not given using this option.\\
+% != & Precede the citation with the interword given in
+% the argument.\\\hline
+% \end{tabular}}
+%
+% \medskip
+% These options may be entered in the option braces
+% in any order,
+% with the single requirement that
+% a comma must separate all options.\footnote{Separating
+% commas are required from version 1.0r, because this
+% is the syntax of the \texttt{keyval} package.}
+%
+% The number of possible citation forms that can
+% be generated using these command options is
+% very large, and varies from one style to another.
+% The best way of familiarizing yourself with them
+% is to finish reading the next section of this guide,
+% and then do a little experimentation with the
+% various options. This will serve you much better
+% than a verbose set of illustrations here, which would
+% not stick in the memory, would be difficult to use
+% as a reference, and could not
+% in any case cover all of the possibilities.
+%
+% The following
+% citations are all valid:
+%
+% \begin{itemize}
+% \item "\source[ats=school]{ucla}"
+% \item "\source[av=8,t]{harvard}"
+% \item "\source[s=town,nat]{oxford}"
+% \end{itemize}
+%
+% A string of citations applying to a particular statement
+% may be entered as follows:
+%
+% \begin{itemize}
+% \item "\source["\meta{options}"]{"\meta{nickname}"}["\meta{page numbers}"]"\\
+% \meta{interword}\\
+% "\source["\meta{options}"]{"\meta{nickname}"}["\meta{page numbers}"]"
+% \end{itemize}
+%
+% \subsubsection*{Keys}
+% The key given in the squiggly braces should correspond
+% to the key that identifies the entry in the \BibTeX{}
+% or other database that you are using. If you have
+% a series of citations to make, and do not need to
+% give separate options to any of them, you can enter
+% them as a comma-delimited string, in the following
+% manner:
+%
+% \begin{quote}
+% "\source[s=stooges]{joe,curly,moe}"
+% \end{quote}
+%
+%
+% \subsubsection*{Pinpoints}
+%
+% For most citations, pinpoint references are simply typed
+% between the second pair of square braces, using
+% normal punctuation marks ({\tt\ ,\ \& -\ }). Spacing
+% is irrelevant, so long as the punctuation marks
+% are entered. A valid simple
+% pinpoint citation might look as follows:
+%
+% \begin{quote}
+% "\source{major}[2, 7, 9 & 23]"
+% \end{quote}
+%
+% In some
+% very special situations, {\sc Camel} needs more information
+% to handle pinpoint references correctly.
+% Suppose
+% you are entering a citation for a statute, and you intend
+% to produce a table showing where references to each cited
+% section of the statute are made in the text. If your
+% citation includes references to more than one section of
+% the statute, {\sc Camel} will produce a table entry
+% for each cited section automatically. But what if you
+% are citing a {\em range\/} of sections? {\sc Camel}
+% cannot know whether the range is continuous, or has
+% gaps in it where provisions have been repealed.
+% You therefore need to tell {\sc Camel} explicitly about
+% each section number---but you don't want the numbers
+% to be printed in the text. To feed citation numbers
+% to the table, but suppress printing in the document,
+% separate the numbers to ``hidden'' from the rest
+% with a ``fence'' in the form of the "|" character.
+% A typical citation of this
+% kind might look like this:
+%
+% \begin{quote}
+% "\source{SaleofGoodsAct}[19-25 | 20, 21, 22, 23, 24]"
+% \end{quote}
+%
+% There are two other situations, also related only to
+% the production of tables, where special markings may
+% need to be included in the pinpointing string. These
+% are (a) where you want material to appear only in
+% the text, and (b) where you want material to appear
+% only in the table. The first case may arise where
+% you are citing subsections of a statute. In this
+% situation, you can enclose in {\tt \string^} characters
+% any text that you want to withhold from the table.
+% A simple citation of this kind might look as
+% follows:
+%
+% \begin{quote}
+% "\source{VehicleCode}[23(A)^(3)(a)(i)^]"
+% \end{quote}
+%
+% Where material should appear only in the table,
+% enclose that pinpoint material in {\tt\string_}
+% characters. This might be necessary where, for
+% example, you are citing two subsections of the same
+% statute. An example might look as follows:
+%
+% \begin{quote}
+% "\source{LawofPropertyAct}[70(1)(f) & _70(1)_(g)]"
+%\end{quote}
+%
+% Finally, there is one more feature that applies only to
+% `parallel citations' to law cases. If a law case to which you are
+% referring is reported in more than one location (see below),
+% and you want to give a pinpoint to
+% each location, you can do so by using the the {\tt =} sign
+% between the pinpoint strings. For example:
+%
+% \begin{quote}
+% "\source{bloggvkermit}[20-25 = 125-26 ]"
+% \end{quote}
+%
+% If more parallel pinpoints are given than exist in the
+% \BibTeX{} entry for the case nicknames {\tt bloggvkermit}, the
+% extra pinpoints will be ignored. Similarly, if you give fewer
+% pinpoints than there are parallels in the \BibTeX{} entry, the
+% portions of the entry with no matching pinpoints will be
+% omitted. No warnings are issued, although they could be
+% if there is a demand for it.
+%
+% \subsection{\BibTeX{} features}
+%
+% A number of enhancements for processing \BibTeX{}
+% entries have been incorporated into the {\sc Camel} \BibTeX{}
+% programmer's library. These enhancements are drawn upon by the
+% {\tt law.bst} style, and should also be used by subsequent {\sc
+% Camel} style modules. These features are described briefly
+% here. Please see the \BibTeX{} documentation for more
+% information on the format of \BibTeX{} entries et cetera.
+%
+% \subsubsection*{Cases}
+%
+% A new entry type, {\tt @CASE}, has been added. This entry type
+% should be used for reported law cases. Although citation forms
+% vary widely between jurisdictions, {\sc Camel} bases the
+% formatting of the citation on the information contained in the
+% citation, rather than a tag indicating the jurisdiction.
+%
+% A result of this approach is that there are no `required'
+% fields in the usual sense that \BibTeX{} will complain if
+% something is missing. Instead, is a set of
+% `core' fields for each of three different formatting styles.
+% For someone familiar with legal resources, this is actually
+% quite intuitively straightforward.
+%
+% For reported U.S. law cases, the core fields are {\tt title}, {\tt volume},
+% {\tt journal}, {\tt pages} and {\tt year}. In addition, you
+% may wish to specify {\tt court}.\footnote{This is not yet
+% implemented, but can be and should be.} Procedural histories may not
+% be represented in the \BibTeX{} entry.
+%
+% For reported Commonwealth cases, use {\tt number} instead of
+% {\tt volume}. The effect of this will be to place the year at
+% the front of the citation in square braces, with the {\tt
+% number} and {\tt journal} following it. Again, you may specify
+% {\tt court} optionally.
+%
+% For cases reported in ephemeral media such as newspapers, leave
+% out {\tt volume} and {\tt number}, and give the full date in
+% the {\tt year} field instead (see below for the formatting of
+% dates). The formatting of the citation will adjust
+% accordingly.\footnote{I'm not sure whether this works with
+% parallels yet. If it doesn't but you need it to, let me know
+% and I'll fix it.}
+%
+% For cases reported in jurisdictions such as Japan that refer to
+% cases by date rather than title, use {\tt casedate}, {\tt
+% court}, {\tt journal}, {\tt volume}, {\tt pages} and {\tt
+% year}. Optionally, you may also wish to include {\tt divno}
+% and {\tt division}, to specify the exact identity of the
+% deciding court.
+%
+% \subsubsection*{Statutes}
+%
+% Support for statutes is still in its infancy. You need, at
+% minimum, to enter {\tt title}, {\tt year} and {\tt
+% jurisdiction}. Supported jurisdictions are {\tt japan}, {\tt
+% singapore} and {\tt england}.
+%
+% \subsubsection*{Dates}
+%
+% The entry of dates has been considerably simplified in {\sc
+% Camel} \BibTeX{} entries. Always use the {\tt year} field (or,
+% if appropriate, the {\tt casedate} field). Months may be
+% entered as numbers or as a three-character string. The following date
+% forms are all valid:
+%
+% \begin{quote}
+% \begin{verbatim}
+% year = {10 jun 1995},
+% year = {jun 10 1995},
+% year = {jun 1995},
+% year = {1995},
+% year = {10/06/95},
+% \end{verbatim}
+% \end{quote}
+%
+% \subsubsection*{Parallel citations}
+%
+% For {\tt @CASE} entries, it is possible to enter multiple citations in a
+% single \BibTeX{} entry using a short form of citation in a
+% field called {\tt cites}, separating entries with a {\tt =}
+% character.\footnote{It actually does work. \source{halsall-v-brizell}.}
+% There are several valid syntaxes for
+% this field, which closely follow the citation format used in
+% the Blue Book for the relevant sources. They are:
+%
+% \begin{quote}
+% \begin{verbatim}
+% cites = {[1995] 1 All ER 25 = [1995] 2 WLR 125},
+% cites = {123 Cal.3d 237 (1995) = 124 S.W.2d 235 (1995)},
+% \end{verbatim}
+% \end{quote}
+%
+% You can string together an arbitrary number of parallel citations in
+% this way.\footnote{Cross-references are complex to format, but
+% they work correctly. \source{halsall-v-brizell}. In a competition for
+% speed and accuracy between typists equipped with \LaTeX/{\sc
+% Camel} and with WordPerfect, who do you reckon would win?}
+% Be sure to read the notes on pinpointing, above,
+% for details on how to specify pinpoint references to parallel
+% citations.
+%
+% \subsection{Processing documents}
+%
+% \subsubsection*{Ordinary processing}
+%
+% For a simple document containing no cross-references
+% other than those produced by {\sc Camel},
+% printing requires one run of \LaTeX{}, one run of
+% \BibTeX{}, and a second run of \LaTeX{}. Because
+% {\sc Camel} absorbs all citation information
+% at the start of the document (at the point of the "\citationdata"
+% or "\bibliographymanager" commands), there is no need for
+% the third \LaTeX{} run required in the standard
+% \LaTeX{} setup. You may, however, need additional
+% runs of \LaTeX{} to resolve other cross-references
+% in the document, or to work out misspellings and other
+% errors.
+%
+% \subsubsection*{Producing tables}
+% \label{processing:documents}
+% When the "o=" and "i=" options are used for
+% one or more declared citation subjects, those subjects
+% will be excluded from the bibliography. Instead,
+% {\sc Camel} will write an external table file according
+% to the specifications given in the "\citationsubject"
+% command. Any such files
+% must then be processed into properly formatted
+% lists using {\tt makeindex} before they will appear
+% in the printed document.\footnote{The documentation for
+% {\tt makeindex} will explain how it should be set
+% up for your system. On a UNIX or DOS installation,
+% the basic requirements are that the {\tt makeindex}
+% program be in your search path, and that the appropriate
+% environment variable (usually {\tt indexstyle}) be
+% set---this tells {\tt makeindex} where to find the style
+% files that tell it exactly how to format the finished
+% table lists.} On a UNIX or DOS system you would type the
+% following for a table declared with the export
+% extension ".atb" and the input extension ".art":
+% \begin{quote}
+% \small
+% {\tt makeindex -s camel.ist -o} \meta{file name}".art" \meta{file name}".atb"
+% \end{quote}
+% If the subject associated with this table is "article",
+% the table can then be placed in the document
+% for the next \LaTeX{} run using the
+% command:
+%
+% \begin{itemize}
+% \item "\printcitationtable{article}".
+% \end{itemize}
+%
+% When the option "p" is used with the
+% "\citationsubject" command and the "i=" and "o=" options,
+% the table will include any section or other numbers
+% given as optional arguments to "\source" commands in the
+% document. Because "makeindex" sorts alphabetically,
+% not numerically, the section numbers may be out of
+% their proper order in the "makeindex"-processed file.
+% This must be corrected by hand.
+%
+%\newpage
+% \section{Notes for Implementors}
+%
+% \subsection{Getting started}
+%
+% The purpose of this section is to provide style designers
+% with all of the information required to write a new
+% bibliography style from scratch, drawing on the powerful
+% facilities available in \BibTeX{} and the {\sc Camel}
+% style engine.\footnote{As of this writing, however, I've not received
+% any feedback on the whether this documentation is any
+% use. If you are attempting to draft a style and feel
+% at sea, \textit{complain to me}! It's the only way
+% we can make things easier for the others.} Before you start,
+% you should have a
+% sound knowledge of \BibTeX{} primitives, and of the
+% programmer's function library contained in the
+% file {\tt camel.dtx}. A bibliography style consists of a
+% {\tt .bst} file, a ".cst" file and a ".cit" file.
+% The ".bst" file should produce entries suitable
+% for digestion by {\sc Camel} for all of the \BibTeX{}
+% entry types supported by the style.
+%
+% The modules of the {\sc Camel} system work
+% together in an integrated fashion to format citations.
+% Raw citation details are kept in {\tt .bib} databases. The
+% function of the {\em Camel} system is to massage those details
+% into formatted citations, and include them in appropriate
+% locations in typeset pages. When a document invoking the {\sc
+% Camel} package encounters a "\citationstyle" command, the
+% relevant ".cst" and ".cit" files are loaded. A corresponding "\bibstyle"
+% entry is also written on the {\tt .aux} file. A
+% "\citationdata" command causes a relevant "\bibdata" command to
+% be written there as well. If a "\bibliographymanager"
+% declaration is used instead, a "\bibdata" entry calling on the
+% file "camel.bib" is written to {\tt .aux}.
+% When a "\source" command is
+% encountered during processing, code contained in
+% {\tt camel.sty} writes a "\citation" entry for that citation on
+% the {\tt .aux} file. In this way, an orthodox set of entries
+% and files for use with \BibTeX{} is generated.
+%
+% If an external bibliography manager is used, the file
+% "camel.bib" must be converted into a valid {\tt .bib} file,
+% using whatever tools for finding and replacing key entries the
+% database manager has to offer.
+%
+% \BibTeX{} must then be run on the document. This reads the
+% entries on the {\tt .aux} file, opens the {\tt .bib} databases,
+% reads them, and writes the result of its ruminations on a {\tt
+% .bbl} file. At this point, the operation of {\sc Camel}
+% diverges sharply from that of conventional \LaTeX{}
+% bibliography tools. With {\sc Camel}, \BibTeX{} is used to
+% generate "\lexibib" entries on the {\tt .bbl} file. Such
+% entries parse the citation into logical typesetting units, but
+% the typefaces used within the units, and the punctuation that
+% appears between them, is not determined by \BibTeX. The tasks
+% of punctuation and typeface selection are carried out on the
+% second run of \LaTeX{} on the document, using the details
+% specified in the {\tt .cit} file for the {\sc Camel} citation style
+% being used.
+%
+% It is worth spending some time pondering this programming flow;
+% there are good reasons for spreading the formatting work
+% over
+% a number of different modules in this way, and it is important
+% to understand the design before embarking on the drafting of a style.
+%
+% \subsection{The {\tt .cst} file}
+%
+% The ".cst"
+% file should contain, at least, the following
+% macros:
+%
+% \begin{description}
+% \item[{\tt\bs @law@print}:] This is the macro that
+% actually prints the citations in the document and in
+% the bibliography. Its structure is discussed below
+% in the commented code listing of the default
+% "\@law@print" command, which draws on most of the
+% conditional handles provided by {\sc Camel}.
+% \item[{\tt\bs @law@wordlist}:] This is a list macro consisting
+% of paired interword nicknames and corresponding punctuation/text
+% sets. Possible changes you may wish to make to this
+% file are discussed in the commented code description of
+% this macro.
+% \end{description}
+% Additional macros (including re-definitions of
+% the macros contained in the {\sc Camel} engine)
+% may be included in the ".cst" file. Be sure to
+% document your work, however; {\sc Camel} is among the
+% more complex packages written for use with \TeX{},
+% and documentation is essential if problems that arise
+% are to be sorted out quickly and efficiently.
+%
+% Concerning the "\@law@wordlist" macro, it is best to examine
+% the existing macro in "law.dtx", and read the
+% user documentation on the "\newinterword" command.
+% With this information, you should be able to make
+% any changes you require in the behaviour of the list
+% to suit your new style. You should not omit items from
+% the list---this is important to maintain compatibility
+% between styles. You may want to add to the list,
+% and this is welcomed---drop a note to Frank Bennett
+% on "fb@soas.ac.uk" to assure that your new addition is
+% incorporated into the "law.dtx" list, which is used as
+% a model, so others will
+% include it in their styles too.
+%
+% Drafting the "\@law@print" macro may be difficult to
+% approach at first. If you examine the example in the
+% "law.dtx" file, you may be somewhat intimidated by the
+% size and complexity of the macro listed there. But in
+% fact for most styles this macro should be reasonably simple
+% to write; the "law.dtx" example is complex because it
+% automates a very complex set of style rules applying to
+% legal materials.
+%
+% Essentially, what "\@law@print" does is print a citation
+% in a particular form according to a set of conditions
+% that can be recognized from toggles in effect when
+% the macro is run by the {\sc Camel} engine. The toggles
+% that may be drawn upon are described here. For further
+% information, study the example in "law.dtx"---bearing in
+% mind that your own macro will probably be simpler to
+% draft.
+%
+% \subsection{Toggles and hooks for the {\tt .cit} file}
+% \def\lawtrue{{\tt true}\ }
+%
+%\subsubsection{Citation history}
+%{\def\PrintDescribeMacro#1{\strut\MacroFont\bs #1\ }
+%\DescribeMacro{if@law@firstuseofcite}
+% This is \lawtrue during the first expansion of a citation
+% nickname in the text.
+%
+%\DescribeMacro{if@justabove}
+% This is set to \lawtrue where (a) the author, title, source, page
+% and citation trailer are identical in the last citation used
+% in a footnote and in the current citation, (b) the last
+% citation used in a footnote was the only citation in that
+% footnote, and (c) a pinpoint was not used in the previous citation
+% or, if there was such a pinpoint, a pinpoint is also used in
+% the current citation.
+%
+%\DescribeMacro{if@l@quiteexact}
+% This is set to \lawtrue where (a) "\@law@justabove" is set \lawtrue
+% and (b) a pinpoint was used in both citations, and (c) the
+% pinpoints match exactly.
+%
+%\subsubsection{Formatting toggles}
+%
+%\DescribeMacro{if@law@printcite}
+% If this is \lawtrue the citation should print. Otherwise it
+% should not. It should also trigger suppression of footnote forcing.
+%
+%\DescribeMacro{if@law@printauthor}
+% If this is \lawtrue the name of the author prints.
+%
+%\DescribeMacro{if@law@printtitle}
+% If this is \lawtrue the title of the work prints.
+%
+%\DescribeMacro{if@law@longcite}
+% If this is \lawtrue the citation should be printed in its full
+% form. This is set \lawtrue by the "f" option to the "\source" command.
+% }
+%\subsubsection{typefaces}
+%
+%\DescribeMacro{\@ltok@authormainface}
+% This is the typeface set in the {\tt .cit} file for author
+% names. It, and all other "\@ltok@" control strings are token
+% registers that must be expanded using "\the".
+%
+%\DescribeMacro{\@ltok@authoroptionface}
+% This is the typeface selected by enclosing text in the author
+% portion of the citation within "\\" commands in the current
+% citation's type (i.e.~as defined in its "\newcitestyle" entry).
+%
+%\DescribeMacro{\@ltok@titlemainface}
+% The typeface used for the title portion of the citation.
+%
+%\DescribeMacro{\@ltok@titleoptionface}
+% The alternative "\\" typeface within the title argument to "\lexibib".
+%
+%\DescribeMacro{\@ltok@citefirstmainface}
+% The typeface used for the source portion of the citation.
+%
+%\DescribeMacro{\@ltok@citefirstoptionface}
+% The alternative for the source portion of the citation.
+%
+%\DescribeMacro{\@law@firstslash}
+%\DescribeMacro{\@law@secondslash}
+% These two commands should be defined as follows in your
+% "\@law@print" command
+% before citation elements are expanded. This could be done
+% within {\sc Camel} itself, but this gives you a little more
+% hands-on control in style design maybe.
+% \begin{quote}
+% "\def\@law@firstslash{\begingroup\def\\{\@law@secondslash}%"\\
+% "\the\ltokspecialface}%"\\
+% "\def\@law@secondslash{\endgroup\def\\{\@law@firstslash}}%"\\
+% "\def\\{\@law@firstslash}%"
+% \end{quote}
+%
+%\subsubsection{Citation details}
+%
+%\DescribeMacro{\@ltok@whereitsat}
+% This actually contains the text that is used to flag either a
+% note or a page number (i.e.~"{\ note\ }" or "{\ page\ }").
+% This is used only where citation cross-referencing is required.
+%
+%\DescribeMacro{\@ltok@stylename}
+% This stores the citation type used to declare the citation
+% with "\lexibib". This is mainly used for internal purposes by
+% {\sc Camel}, but if you're printing a style or proof sheet, or
+% are just trying to debug a style, you
+% may have a use for it.
+%
+%\DescribeMacro{\@ltok@nickname}
+% This stores the nickname of the citation.
+%
+%\DescribeMacro{\@ltok@author}
+% This stores the author portion of the citation.
+%
+%\DescribeMacro{\@ltok@name}
+% This stores the title portion of the citation.
+%
+%\DescribeMacro{\@ltok@citefirst}
+% This stores the source portion of the citation.
+%
+%\DescribeMacro{\@ltok@citepage}
+% This stores the page number ({\em not\/} the pinpoint!) of the citation.
+%
+%\DescribeMacro{\@ltok@citelast}
+% This stores the citation trailer.
+%
+%\DescribeMacro{\@ltok@pageorfootno}
+% This stores either the page or the footnote number at which the
+% citation first occurred.
+%
+%\subsubsection{Bridges}
+%
+%\DescribeMacro{\@ltok@atot}
+% This contains the punctuation bridge, declared in the {\tt
+% .cit} file for the current citation type, that is to be placed between the author and the
+% title elements of the citation.
+%
+%\DescribeMacro{\@ltok@ttocone}
+% This contains the bridge that is to be placed between the title
+% and the source.
+%
+%\DescribeMacro{\@ltok@conetop}
+% This contains the (singular) bridge that goes between the
+% source and the page number.
+%
+%\DescribeMacro{\@ltok@conetopplural}
+% This contains the alternative plural bridge that goes between
+% the source and the page number.
+%
+%\DescribeMacro{\@ltok@ptop}
+% This contains the bridge that goes between a page reference
+% giving the location of an article, for example, and the
+% pinpoint reference.
+%
+%\DescribeMacro{\@ltok@ptoctwo}
+% This contains the bridge that goes between any page numbers and
+% the citation trailer.
+%
+%\DescribeMacro{\@ltok@atbridge}
+% This contains the bridge that goes between an abbreviated
+% citation (i.e.~{\em Id.}\ or somesuch) and a pinpoint.
+%
+%\DescribeMacro{\@ltok@atbridgeplural}
+% This contains the plural bridge for abbreviated citations.
+%
+%\subsubsection{Pinpoint printing}
+%
+%\DescribeMacro{\@law@barkill}
+% The pinpoint information is contained in the token register
+% "\@ltok@argtwo". To print the pinpoint, you should always use
+% the following form, which will induce the correct behaviour of
+% the string expansion engine within {\sc Camel}.
+%
+% \begin{quote}
+% "\@law@barkill\the\@ltok@argtwo\relax"
+% \end{quote}
+%
+% \subsection{The {\tt .cit} file}
+%
+% The ".cit" file should
+% contain instances of the "\newcitestyle" command
+% and associated arguments. This defines a {\sc Camel}
+% style instance for each of the entry types supported
+% by the style's ".bst" file. If you find it necessary to add
+% a new entry type to the style defined in the {\tt .bst}
+% file for your style, you must also define a {\sc Camel}
+% style instance in the ".cit" file applying to
+% this new entry type.
+%
+% \newpage
+% The arguments to the "\newcitestyle" command
+% have the functions described in the following footnoted
+% illustration:
+%
+% \medskip
+% {\small
+% \newlength{\cardwidth}
+% \setlength{\cardwidth}{\textwidth}
+% \addtolength{\cardwidth}{-4\columnsep}
+% \begin{tabular}{|c|} \hline
+% \begin{minipage}{\cardwidth}
+% \renewcommand{\thefootnote}{\alph{footnote}}
+% {\tolerance=1500\raggedright
+% "\newcitestyle{article"\footnotemark[1]"}%"\\
+% " {rsirsr"\footnotemark[2]"A"\footnotemark[3]"}%"\\
+% " {[a],\ "\footnotemark[4]"[t],\ "\footnotemark[4]
+% "[c]\ "\footnotemark[4]
+% "[p],\ "\footnotemark[4]
+% "(pl),\ "\footnotemark[4]
+% "[rp]\ "\footnotemark[4]
+% "[e]:[id]\ at~"\footnotemark[4]
+% "(pl)\ at~"\footnotemark[4]
+% "[xrf]}%"\\
+% " {6}"\footnotemark[5]"%"\\
+% "{{#1}"\footnotemark[6]"{#2}"\footnotemark[6]%
+% "{#3}"\footnotemark[6]"{#4}"\footnotemark[6]%
+% "{#5}"\footnotemark[6]"{(#6)}"\footnotemark[6]"}%"}\\
+% \footnotetext[1]{This gives the name of the citation template to be generated.}
+% \footnotetext[2]{The first part of this list of arguments consists always of exactly six
+% letters: the first three pairs set the main and alternative typefaces for
+% the author, title
+% and first-cite-part portions of the citation. {\tt r}, {\tt s}, {\tt b} and
+% {\tt i} select roman, small caps, boldface and italic type.
+% These letter flags are not case sensitive.
+% The alternative typefaces may then be specially selected in the text
+% arguments to a citation using
+% {\tt\string\\...\string\\}.}
+% \footnotetext[3]{The last letter in this list sets the classification
+% of citations declared with the resulting style macro. {\tt a}, {\tt b}, {\tt
+% c} and {\tt s} will classify all citations generated by this
+% citation template as being to articles, books, cases or statutes,
+% respectively. This letter flag is not case sensitive.}
+% \footnotetext[4]{These are the citation bridges that
+% will be placed between the portions of the citation indicated. Two
+% bridges, singular and plural, are given between {\tt [p]}
+% (page) and
+% {\tt [rp]} (reference page), and between {\tt [id]} ({\em id.}
+% or {\em supra\/}) and {\tt [xrf]} (cross-reference).}
+% \footnotetext[5]{This argument states how many arguments the finished citation
+% template will accept. It must be a number between {\tt 1} and {\tt
+% 6}.}
+% \footnotetext[6]{Six pairs of matched braces must appear inside this
+% argument. Any other than the first (which represents the citation
+% nickname) may be left empty, but the bridges must of course take this
+% into account. The number of arguments inserted here must correspond
+% with the number stated on the line above.}
+% \vspace{3pt}
+% \end{minipage}\\ \hline
+% \end{tabular}}
+%
+% \subsection{The {\tt .bst} file}
+% \subsubsection{Entry types}
+% Most of the work in drafting a new style is in writing entry
+% type functions for inclusions in the {\tt .bst} file. This is,
+% inevitably, an arduous task, because of the number of
+% possibilities that must be covered. The task is made easier,
+% however, by the {\tt .bst} file programming library contained in
+% the file {\tt camel.dtx}. This library provides a set of
+% functions for the manipulation of fields pushed onto the stack
+% in the entry type functions themselves. This approach
+% increases the transparency of your code, because you can see in
+% the entry type function itself exactly what fields are being
+% used, and what logical and formatting operations are being
+% carried out on them.
+%
+% Using the library is highly recommended. If you find that
+% you require functions that are not presently available in the
+% library, you can make your solutions available to others by
+% adhering to a few design guidelines, and passing the function
+% on to {\tt fb@soas.ac.uk} for inclusion in the {\sc Camel}
+% distribution. The guidelines are actually quite simple. No
+% library function should directly manipulate a field, but should
+% instead expect to find the field on the stack when it is
+% invoked. No library function should make assumptions about the
+% setting of variables; any parameters should also be passed to
+% the stack before the library function is invoked. When
+% finished, a library function should always leave a fixed number
+% of items on the stack, in a fixed order. And a library
+% function should not pass data to subsequent functions in the
+% form of variables. Finally, a function
+% should be documented concerning (a) the number of items it
+% expects to find on the stack, and in what order, (b) the number
+% of items it leaves on the stack, and in what order, and (c) the
+% effect of any toggle strings that may be fed to the function.
+%
+% You may find it necessary, in drafting a function, to divide
+% its operation into sub-functions. As between sub-functions,
+% the ban on passing data through variables need not be followed,
+% so long as the set of functions adheres to the rule.
+%
+% \subsubsection{About cross-referencing}
+% About cross-referencing, Oren Patashnik wrote:
+% \begin{quote}
+% Now come the cross-referencing functions (these are invoked
+% because one entry in the database file(s) cross-references
+% another, by giving the other entry's database key in a
+% "crossref"
+% field). This feature allows one or more titled things that are
+% part of a larger titled thing to cross-reference the larger
+% thing. These styles allow for five posibilities:
+%
+% \begin{enumerate}
+% \item an {\bf article} may cross-reference an {\bf article};
+%
+% \item a cross-reference to a {\bf book} may be made in an
+% entry for:
+%
+% \begin{enumerate}
+% \item a {\bf book};
+% \item an {\bf inbook}; or
+% \item an {\bf incollection}; and
+% \end{enumerate}
+%
+% \item
+% an {\bf inproceedings} may cross-reference a {\bf proceedings}.
+% \end{enumerate}
+% Each of
+% these is explained in more detail later.
+% \end{quote}
+%
+% This is the authoritative statement on the proper use of
+% cross-referencing within a ".bib" file. The further comments I
+% have to offer
+% here are a non-authoritative gloss, but do accurately reflect
+% the assumptions I made in writing the ".bst" code for the
+% "law.dtx" file.
+%
+% \begin{description}
+% \item[{\tt article}:] A cross-reference from one "article"
+% entry to another may be used for special issues of a journal,
+% such as those dedicated to a single topic. The referenced
+% entry should include all details relevant to the issue as a
+% whole, including "volume", "journal" and "booktitle" (this last
+% for the name or topic description of a special issue), and
+% "type" (this defaults to ``"Special issue"'').
+% \item [{\tt book}:] This cross-reference is not recognized by
+% the "law.dtx" style. It could logically be used for a series,
+% but this is little trouble to type into the original "@book"
+% entry itself, and a series is not something that should
+% appear separately on the reference list.
+%\item[{\tt inbook}:] This is used for cross-referencing a
+% chapter or other subdivision within a work by a single author
+% to that work.
+%\item[{\tt incollection}:] This is used for cross-referencing a
+% work by multiple authors. The typeface conventions used in the
+% Blue Book style differ for "inbook" and "incollection"
+% citations, as defined here, so this distinction should be
+% honored in building a database.
+%\item[{\tt inproceedings}:] This is used only cross-referencing
+% articles appearing to a proceedings volume to that volume.
+% \end{description}
+%
+%
+%\StopEventually{\setcounter{IndexColumns}{2}\PrintIndex}
+%
+% \section{The Citation Engine: {\tt camel.sty}}
+%
+% \subsection{Initialization}
+% \subsubsection{Hello!}
+% To start things off on the right foot, we tell the world
+% who we are.
+% \begin{macrocode}
+%<*lexitex>
+\NeedsTeXFormat{LaTeX2e}[1994/12/01] \ProvidesPackage{camel}
+[1997/02/17 v1.0t General bibliography engine (Frank Bennett)]
+\@ifclassloaded{ltxdoc}{}{\RequirePackage{index}[1995/09/28]}
+\RequirePackage{keyval}[1995/09/21]
+\RequirePackage{overword}
+% \end{macrocode}
+% \subsubsection{Customizable text elements}
+% \begin{macro}{\supra}
+% The following definition specifies the string used to refer to
+% a cite that occurs in a previous footnote, or in a preceding
+% citation to the same source within the same footnote. It is
+% not used in cross-referencing cases and statutes. The extra
+% internal braces only serve to limit the scope of
+% {\tt\string\em}. An italic space ("\/") is not added, since
+% this might be followed by a period.
+% \begin{macrocode}
+\def\supra{, {\em supra}}%
+% \end{macrocode}
+% \end{macro}
+% The {\tt\string\Id} macro defined here is used in referring to
+% immediately preceding works, in the same or in a preceding
+% footnote. If the context demands that {\em Id.} be lower case
+% when it occurs, the user can switch it to lower case by entering
+% {\tt\string\lowcase} immediately before an in-text citation
+% declaration or citation nickname. The lower case macro thus
+% invoked turns itself off after {\em id.} has printed, so no
+% grouping is required.
+% \begin{macrocode}
+\def\Id{{\em\@law@lettercase Id.}}%
+% \end{macrocode}
+% These two tokens hold the text used to indicate the note or
+% page number where a previous reference occurs. These are only
+% used in short-form citations.
+% \begin{macrocode}
+\newtoks\@ltok@userconetop%
+\newtoks\@ltok@userconetopplural%
+\newtoks\@ltok@userptop%
+\newtoks\@ltok@userptoctwo%
+\newtoks\@ltok@useratbridge%
+\newtoks\@ltok@useratbridgeplural%
+\newtoks\@ltok@usercitefirst
+\newtoks\@ltok@usercitepage
+\newtoks\@ltok@usercitelast
+\newtoks\@ltok@infoot \@ltok@infoot={\ note\ }
+\newtoks\@ltok@onpage \@ltok@onpage={\ page\ }
+% \end{macrocode}
+% The following tokens are used in making proof sheets.
+% Change the content of these to taste.
+% \begin{macrocode}
+\newtoks\@ltok@proofcitelast
+ \@ltok@proofcitelast{{Editor, publisher and stuff, 1994}}
+\newtoks\@ltok@proofpage
+ \@ltok@proofpage{{12345}}
+\newtoks\@ltok@proofciteone
+ \@ltok@proofciteone{{Source}}
+\newtoks\@ltok@prooftitle
+ \@ltok@prooftitle{{Title of work}}
+\newtoks\@ltok@proofauthor
+ \@ltok@proofauthor{{Author's name}}
+% \end{macrocode}
+% \subsubsection{User selectable switches}
+% The Blue Book\source{bluebook}{} allows us to refer
+% to statutes in a long form or a short form in subsequent
+% references. The long form consists of the name of the Act (if
+% any) plus its source details and the section number. The short
+% form consists of the source details alone.\footnote{{\em See}
+% \source{bluebook}[25].}
+% I'm all in favour
+% of saving ink; the default is for short form statute citations.
+% You can have long form subsequent cites by setting
+% "\statuteverboseon" at the top of your document. If you need
+% some other form, let me know; statutes are complex, and rather
+% than trying to do everything from the get-go, this really has
+% to be demand led.
+% \begin{macrocode}
+\global\let\@law@delim\relax
+\global\let\@law@pingroup\relax
+\global\let\@law@pinstart\relax
+\global\let\@law@pinend\relax
+\newif\if@law@statuteverbose
+\def\statuteverboseon{\@law@statuteverbosetrue}
+\def\statuteverboseoff{\@law@statuteverbosefalse}
+\statuteverboseoff
+% \end{macrocode}
+% \begin{macro}{\forcefootnotes}
+% This fun little item is used to toggle the "\source"
+% macros to create a footnote if none was typed literally
+% into the text. Great finger-saver for shortie footnotes.
+% Conceived on a whim, implementing this turned out to be
+% non-trivial. I hope you find it useful!
+% \begin{macrocode}
+\newif\if@law@forcefootnotes
+\def\forcefootnotes{\global\@law@forcefootnotestrue}
+\def\noforcefootnotes{\global\@law@forcefootnotesfalse}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{Shorthanding essentials}
+% The following definitions are established as a means
+% of cutting text using the "_", "^" and "|" characters.
+% Although we make them active here, they are {\em not\/}
+% read as active characters. {\sc Camel} should in no way
+% interfere with styles that require these characters
+% to be set active. The active characters created here
+% are used only for ``internal purposes''.
+% \begin{macrocode}
+{
+ \catcode`\_=13
+ \catcode`\^=13
+ \catcode`\|=13
+ \gdef\@law@barkill{\def\@law@comma{, }%
+ \def\@law@ampersand{\ \& }%
+ \def\@law@dash{--}%
+ \def\@law@delim{}\def_##1_{}\def|##1\relax{}\def^{}}%
+ \gdef\@law@barnil{\def_{}\def^##1^{}\def|{}}
+ \gdef\@law@barinfull{\def^{}}
+ \gdef\@law@barinshort{\def^##1^{}}
+}
+% \end{macrocode}
+% \begin{macrocode}
+\def\bridges#1#2#3#4#5#6{%
+ \@ltok@userconetop{#1}%
+ \@ltok@userconetopplural{#2}%
+ \@ltok@userptop{#3}%
+ \@ltok@userptoctwo{#4}%
+ \@ltok@useratbridge{#5}%
+ \@ltok@useratbridgeplural{#6}%
+}
+% \end{macrocode}
+% \subsubsection{Miscellaneous other macros}
+% Sometimes it might be nice to avoid using {\tt--} for some
+% reason, so a macro is defined here. Same thing for exclamation
+% points. One possible use for the latter is to avoid errors
+% when an exported table is sorted by {\tt makeindex}.
+% \begin{macrocode}
+\def\dash{--}
+\def\exclaim{!}%
+% \end{macrocode}
+% The {\tt\string\Id} macro contains its own period. Therefore a
+% period supplied by the user becomes redundant. This macro is
+% redefined to gobble this extra period when necessary.
+% \begin{macrocode}
+\def\@law@gobble{}
+\def\@law@argtwolist{}
+% \end{macrocode}
+% If you are into software history, you might
+% have cause to refer to \LexiTeX, so
+% its logo and the \LexiBib logo (also R.I.P.) are
+% defined here. They are
+% {\tt\string\protect}ed just like the \LaTeX\ logo.
+% \begin{macrocode}
+\def\p@LexiTeX{{\reset@font\rm\ \unskip\hbox{L%
+ \kern-.06em\hbox{\sc e}%
+ \kern-.05em\hbox{\sc x}%
+ \kern-.05em\lower.65ex\hbox{I}%
+ \kern-.18emT%
+ \kern-.1667em\lower.65ex\hbox{E}%
+ \kern-.125emX}}}%
+\def\LexiTeX{\protect\p@LexiTeX}%
+\def\p@LexiBib{{\reset@font\rm\ \unskip\hbox{L%
+ \kern-.06em\hbox{\sc e}%
+ \kern-.05em\hbox{\sc x}%
+ \kern-.05em\hbox{\sc i}%
+ \kern-.06em{\sc B}%
+ \kern-.05em\hbox{\sc i}%
+ \kern-.05em{\sc b}}}}%
+\def\LexiBib{\protect\p@LexiBib}%
+% \end{macrocode}
+% \subsubsection{New environment}
+% There is just one new environment in {\sc Camel}, and all it does
+% is set the list-input toggle to true, so that input citations
+% will feed into memory but not print.
+% \begin{macrocode}
+\newenvironment{lexilist}%
+{\message{Loading citation data}\@law@listinputtingtrue}%
+ {\@law@listinputtingfalse}
+% \end{macrocode}
+% \subsubsection{Token registers}
+% The following are used as temporary token registers in various
+% places.
+% \begin{macrocode}
+\newtoks\@ltok@a
+\newtoks\@ltok@b
+\newtoks\@ltok@argtwo
+\newtoks\@ltok@pagesstring
+% \end{macrocode}
+% The following token registers are used for temporary storage of
+% typeface information.
+% \begin{macrocode}
+\newtoks\@ltok@authormainface
+\newtoks\@ltok@authoroptionface
+\newtoks\@ltok@titlemainface
+\newtoks\@ltok@titleoptionface
+\newtoks\@ltok@citefirstmainface
+\newtoks\@ltok@citefirstoptionface
+\newtoks\ltokspecialface
+% \end{macrocode}
+% One token register is needed to store the name of the current cite type
+% (as declared using {\tt\string\newcitestyle} in the {\tt
+% .cit} file). With this string in hand, all of the
+% typeface and punctuation bridge information can be recovered
+% for that type of citation.
+% \begin{macrocode}
+\newtoks\@ltok@citetype%
+% \end{macrocode}
+% Tokens to store info on whether a cite is in a footnote or in
+% the main text, and the name of the cite style, in case we
+% need it.
+% \begin{macrocode}
+\newtoks\@ltok@whereitsat
+\newtoks\@ltok@stylename
+% \end{macrocode}
+% Ho-hum. Now we're going to need a bunch of token registers to
+% stash the information for a cite. Token registers have to be
+% used in processing, in order to provide expansion control.
+% \begin{macrocode}
+\newtoks\@ltok@nickname
+\newtoks\@ltok@author
+\newtoks\@ltok@name
+\newtoks\@ltok@citefirst
+\newtoks\@ltok@citepage
+\newtoks\@ltok@citelast
+\newtoks\@ltok@pageorfootno
+\newtoks\@ltok@hereinafter
+\newtoks\@ltok@bigsourcecite
+\newtoks\@ltok@bigsourcepage
+% \end{macrocode}
+% We also need token registers for citation bridge information.
+% \begin{macrocode}
+\newtoks\@ltok@atot
+\newtoks\@ltok@ttocone
+\newtoks\@ltok@conetop
+\newtoks\@ltok@conetopplural
+\newtoks\@ltok@ptop
+\newtoks\@ltok@ptoctwo
+\newtoks\@ltok@atbridge
+\newtoks\@ltok@atbridgeplural
+% \end{macrocode}
+%
+% \begin{macrocode}
+\newtoks\@ltok@plistmacro
+% \end{macrocode}
+% A counter is required to keep track of the number of cites in a
+% footnote, and to store the number that occurred in the previous
+% footnote.
+% \begin{macrocode}
+\newcounter{citesinfoot}
+\newcounter{citeslastfoot}
+\newcounter{law@paranormal}
+\newcounter{law@parapin}
+\newcounter{law@paracounter}
+% \end{macrocode}
+% \subsubsection{Peek-word-ahead macro}
+% This macro will not work if it is placed after the
+% string of "\newif"s below. I haven't a clue as to
+% why. I'm leery of whether this will cause problems
+% with other styles. If you have problems, contact
+% me on "fb@soas.ac.uk".
+% \subsubsection{If initializations}
+% We need a toggle so we can turn the print routine on and off;
+% this is necessary for list inputting, and for making phantom
+% references to sources in order to handle weird citation forms.
+% \begin{macrocode}
+\newif\if@law@biblabels
+\newif\if@law@usepages
+\newif\if@law@table
+\newif\if@law@usepinpoints
+\newif\if@law@maketable
+\newif\if@law@printcite
+% \end{macrocode}
+% The next one is used by the list-input environment.
+% \begin{macrocode}
+\newif\if@law@listinputting
+\newif\if@law@bibentry
+% \end{macrocode}
+% We also need to know whether a citation is being used for
+% the first time. In some styles, the first citation is treated
+% specially.
+% \begin{macrocode}
+\newif\if@law@firstuseofcite
+% \end{macrocode}
+% The next if will be used to toggle the print routine between
+% long and short citation forms.
+% \begin{macrocode}
+\newif\if@law@longcite
+% \end{macrocode}
+% This will tell us whether we are in a footnote or not.
+% \begin{macrocode}
+\newif\if@law@infoot
+% \end{macrocode}
+% The next "\if" will let us know if the same work was cited
+% immediately before the current cite, and if so, whether
+% we should pay any attention to a page reference, if given.
+% These are adjusted by
+% {\tt\string\law@justabovecheck}.
+% \begin{macrocode}
+\newif\if@justabove
+\newif\if@l@quiteexact
+% \end{macrocode}
+% The next condition will control the way print output is done
+% in short citation forms; it should set to false for articles
+% and books, and to true for cases and statutes.
+% \begin{macrocode}
+\newif\if@nosupra
+% \end{macrocode}
+% The next is used to signal the presence of {\tt ++}
+% as the argument linking a reference to a page/section number argument.
+% This toggles plural bridges on, and
+% tells the file output routine that, for statutes, each section number
+% should be attached to a complete copy of the citation
+% information. These copies are later reassembled in a set of
+% table entries by {\tt makeindex}.
+% \begin{macrocode}
+\newif\if@law@printauthor%
+\newif\if@law@printtitle%
+\newif\if@law@requiresubjects%
+\newif\if@law@subjectfound%
+% \end{macrocode}
+% \subsubsection{Macro initializations}
+% The following is a grab-bag of small macros with
+% simple functions. There is more to say about what
+% other macros use them for than about they themselves,
+% so I've put them in the front matter of the code.
+%
+% First is a little something to force a lowercase {\em id.} if
+% necessary. The operation of {\tt\string\normcase} is
+% obvious enough; it defines the case-switching macro
+% to a no-op. \verb+\lowcase+ works by setting
+% the case toggle to force a lowercase letter. The
+% use of \verb+\aftergroup+ allows everything to be turned back
+% on without losing the lowercase letter. This was
+% designed by trial and error; there may be a better way.
+% \begin{macrocode}
+\def\normcase{\def\@law@lettercase{}}
+\def\lowcase{\def\@law@lettercase##1{%
+ {\aftergroup\normcase\lowercase{##1}}}}
+\normcase
+% \end{macrocode}
+% The following three definitions are used in preparing to
+% print a citation using "\@law@print" and in printing
+% pinpoint references, respectively. The first extracts
+% a demand for plural bridges, if present. The second
+% is a no-op. The third is the plural bridges flag itself.
+% \begin{macrocode}
+\def\@law@multicheck#1\@law@multiflag#2\query#3\end{#2}%
+\def\@law@multiflag#1\query{}%
+\def\@law@multiset{\global\@ltok@conetop\@ltok@conetopplural%
+ \global\@ltok@atbridge\@ltok@atbridgeplural}
+% \end{macrocode}
+% The "\newinterword" macro simple adds its arguments to the
+% "\@law@wordlist" macro created by the {\sc Camel} style module
+% (i.e.~the "*.cit" file).
+% \begin{macrocode}
+\def\newinterword{\begingroup\catcode`\_=13\catcode`\^=13%
+ \@law@newinterword}
+\def\newinterword#1#2{\global\@ltok@a=\expandafter{\@law@wordlist}%
+ \global\@ltok@b={#1}\global\@ltok@c={#2}%
+ \xdef\@law@temp{\noexpand\\\noexpand{\the\@ltok@b\noexpand}%
+ \noexpand{\the\@ltok@c\noexpand}\the\@ltok@a}%
+ \global\let\@law@wordlist\@law@temp\endgroup}
+% \end{macrocode}
+% The {\sc Camel}{} nickname macros are now kept out of the name
+% space by executing them via \verb+\csname\endcsname+,
+% and adding a prefix that makes the macro inaccessible
+% by direct reference within the document. This change
+% was recommended by a user---sorry out there, I can't
+% remember who! Note that any nickname can now contain
+% numbers and other stuff, which is handy for cases, which
+% should be organized according to deciding court and date.
+% If in-text references are being "forced" into footnotes,
+% the footnote toggles are set to true here; the footnote
+% itself is created later, after any optional arguments have
+% been gobbled. Note that footnote forcing will
+% only take effect for "\source" citations, not for
+% in-text declarations. We need a new counter for footnotes,
+% so that we can keep track of footnote numbers while processing
+% forced footnotes outside of the footnote environment.
+% \begin{macrocode}
+\newcount\c@law@footnote%
+\def\volno{\message{(No volume for \the\@ltok@nickname)}}%
+% \end{macrocode}
+%
+% \begin{macro}{\@law@getsubjectheader}
+% This macro is used to grab the header appropriate to a given
+% declared subject. The subjects, headers and other related
+% information are kept in a single list macro for quick access.
+% \begin{macrocode}
+\def\@law@headersearchend{\camelrefname}
+\def\@law@abandonheadersearch#1\@law@headersearchend{}
+\def\@law@headersearch#1#2#3#4{%
+ \def\@law@temptwo{#1}%
+ \ifx\@law@temp\@law@temptwo%
+ \let\@law@headersearchend\relax%
+ \let\\=\@law@abandonheadersearch%
+ {}#3%
+ \fi}
+\def\@law@getsubjectheader#1{%
+ {\def\@law@temp{#1}%
+ \let\\=\@law@headersearch\@law@subjectlist\@law@headersearchend}}
+\let\@law@bibformatsearchend\relax
+\def\@law@abandonbibformatsearch#1\@law@bibformatsearchend{}
+\def\@law@bibformatsearch#1#2#3#4{%
+ \def\@law@temptwo{#1}%
+ \ifx\@law@temp\@law@temptwo%
+ \let\\=\@law@abandonbibformatsearch%
+ {}#4%
+ \fi}
+\def\@law@getbibformat#1{%
+ {\def\@law@temp{#1}%
+ \let\\=\@law@bibformatsearch\@law@subjectlist\@law@bibformatsearchend}}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@law@confirmsubject}
+% This parser checks whether a given subject exists in
+% the list of declared subjects. It takes no action,
+% only issues a warning.
+% \begin{macrocode}
+\def\@law@subjectsearchend{%
+ \ifx\@law@citesubject\empty%
+ \@camel@error{No subject declared.^^J
+ After declaring a subject or subjects using
+ \string\citationsubject,^^J
+ you have neglected to give a subject (using the s= option)^^J
+ for one of your \string\source\space commands}\@ehc%
+ \else%
+ \@camel@error{Undeclared subject `\@law@citesubject'.^^J
+ An undeclared subject has been given as an argument to
+ a \string\source\space command.^^J You must first %
+ declare subjects using \string\citationsubject}\@ehc%
+ \fi}
+\def\@law@abandonsubjectsearch#1\@law@subjectsearchend{}
+\def\@law@subjectsearch#1#2#3#4{%
+ \def\@law@temptwo{#1}%
+ \ifx\@law@citesubject\@law@temptwo%
+ \let\@law@subjectsearchend\relax%
+ \let\\=\@law@abandonsubjectsearch%
+ \fi}
+\def\@law@confirmsubject{%
+ {\let\\=\@law@subjectsearch\@law@subjectlist\@law@subjectsearchend}}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@law@maybeaddcitesubject}
+% This macro adds the nickname of the current citation to
+% the list of nicknames under the current citation subject.
+% It will only do this if the nickname does not already
+% exist in the list. The effect is to keep the lists
+% in citation order. Note that a citation may be
+% listed under more than one citation subject. This may
+% be useful, so it is not prevented.
+% \begin{macrocode}
+\def\@law@citesubjectcheckend{%
+ \expandafter\let\expandafter\@law@temptwo%
+ \csname @law@\@law@citesubject @citelist\endcsname%
+ \@ltok@a=\expandafter{\@law@temptwo}%
+ \expandafter\xdef%
+ \csname @law@\@law@citesubject @citelist\endcsname{%
+ \the\@ltok@a\noexpand\\%
+ \noexpand{\the\@ltok@nickname\noexpand}}}
+\def\@law@abandoncitesubjectcheck#1\@law@citesubjectcheckend{}
+\def\@law@citesubjectcheck#1{%
+ \def\@law@temptwo{#1}%
+ \ifx\@law@nickname\@law@temptwo%
+ \let\@law@citesubjectcheckend\relax%
+ \let\\=\@law@abandoncitesubjectcheck%
+ \fi}
+\def\@law@maybeaddcitesubject{%
+ {\let\\=\@law@citesubjectcheck%
+ \csname @law@\@law@citesubject @citelist\endcsname%
+ \@law@citesubjectcheckend}}
+% \end{macrocode}
+% \end{macro}
+% There are to be three sets of specialized parsing macros in LexiTeX, all
+% three of which are used on the options to the "\source"
+% command. One parser reads a
+% list of options. The second reads a comma, {\tt\&}, and {\tt-}
+% delimited list and writes the contents as a macro argument. The
+% third reads the same comma, {\tt\&} and {\tt-} delimited list and
+% prints it directly on the output after a slight amount of
+% formatting work.
+% \begin{macro}{\@law@plone}
+% Does a comparison, executes the
+% associated option if there is a match.
+% \begin{macrocode}
+%<+oldparse>\def\@law@plone#1#2{\def\@law@listitem{#1}%
+%<+oldparse> \ifx\@law@optionitem\@law@listitem #2%
+%<+oldparse> \let\\=\@law@finish\fi}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@law@end}
+% The internal ending character is also common to all parsers.
+% \begin{macrocode}
+\def\@law@end{,}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@law@finish}
+% If there is a match, we want to ignore the rest of the list.
+% This is macro is defined and ``kept on the shelf'' until such
+% time as we need to cut off the rest of the executable list
+% macro below.
+% \begin{macrocode}
+%<+oldparse>\def\@law@finish#1\@law@nomatch{}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@law@sourceoptionlist}
+% At the cost (in the short term) of abandoning helpful error
+% messages, from version 1.0r, we use the "keyval" package
+% by David Carlisle for all parsing except page numbers.
+% \begin{macrocode}
+\define@key{cameloptions}{a}[F]{\global\@law@printauthorfalse}%
+\define@key{cameloptions}{t}[F]{\global\@law@printtitlefalse}%
+\define@key{cameloptions}{n}[F]{\global\@law@printcitefalse}%
+\define@key{cameloptions}{l}[F]{\message{\lowcase}}%
+\define@key{cameloptions}{f}[T]{\global\@law@longcitetrue}%
+\define@key{cameloptions}{b}[T]{\global\@law@bibentrytrue\global\@law@longcitetrue}%
+\define@key{cameloptions}{Z}{}%
+\define@key{cameloptions}{s}{\if@law@requiresubjects%
+ \gdef\@law@citesubject{#1}%
+ \fi}%
+\define@key{cameloptions}{v}{\gdef\volno{#1}}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@@parse}
+% \begin{macro}{\@law@parse}
+% Now comes the fun bit. Control is passed back and forth
+% between "\@law@parse" and "\@@parse", with the behaviour of those
+% functions altering depending on what is chewed up into them.
+% Amazingly enough, it works. Whatta concept.
+% \begin{macrocode}
+\def\@@parse{\@law@parse}
+\let\@law@parse\@law@parseplain
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\@law@alone}
+% A copy of "\@law@plone". Serves same function.
+% \begin{macrocode}
+\def\@law@alone#1#2{\def\@law@allistitem{#1}%
+ \ifx\@law@alitem\@law@allistitem #2%
+ \let\\=\@law@alfinish\fi}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@law@alnomatch}
+% We don't care what goes into this field, so there is no error
+% message from the parser.
+% \begin{macrocode}
+\def\@law@alfinish#1\@law@alnomatch{\@law@alnomatch}
+\def\@law@alnomatch{%
+ \global\@ltok@a=\expandafter{\@law@alitem}%
+ \xdef\@law@temp{\the\@ltok@argtwo\the\@ltok@a}%
+ \global\@ltok@argtwo=\expandafter{\@law@temp}}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@law@allist}
+% The list of options is simple and expansible. The syntax of
+% the last two
+% lines is required if everything is to work as expected.
+% The items in the help message should probably be
+% drawn from here, to provide a hook for expansion
+% if other styles want to tinker with the options to
+% "\source".
+% \begin{macrocode}
+\gdef\@law@allist{%
+ \\{&}{\gdef\@law@alitem{\@law@delim%
+ \@law@multiflag\@law@multiset\query%
+ \@law@ampersand}}%
+ \\{=}{\gdef\@law@alitem{\@law@delim%
+ \@law@pinend%
+ \@law@pingroup%
+ \@law@pinstart}%
+ \addtocounter{law@parapin}{1}}%
+ \\{-}{\gdef\@law@alitem{\@law@delim
+ \@law@multiflag\@law@multiset\query%
+ \@law@dash}}%
+ \\{,}{\gdef\@law@alitem{}%
+ \let\@law@parse\@law@alparsesavecomma}%
+ \\{_}{\@law@get@ul}%
+ \\{^}{\@law@get@carat}%
+ \\{|}{\@law@get@bar}%
+ \@law@alnomatch}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@law@get@ul}
+% \begin{macro}{\@law@getcarat}
+% \begin{macro}{\@law@getbar}
+% The purpose of the following is to place {\em active\/}
+% versions of the special marking characters on the stack.
+% Note that the characters need not be active when read;
+% they are replaced with active versions of the characters
+% by this routine. Active characters are sent to the stack
+% rather than control strings because they do not swallow
+% following space (possibly not important), and because
+% this made the whole thing easier to follow in the
+% debugging process.
+% \begin{macrocode}
+{\catcode`\_=13\catcode`\^=13\catcode`\|=13%
+ \gdef\@law@get@ul{\gdef\@law@alitem{_}}%
+ \gdef\@law@get@carat{\gdef\@law@alitem{^}}%
+ \gdef\@law@get@bar{\gdef\@law@alitem{\@law@delim|}}%
+}
+\gdef\@law@finishargtwo{%
+ \global\@ltok@a={\@law@pingroup\@law@pinstart}%
+ \xdef\@law@temp{\the\@ltok@a\the\@ltok@argtwo}%
+ \global\@ltok@argtwo=\expandafter{\@law@temp}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\@law@alparsesavecomma}
+% \begin{macro}{\@law@alparseplain}
+% These parsers are switched in as appropriate. The first
+% checks to see if the end of the string for parsing has
+% been reached. The second cycles a comparison.
+% \begin{macrocode}
+\gdef\@law@alparsesavecomma{\@ifnextchar,%
+ {\gdef\@law@alitem{\@law@delim\@law@pinend}\@law@alnomatch%
+ \expandafter\@law@finishargtwo%
+ \@gobble}%
+ {\gdef\@law@alitem{\@law@delim%
+ \@law@multiflag\@law@multiset\query%
+ \@law@comma}%
+ \@law@alnomatch%
+ \let\@law@parse=\@law@alparseplain\@@parse}}
+\def\@law@alparseplain#1{%
+ \let\@law@nomatch=\@law@alnomatch%
+ \gdef\@law@alitem{#1}\let\\=\@law@alone\@law@allist\@@parse}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \begin{macro}{\@law@scanlist}
+% This macro is defined and kept on the shelf as a
+% definition of "\\" that checks through the list
+% of paired aliases and associated text. If it finds
+% a match, it gives the text one level of expansion,
+% to fix the current definition of "_" and "^".
+% This allows one entry to serve both between citations,
+% and at the start of a citation string. In addition
+% to these macros, a "\@law@wordlist" macro must be
+% defined in the ".cst" file used with {\sc Camel}.
+% \begin{macrocode}
+\def\@law@scanlist#1#2{\long\def\@law@temp{#1}%
+ \@ltok@a={#2}%
+ \ifx\@law@temp\@overword\xdef\@SBSword{{\noexpand\em \the\@ltok@a}}%
+ \let\\=\@law@finish\fi}
+% \end{macrocode}
+% \end{macro}
+% \begin{macrocode}
+\def\@law@wlnomatch{\message{^^J^^J%
+ There is an unregistered inter-citation word (\@overword) on
+ line no \the\inputlineno. See the LexiTeX documentation
+ for more information. Please email fb@soas.ac.uk if
+ you want a word added to the inter-citation list.}}
+% \end{macrocode}
+% \begin{macro}{\@law@checkins}
+% This macro works with the "\@ifoverword" macro; it checks
+% the contents of the "\@overword" macro defined during
+% the leap, to see if it corresponds to anything in a list
+% of aliases. The alias list could be defined as a set
+% of prefixed macros (to speed things up), or as a
+% single list macro (to conserve string space). I have
+% adopted the latter strategy. If anyone feels strongly
+% that speed is more important, or that somehow the
+% integrity of \TeX{} demands that macros be used,
+% it's not much of a job to change things; be my
+% guest.
+% \begin{macrocode}
+{\catcode`\_=\active%
+ \catcode`\^=\active%
+\gdef\@law@checkins{%
+ \def^##1{\lowercase{##1}}\def_##1{{\em{##1}}}%
+ \let\@law@tempthree=\\%
+ \let\@law@nomatch=\@law@wlnomatch%
+ \let\\=\@law@scanlist\@law@wordlist%
+ \let\\=\@law@tempthree}
+\gdef\@law@checkpre{%
+ \let\@law@tempthree=\\%
+ \let^\relax\let_\@gobble%
+ \let\@law@nomatch=\@law@wlnomatch%
+ \let\\=\@law@scanlist\@law@wordlist%
+ \let\\=\@law@tempthree}
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\source}
+% The front end of the "\source" command is very much
+% {\em \`a la} typical LaTeX optional command definition stuff.
+% We just carry things a little further because there are
+% two possible options to the "\source" command.
+% \begin{macrocode}
+\gdef\source{%
+ \if@law@requiresubjects%
+ \gdef\@law@citesubject{}%
+ \fi%
+ \@law@printcitetrue%
+ \@law@printauthortrue%
+ \@law@printtitletrue%
+ \setcounter{law@parapin}{0}%
+ \setcounter{law@paracounter}{0}%
+ \@ifnextchar[{\@lexicite}{\@lexicite[]}}
+\def\@lexicite[#1]#2{\@ifnextcharcareful[{%
+ \addtocounter{law@parapin}{1}\@@lexicite{#1}{#2}}%
+ {\@@lexicitenobrace{#1}{#2}}}
+% \end{macrocode}
+% Once we've gathered up any optional arguments, it's time
+% to use the "\@ifoverword" command. If we find a "\source"
+% command after the next word, we stash the current cite,
+% we check the word separating the two "\source" commands
+% against an internal list, return the result to
+% "\@SBSword", and push the raw citation details and
+% the "@SBSword" bridge onto a temporary stack.
+% Otherwise, we clear the "\@SBSword", push the
+% current cite details, dump the stack, and
+% put the word we found, together with any separating
+% space, back on the output stream.
+% \begin{macrocode}
+\def\@ifnextcharcareful#1#2#3{%
+ \gdef\@prenextcharspace{}%
+ \let\reserved@e=#1\def\reserved@a{#2}\def\reserved@b{#3}\futurelet
+ \reserved@c\@ifnchcareful}
+\def\@ifnchcareful{\ifx \reserved@c \@sptoken \let\reserved@d\@xifnchcareful
+ \else \ifx \reserved@c \reserved@e\let\reserved@d\reserved@a\else
+ \let\reserved@d\reserved@b\fi
+ \fi \reserved@d}
+\def\:{\@xifnchcareful}
+\expandafter\def\: {%
+ \gdef\@prenextcharspace{ }\futurelet\reserved@c\@ifnch}
+\def\@@lexicite#1#2[#3]{%
+ \@ifoverword\source%
+ {\@law@checkins\@@@lexicite{#1}{#2}{#3}}%
+ {\gdef\@SBSword{}\@@@lexicite{#1}{#2}{#3}%
+ \@law@citedump{}%
+ \@preoverwordspace%
+ \expandafter\@law@gobble%
+ \@overword{} }%
+ {\gdef\@SBSword{}\@@@lexicite{#1}{#2}{#3}%
+ \@law@citedump{}%
+ \@preoverwordspace%
+ \expandafter\@law@gobble%
+ \@overword{} }}
+\def\@@lexicitenobrace#1#2{%
+ \@ifoverword\source{\@law@checkins\@@@lexicite%
+ {#1}{#2}{}}%
+ {\gdef\@SBSword{}\@@@lexicite%
+ {#1}{#2}{}%
+ \@law@citedump{}%
+ \@prenextcharspace%
+ \expandafter\@law@gobble%
+ \@overword{} }
+ {\gdef\@SBSword{}\@@@lexicite%
+ {#1}{#2}{}%
+ \@law@citedump{}%
+ \@prenextcharspace%
+ \expandafter\@law@gobble%
+ \@overword{} }}
+% \end{macrocode}
+% To push citation details, we use a token assignment with
+% "\expandafter", then an "\edef" of the register contents
+% to get one level of expansion into a macro.
+% \begin{macrocode}
+\def\@law@citestack{}%
+\gdef\@SBSword{}%
+\def\@@@lexicite#1#2#3{%
+ \@ltok@a=\expandafter{\@law@citestack}%
+ \@ltok@b={\@realcite{#1}{#2}{#3}}%
+ \@ltok@c=\expandafter{\@SBSword}%
+ \edef\@law@citestack{\the\@ltok@a\the\@ltok@b\the\@ltok@c}}
+% \end{macrocode}
+% \begin{macro}{\footnote}
+% We need a flag to tell us whether we are in a footnote.
+% This allows us to prevent footnote forcing if we're
+% {\em already} in a footnote. \LaTeX{} itself should
+% probably take care of this, but for now we need to
+% give it
+% a helping hand by reinvoking the critical command with
+% Apologies to the \LaTeX3 team and everything, but I
+% really truly do need these hooks.
+%
+% Some thoughts on the tracking of previous citations. This
+% is hardly transparent, and even I the author have trouble
+% following it. Something for tidying up someday.
+% Currentcite is set only at the top of a footnote. The idea
+% apparently is that we need to remember the last cite in the
+% last footnote always. Problems to watch here are (a) what
+% happens for the very first footnote, and (b) what happens in
+% the main text. There should probably be complete isolation of
+% these context records for main text references and footnote
+% references.
+% \begin{macrocode}
+\long\def\@footnotetext#1{\insert\footins{%
+ \@law@infoottrue% % Hooks for citation manager
+ \ifnum\the\c@citesinfoot=1\relax% %
+ \global\let\@law@lastcite\@law@currentcite% %
+ \else% %
+ \gdef\@law@lastcite{\@dummy}% %
+ \fi% %
+ \global\setcounter{citesinfoot}{0}% End of hooks
+ \reset@font\footnotesize
+ \interlinepenalty\interfootnotelinepenalty
+ \splittopskip\footnotesep
+ \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
+ \hsize\columnwidth \@parboxrestore
+ \let\@tempa\protect
+ \def\protect{\noexpand\protect\noexpand}%
+ \edef\@currentlabel{\csname p@footnote\endcsname\@thefnmark}%
+ \let\protect\@tempa
+ \color@begingroup
+ \normalcolor
+ \@makefntext{%
+ \rule\z@\footnotesep\ignorespaces#1%
+ \@finalstrut\strutbox}
+ \color@endgroup}}
+% \end{macrocode}
+% \end{macro}
+% We require a simple parser to allow multiple citation
+% keys in the scope of a single "\source" command. We
+% ignore any pinpoint given after the "\source" command;
+% if you're using pinpoints, write individual "\source"
+% commands into your text. This keeps things relatively
+% clean and simple, for future linking to intelligent
+% editors. The voiding of "\@ltok@argtwo" is going
+% to be redundant if there are more than two keys
+% in the scope, but what the heck, it's simple this way.
+% Intervening punctuation is assumed to be the ``default'',
+% which is signified by the ";" character.
+% Note that any leading options will carry through to
+% {\em all\/} of the citations in the key string!
+% If you want to suppress the author, say, for only one
+% citation, you'd better use a separate "\source" command
+% for that citation, and link it to the string with
+% an inter-word.
+% \begin{macrocode}
+\def\@law@clparseplain#1,{%
+ \@ifnextchar,%
+ {\def\@law@temp{\@law@onerealcite{#1}}%
+ \expandafter\@law@temp\@gobble}%
+ {\@law@onerealcite{#1}%
+ {\long\def\@overword{;}\@law@checkins%
+ \@SBSword\gdef\@SBSword{}}%
+ \@@parse}}
+% \end{macrocode}
+%
+% When citations are dumped, we need to decide what sort
+% of delimiters they receive. If footnote forcing is in
+% effect, we need to protect against the possibility
+% that we're already in a footnote. The "\@citedump"
+% command should be redefined for styles that bracket
+% citation strings in, say, square brackets.
+% The following code, the "\@law@printcite" command and the
+% contents of the "lexicite.tex" file are the
+% only chunks of the style that need modification
+% to generate different---perhaps radically different---styles.
+% The strategy used here to force footnotes could equally
+% well be used to place the citation string
+% in a "\marginpar",
+% in a floating box, on a facing page or what have you.
+% So many possibilities, so little time \ldots
+% \begin{macrocode}
+\def\@law@citedump{%
+ \if@law@infoot%
+ \begingroup\@law@citestack\endgroup%
+ \else%
+ \if@law@forcefootnotes%
+ \footnote{\begingroup\@law@citestack\@law@gobble.\endgroup}%
+ \else%
+ \begingroup\@law@citestack\endgroup%
+ \fi%
+ \fi%
+\def\@law@citestack{}}
+% \end{macrocode}
+% The actual cites
+% should be expanded only after it has been determined that
+% the end of a citation string has been reached.
+% The expansion sequence for individual citations begins
+% here.
+% \begin{macrocode}
+\def\@realcite#1#2#3{%
+ \ifcat$#1$\else%
+ \setkeys{cameloptions}{#1}
+ \fi%
+ \if@law@requiresubjects%
+ \@law@confirmsubject%
+ \fi%
+ \global\@ltok@argtwo{}%
+ \ifcat$#3$\else%
+ {\let\@law@parse=\@law@alparseplain\@law@parse #3,,}%
+ \fi%
+ {\let\@law@parse=\@law@clparseplain\@law@parse #2,,}%
+ }
+% \end{macrocode}
+% \end{macro}
+% The "\@law@onerealcite" macro
+% writes the citation key on the ".aux" file for
+% onward use by \BibTeX{}, and initiates citation
+% expansion.
+% \begin{macrocode}
+\def\@law@onerealcite#1{%
+ \@ifundefined{@lnick@#1}%
+ {\expandafter\def\csname @lnick@#1\endcsname{%
+ {\small\bf\tt <undefined: #1>}
+ \@latex@warning
+ {Citation `#1' on page \thepage \space undefined}}}%
+ {\relax}%
+ \if@filesw%
+ \immediate\write\@auxout{\string\citation{#1}}%
+ \@ifundefined{@law@managerouthook}%
+ \relax%
+ {\immediate\write\@bibout{\@law@managerouthook{#1}}}%
+ \fi%
+\global\@law@firstuseofcitefalse%
+\csname @lnick@#1\endcsname}
+% \end{macrocode}
+% \begin{macro}{\bibitem}
+% The bibitem subcommands are redefined, since we don't
+% need to export the nickname a second time when using {\sc Camel}.
+% \begin{macrocode}
+\def\@lbibitem[#1]{\item[\@biblabel{#1}\hfill]\ignorespaces}
+\def\@bibitem{\item\ignorespaces}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\bibliographymanager}
+% This macro provides support for external bibliography
+% managers. If a known manager is declared, the key
+% is written on an ephemeral file with the name "camel.bib".
+% If the manager is then set up to replace
+% keys with valid \BibTeX{} ".bib" entries, and is
+% run over this file, the resulting file can be used as an
+% input file for \BibTeX{}. Simple. Clean. \LaTeX.
+% \begin{macrocode}
+\def\@law@subjectlist{}
+\def\citationstyle#1{%
+ \ifx\@law@subjectlist\empty%
+ \def\@law@citesubject{all}
+ \expandafter\gdef\csname @law@all@citelist\endcsname{}%
+ \def\@law@subjectlist{\\{all}{}{\camelrefname}{}}%
+ \fi%
+ \if@filesw%
+ \immediate\write\@auxout{\string\bibstyle{#1}}%
+ \fi%
+ \def\@law@savecat{\catcode`@}%
+ \makeatletter%
+ \input{#1.cst}%
+ \input{#1.cit}%
+ \catcode`\@=\@law@savecat%
+ \@ifundefined{@law@bblfile}%
+ {\relax}%
+ {\begin{lexilist}
+ \@input{\@law@bblfile}
+ \end{lexilist}}}
+\def\citationdata#1{%
+ \def\bibliographymanager{\@camel@error{\string\bibliographymanager\space
+ following \string\citationdata.^^J
+ You can use only one of \string\citationdata\space and
+ \string\bibliographymanager\space^^J at the start of a document
+ or after a
+ \string\printthebibliography\space command}\@ehc}%
+ \if@filesw%
+ \immediate\write\@auxout{\string\bibdata{#1}}%
+ \fi%
+ \@ifundefined{@law@wordlist}%
+ {\gdef\@law@bblfile{\jobname.bbl}}%
+ {\begin{lexilist}
+ \@input {\jobname.bbl}
+ \end{lexilist}}}
+\def\@camel@error#1#2{%
+ \GenericError{%
+ \space\space\space\@spaces\@spaces\@spaces
+ }{%
+ Camel Error: #1%
+ }{%
+ See the Camel manual for explanation.%
+ }{#2}%
+}
+{\catcode`\%=12 \gdef\@law@percent{%}}
+\def\bibliographymanager#1{%
+ \def\citationdata{\@camel@error{\string\citationdata\space
+ following \string\bibliographymanager.^^J
+ You can use only one of \string\citationdata\space and
+ \string\bibliographymanager\space^^J at the start of a
+ document or after a
+ \string\printthebibliography\space command.}\@ehc}%
+ \if@filesw%
+ \immediate\write\@auxout{\string\bibdata{camel}}%
+ \fi%
+ \@ifundefined{@law@wordlist}%
+ {\gdef\@law@bibfile{\jobname.bbl}}%
+ {\begin{lexilist}%
+ \@input {\jobname.bbl}
+ \end{lexilist}}%
+ \newwrite\@bibout%
+ \immediate\openout\@bibout camel.bib%
+ \gdef\@law@temp{#1}%
+ \gdef\@law@temptwo{procite}%
+ \ifx\@law@temp\@law@temptwo%
+ \def\@law@managerouthook##1{(##1)}%
+ \fi%
+ \gdef\@law@temptwo{endnote}%
+ \ifx\@law@temp\@law@temptwo%
+ \def\@law@managerouthook##1{[##1]}%
+ \fi%
+ \gdef\@law@temptwo{papyrus}%
+ \ifx\@law@temp\@law@temptwo%
+ \def\@law@managerouthook##1{\@law@percent\@law@percent##1\@law@percent\@law@percent}%
+ \fi%
+ \gdef\@law@temptwo{referencemanager}%
+ \ifx\@law@temp\@law@temptwo%
+ \def\@law@managerouthook##1{\{##1\}}%
+ \fi%
+ \gdef\@law@temptwo{tib}%
+ \ifx\@law@temp\@law@temptwo%
+ \def\@law@managerouthook##1{[.##1.]}%
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\lexibib}
+% This is used by \LexiBib{} to declare citations in a {\tt lexilist}
+% environment. Use of a single macro permits
+% {\tt\string\theholding} and its friends to work more simply.
+% \begin{macrocode}
+\def\lexibib#1{\csname new#1\endcsname}%
+% \end{macrocode}
+% \end{macro}
+%
+% We need to initialize the list macro used as a workspace
+% by the list macro handlers.
+% \begin{macrocode}
+\def\@law@templistmacro{}
+\def\@law@tempplistmacro{}
+% \end{macrocode}
+% These macros are used for \verb+\if+-branching in various
+% formatting routines.
+% \begin{macrocode}
+\def\@law@case{case}
+\def\@law@statute{statute}
+\def\@law@article{article}
+\def\@law@book{book}
+% \end{macrocode}
+% \subsection{Main macros}
+% \subsubsection{Utility macros}
+% This section contains larger macros that perform major
+% tasks and smaller bits of code that are complex in their operation.
+% \begin{macro}{\@law@unstashparas}
+% When this is implemented, the above chain of "futurelet" macros
+% will be linked to this "\@law@unstashparas" routine, which fetches
+% any parallel items, and then (in "\@law@setup") performs the restash
+% of the citation if necessary.
+% \end{macro}
+% \begin{macro}{\@law@clean}
+% \begin{macro}{\@law@cleanup}
+% This is a rough set of routines; if anyone has a
+% suggestion on how to more elegantly clean
+% most of \LaTeX's control sequences for export,
+% I would be most grateful to hear from them.
+% The effect of these routines is to convert
+% control sequences
+% that might be sent to the output files into
+% harmless strings. This is necessary because
+% the file cannot be written at the time \verb+\@law@cleanup+
+% is called; the page references would be incorrect.
+% The definitions are local; bracketing the clean command and
+% its arguments will leave the cleaned text in the macro,
+% but restore command strings to operation when \LaTeX\
+% passes out of the current group.
+% The "\ifcat" condition at the start (this method of token
+% register checking was suggested by Bernd Raichle---who
+% scolded me for bothering the \LaTeX3 list with this question!)
+% is meant to catch empty
+% strings fed to the routine in the fastest possible way.
+% Without any checking, things can blow up.
+% The use of "\@law@barnil" (somewhere in the middle) makes the vertical-bar
+% character turn wimpish and disappear, which is what we want.
+% Otherwise it prints weird stuff when it is fed back in through
+% the external table.
+% \begin{macrocode}
+{\catcode`\_=13\catcode`\^=13\catcode`\|=13%
+\gdef\@law@clean#1#2{%
+ \def\protect##1{\string##1\space}%
+ \ifcat$\the#1$%
+ \edef#2{}%
+ \else%
+ \def^{\string^}%
+ \def_{\string_}%
+ \@law@barnil%
+ \def\volno{\string\volno}%
+ \def\exclaim{\string\exclaim}%
+ \def\hbox{\string\hbox}%
+ \def\&{\string\&}\def\%{\string\%}%
+ \def\hskip{\string\hskip}%
+ \def\jintercharskip{\string\jintercharskip}%
+ \def\char{\string\char}%
+ \def~{\string~}\def\/{\string\/}%
+ \def\\{\string\\}\def\ {\string\ }\def\sc{\string\sc\space}%
+ \def\rm{\string\rm\space}\def\bf{\string\bf\space}%
+ \def\em{\string\em\space}%
+ \def\={\string\=}%
+ \def\`{\string\`}\def\'{\string\'}%
+ \def\^{\string\^}\def\"{\string\"}\def\~{\string\~}%
+ \def\.{\string\.}\def\u{\string\u}\def\v{\string\v}%
+ \def\H{\string\H\space}\def\t{\string\t\space}%
+ \def\c{\string\c\space}%
+ \def\d{\string\d\space}\def\b{\string\b\space}%
+ \def\oe{\string\oe\space}%
+ \def\ae{\string\ae\space}\def\aa{\string\aa\space}%
+ \def\o{\string\o\space}%
+ \def\l{\string\l\space}\def\ss{\string\ss\space}%
+ \def\OE{\string\OE\space}\def\AE{\string\AE\space}%
+ \def\AA{\string\AA\space}%
+ \def\O{\string\O\space}\def\L{\string\L\space}%
+ \def\dag{\string\dag\space}\def\ddag{\string\ddag\space}%
+ \def\S{\string\S\space}%
+ \def\P{\string\P\space}%
+ \def\TeX{\string\TeX\space}\def\LaTeX{\string\LaTeX\space}%
+ \def\LexiTeX{\string\LexiTeX\space}%
+ \def\BibTeX{\string\BibTeX\space}\def\-{\string\-}%
+\xdef\@law@temp{\the#1}%
+\xdef#2{\expandafter\expandafter\expandafter\@gobble%
+\expandafter\string\csname\@law@temp\endcsname}%
+\fi}
+}
+% \end{macrocode}
+% This routine runs the cleaning routine on every
+% token register that we want to send to the external
+% files. The result is stored in a macro, since we
+% need the registers for the next citation, and because it
+% will be safe to fully expand the contents after cleaning.
+% \begin{macrocode}
+\def\@law@cleanup{%
+\@law@clean\@ltok@authormainface\@law@authormainfacetemp%
+\@law@clean\@ltok@authoroptionface\@law@authoroptionfacetemp%
+\@law@clean\@ltok@author\@law@authortemp%
+\@law@clean\@ltok@titlemainface\@law@titlemainfacetemp%
+\@law@clean\@ltok@titleoptionface\@law@titleoptionfacetemp%
+\@law@clean\@ltok@argtwo\@law@argtwotemp%
+\@law@clean\@ltok@name\@law@nametemp%
+\@law@clean\@ltok@citepage\@law@citepagetemp%
+\@law@clean\@ltok@citefirstmainface\@law@citefirstmainfacetemp%
+\@law@clean\@ltok@citefirstoptionface\@law@citefirstoptionfacetemp%
+\@law@clean\@ltok@citefirst\@law@citefirsttemp%
+\@law@clean\@ltok@conetop\@law@conetoptemp%
+\@law@clean\@ltok@citelast\@law@citelasttemp%
+\@law@clean\@ltok@ptop\@law@ptoptemp}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \subsubsection{Declaration of citation types}
+% This section contains macros used in creating the citation
+% declaration macros actually entered in the document by the user.
+% \paragraph{{\tt @newcite} and its friends}
+% The following macros are used to define the macro
+% suites that relate to particular citation types.
+% These are normally invoked by entries in the {\tt lexicite.tex}
+% file, but the \verb+\newcitestyle+ macro is accessible
+% within the document as well.
+% The \verb+\newcitestyle+ macro expects the following arguments:
+% \begin{enumerate}
+% \item the nickname of the citation style to be created;
+% \item a list of typeface and cite type options, in the
+% syntax required by \verb+\@newciteoptions+;
+% \item a list of cite bridges, in the syntax required
+% by \verb+\@newcitebridges+;
+% \item an integer giving the number of arguments the
+% finished cite-generation macro will accept; and
+% \item an argument consisting of a balanced list of six arguments
+% indicating which of the six possible {\sc Camel}\ arguments
+% will be used.
+% \end{enumerate}
+% The last two of these are fed to \verb+\newcommand+ as formatting
+% arguments in the creation of citation style macros.
+% In operation, the token register assignments
+% performed by \verb+\@newcitebridges+ and\verb+\@law@parsefaces+
+% are memorized by freezing them in macros whose names are
+% derived from the name of the citation style. The freezing
+% operation is carried out by a list of token assignments
+% within the storage macros. The macros are \verb+\xdef+ed,
+% but the expansion of everything
+% except the existing contents of the registers (inserted
+% at one level of expansion using \verb+\the+) is prevented
+% with \verb+\noexpand+s. The
+% macro containing the faces is created inside \verb+\newcitestyle+
+% itself to save an argument position in the definition of
+% \verb+\@law@parsefaces+; we've used up seven, and there are
+% only two to go. This could be done with list
+% macros as well, but this method probably runs a little
+% faster because it does the job directly. The trade-off
+% is that the \meta{cite type name}{\tt faces} macros
+% contain a lot of non-informative text
+% (the names of the token registers); but there are not
+% many citation types, so it is probably worth the cost.
+% in memory.
+%
+% Note that as of this release, citation declarations
+% defined with \verb+\newcitestyle+ {\em always\/} begin
+% with \verb+\new+. This will help simplify the integration
+% of \BibTeX\ and {\sc Camel}.
+% \begin{macrocode}
+\def\newcitestyle#1#2#3{%
+\@ifundefined{@law@citeload}%
+ {\def\@law@citeload{Loading citation classes: #1 ... }}%
+ {\message{\@law@citeload#1}\def\@law@citeload{...\space}}%
+ \@newcitebridges#1#3%
+ \expandafter\@law@parsefaces#2%
+ \expandafter\xdef\csname#1faces\endcsname{%
+ \noexpand\global\noexpand\@ltok@authormainface\noexpand{%
+ \the\@ltok@authormainface\noexpand}%
+ \noexpand\global\noexpand\@ltok@authoroptionface\noexpand{%
+ \the\@ltok@authoroptionface\noexpand}%
+ \noexpand\global\noexpand\@ltok@titlemainface\noexpand{%
+ \the\@ltok@titlemainface\noexpand}%
+ \noexpand\global\noexpand\@ltok@titleoptionface\noexpand{%
+ \the\@ltok@titleoptionface\noexpand}%
+ \noexpand\global\noexpand\@ltok@citefirstmainface\noexpand{%
+ \the\@ltok@citefirstmainface\noexpand}%
+ \noexpand\global\noexpand\@ltok@citefirstoptionface\noexpand{%
+ \the\@ltok@citefirstoptionface\noexpand}%
+ \noexpand\global\noexpand\@ltok@citetype\noexpand{%
+ \the\@ltok@citetype\noexpand}}%
+ \expandafter\gdef\csname new#1\endcsname##1##2##3##4##5##6##7%
+ {\@newcite{#1}{##1}{##2}{##3}{##4}{##5}{##6}{##7}}}
+% \end{macrocode}
+% The following are parsing routines that are called by \verb+\newcitestyle+.
+% In \verb+\@law@parsefaces+, the seven arguments are the string of letters
+% in the second argument of \verb+\newcitestyle+.
+% This function has been drastically simplified over
+% the first release. I should have done
+% it this way in the first place and saved myself a lot of
+% aggravation. The code should run a lot faster to boot.
+% \begin{macrocode}
+\def\@law@parsefaces#1#2#3#4#5#6#7{%
+ \@law@parseoneoption\@ltok@authormainface#1%
+ \@law@parseoneoption\@ltok@authoroptionface#2%
+ \@law@parseoneoption\@ltok@titlemainface#3%
+ \@law@parseoneoption\@ltok@titleoptionface#4%
+ \@law@parseoneoption\@ltok@citefirstmainface#5%
+ \@law@parseoneoption\@ltok@citefirstoptionface#6%
+ \@law@parselastoption\@ltok@citetype#7}
+%
+\def\@law@parseoneoption#1#2{%
+ \if#2s\global#1{\sc}\fi%
+ \if#2i\global#1{\em}\fi%
+ \if#2b\global#1{\bf}\fi%
+ \if#2r\global#1{\rm}\fi%
+ \if#2S\global#1{\sc}\fi%
+ \if#2I\global#1{\em}\fi%
+ \if#2B\global#1{\bf}\fi%
+ \if#2R\global#1{\rm}\fi}
+%
+\def\@law@parselastoption#1#2{%
+ \if#2a\global#1{article}\fi%
+ \if#2b\global#1{book}\fi%
+ \if#2c\global#1{case}\fi%
+ \if#2s\global#1{statute}\fi%
+ \if#2A\global#1{article}\fi%
+ \if#2B\global#1{book}\fi%
+ \if#2C\global#1{case}\fi%
+ \if#2S\global#1{statute}\fi}
+% \end{macrocode}
+% Bridges are stored literally, without parsing, so it's
+% easy to stash them directly in a single macro that
+% is fed the arguments. The assignments here are stored
+% by the same method outlined in the description of
+% \verb+\newcitestyle+, above.
+% \begin{macrocode}
+\newtoks\@ltok@c%
+\newtoks\@ltok@d%
+\newtoks\@ltok@e%
+\newtoks\@ltok@f%
+\newtoks\@ltok@g%
+\newtoks\@ltok@h%
+\newtoks\@ltok@i%
+\newtoks\@ltok@j%
+\def\@newcitebridges#1[a]#2[t]#3[c]#4[p]#5(pl)#6[rp]#7[e]:[id]#8(pl)#9[xrf]{%
+\@ltok@c{#2}%
+\@ltok@d{#3}%
+\@ltok@e{#4}%
+\@ltok@f{#5}%
+\@ltok@g{#6}%
+\@ltok@h{#7}%
+\@ltok@i{#8}%
+\@ltok@j{#9}%
+ \expandafter\xdef\csname#1bridges\endcsname{%
+ \noexpand\global\noexpand\@ltok@atot\noexpand{\the\@ltok@c\noexpand}%
+ \noexpand\global\noexpand\@ltok@ttocone\noexpand{\the\@ltok@d\noexpand}%
+ \noexpand\global\noexpand\@ltok@conetop\noexpand{\the\@ltok@e\noexpand}%
+ \noexpand\global\noexpand\@ltok@conetopplural\noexpand{\the\@ltok@g\noexpand}%
+ \noexpand\global\noexpand\@ltok@ptop\noexpand{\the\@ltok@f\noexpand}%
+ \noexpand\global\noexpand\@ltok@ptoctwo\noexpand{\the\@ltok@h\noexpand}%
+ \noexpand\global\noexpand\@ltok@atbridge\noexpand{\the\@ltok@i\noexpand}%
+ \global\@ltok@atbridgeplural\noexpand{\the\@ltok@j\noexpand}}}%
+% \end{macrocode}
+% \subsubsection{Declaration of citation nicknames}
+% The following macros are called by the macros generated
+% by the \verb+\newcitestyle+ macro and its arguments.
+% Their effect is to create nickname macros which can then
+% be called by the user with the \verb+\source+
+% command, with the nickname as
+% a single argument in braces.
+% This macro is called by
+% \verb+\new+\meta{citation type name}. While this macro always takes
+% seven arguments, some of these may be masked off
+% from the user, if fewer than the full possible six
+% arguments were called for in the final argument fed
+% to \verb+\newcitestyle+ in creating the particular
+% \verb+\new+\meta{citation type name} macro that is
+% doing the calling. The arguments are there, the user just
+% can't put anything into them.\\
+% The \verb+\@law@authortracing+
+% macro is actually just a temporary macro; I gave it a
+% descriptive name because it was a struggle to keep my
+% head around what it does as I was programming this.
+% What happens is that a token assignment of the
+% author's name followed by a trip to the cleaning routine
+% is used to store a harmless string consisting of the
+% entire contents of the author's name field in the
+% \verb+\@law@authortracing+ macro. Then this {\em name\/}
+% is defined as a macro, expanding to {\tt 1} or {\tt 2},
+% depending on whether it has been defined once already.
+% The macro may look something
+% like \verb+\Jayeff Huggins~Jr.+. Drastic, but effective.
+% Try doing that with a WordPerfect macro \ldots
+% \begin{macrocode}
+\newif\if@law@specialbridges%
+\def\@newcite#1#2#3#4#5#6#7#8{%
+\message{=}%
+ {\@ltok@a={#4}\@law@clean\@ltok@a\@law@temp%
+\expandafter\ifx\csname\@law@temp\endcsname\relax%
+\expandafter\expandafter\expandafter\xdef\expandafter%
+ \csname\@law@temp\endcsname{1}%
+\else%
+ \expandafter\expandafter\expandafter\xdef\expandafter%
+ \csname\@law@temp\endcsname{2}%
+\fi}%
+% \end{macrocode}
+% The \verb+\@law@stasheverything+ macro creates the
+% list macro that can be used to retrieve all citation
+% details at a later point in the document. \verb+\@law@makecitenick+
+% creates the short macro that knows how to unstash the stored
+% information. Note that this is where things end
+% if we are inside the \verb+lexilist+ environment.\footnote{%
+% The previous release used a {\tt\string\@law@stashinfo} macro
+% that
+% took nine arguments. The last two were just
+% toggles, in effect, for the creation of a long- and a
+% short-form nickname macro. Passing the information in
+% this way required the definition of two separate invocation
+% macros, one for full-form citing and one for short-form
+% citing.
+% This was messy. We now do all of this with
+% true toggles that change the behaviour of a single
+% set of routines. This means:
+% \begin{itemize}
+% \item We don't need two macros; and
+% \item The stash routines can be included in {\tt\string\@newcite}
+% itself---information needn't be passed through macro arguments
+% at all, which helps speed things up.
+% \end{itemize}
+% We have to start by emptying the contents of the temporary
+% list macro; a beta version didn't do this, and loading cites
+% took an amazingly long time. I had problems with ``{\tt TeX capacity
+% exceeded}'' messages, and {\tt\string\tracingmacros=2} showed that every
+% cite was a stack containing the desired cite---and every preceding
+% citation as well!}
+% \begin{macrocode}
+\def\@law@templistmacro{}%
+\def\@law@tempplistmacro{}%
+\setcounter{law@paranormal}{0}
+ \ifcat$\the\@ltok@useratbridgeplural$%
+ \@law@addargument{}\tocitelist%
+ \@law@addargument{}\tocitelist%
+ \@law@addargument{}\tocitelist%
+ \@law@addargument{}\tocitelist%
+ \@law@addargument{}\tocitelist%
+ \@law@addargument{}\tocitelist%
+ \else%
+ \@law@addtoken\@ltok@userconetop\tocitelist%
+ \@law@addtoken\@ltok@userconetopplural\tocitelist%
+ \@law@addtoken\@ltok@userptop\tocitelist%
+ \@law@addtoken\@ltok@userptoctwo\tocitelist%
+ \@law@addtoken\@ltok@useratbridge\tocitelist%
+ \@law@addtoken\@ltok@useratbridgeplural\tocitelist%
+ \fi%
+\@law@addargument{#1}\tocitelist%
+\@law@addtoken\@ltok@bigsourcepage\tocitelist% (not yet implemented)
+\@law@addtoken\@ltok@bigsourcecite\tocitelist% (not yet implemented)
+\@law@addtoken\@ltok@hereinafter\tocitelist% (not yet implemented)
+% \end{macrocode}
+% Two fields are made nil during stash; they will be filled
+% when the macro is first unpacked.
+% \begin{macrocode}
+ \@law@addargument{}\tocitelist%
+ \@law@addargument{}\tocitelist%
+\@law@addtoken\@ltok@citetype\tocitelist% cite type
+\@law@addargument{#8}\tocitelist% cite last part
+\@law@addargument{#7}\tocitelist% cite page
+\@law@addargument{#6}\tocitelist% cite first part
+\@law@addargument{#5}\tocitelist% name of work
+\@law@addargument{#4}\tocitelist% author
+\expandafter\gdef\csname @law@#2@lab\endcsname{#3}% label
+\@law@addargument{#2}\tocitelist% nickname
+\def\@law@tempplistmacro{}%
+\@law@paracheckone{#2}}%
+% \end{macrocode}
+%
+% \begin{macro}{\@law@paracheckone}
+% \begin{macro}{\@law@parachecktwo}
+% \begin{macro}{\@law@getpara}
+% The following three macros look ahead (after the initial
+% arguments to a cite declaration have been digested but {\em
+% before\/} the cite information has been stored to the list
+% macro) for a {\tt =} sign, which signals parallel citation
+% details. If a {\tt =} sign is found, a further check is made
+% for a {\tt [}, which signals a set of special bridges for the
+% upcoming parallel citation. Note the use of two {\tt =} signs
+% in braces as the first argument to {\tt\string\@ifnextchar}.
+% This is required because of the internal syntax of the
+% {\tt\string\@ifnextchar} macro.
+% \begin{macrocode}
+\def\@law@paracheckone#1{%
+ \def\@law@temp{{#1}}%
+ \@ifnextchar{=}%
+ {\expandafter\expandafter\expandafter\@law@parachecktwo%
+ \expandafter\@law@temp\@gobble}%
+ {\@@newcite{#1}}}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+\def\@law@parachecktwo#1{\@ifnextchar[%
+ {\@law@getpara{#1}}%
+ {\@law@getpara{#1}[{}{}{}{}{}]}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% The following add a single set of parallel citation details
+% into a list macro used as a holding area for this purpose.
+% \begin{macrocode}
+\def\@law@getpara#1[#2#3#4#5#6]#7#8#9{%
+ \addtocounter{law@parapin}{1}
+ \def\@law@temp{{#1}}%
+ \@law@addpargument{{#2}{#3}{#4}{#5}{#6}{#7}{#8}{#9}}\tolist%
+ \@ifnextchar{=}%
+ {\expandafter\expandafter\expandafter%
+ \@law@parachecktwo\expandafter\@law@temp\@gobble}%
+ {\@@newcite{#1}}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\def\@@newcite#1{%
+% \end{macrocode}
+% A counter indicating how many parallel citations are stored for
+% the current citation, and the
+% list macro of parallel citation details built by the
+% routines above is stored as a single item in the general list macro of
+% citation details.
+% \begin{macrocode}
+\@law@addtoken\c@law@paranormal\tocitelist
+\@ltok@a\expandafter{\@law@tempplistmacro}%
+\@law@addtoken\@ltok@a\tocitelist%
+\expandafter\global\expandafter\let\csname @ldata@#1\endcsname=\@law@templistmacro%
+\@ltok@userconetop{}%
+\@ltok@userconetopplural{}%
+\@ltok@userptop{}%
+\@ltok@userptoctwo{}%
+\@ltok@useratbridge{}%
+\@ltok@useratbridgeplural{}%
+% \end{macrocode}
+% Having stashed everything, we're ready to make the nickname
+% macro itself, and print the long form of the cite. We set
+% "\@law@temp" equal to the nickname macro, and expand after
+% the condition so that arguments can be examined---otherwise
+% the first thing the nickname sees will be the "\fi".
+% \begin{macrocode}
+\@law@makecitenick{#1}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \if@law@listinputting\def\@law@nick{}\else%
+ \def\@law@nick{\source[f]{#1}}\fi\@law@nick}%
+% \end{macrocode}
+% This macro adds one argument item "#1" to the end
+% of list macro "\@law@templistmacro". This and the
+% other list handlers are modelled on the examples in
+% Knuth's \TeX book.\source{knuth}+{378}{}
+% This and the other macros in this set do their work on
+% one list macro, \verb+\@law@templistmacro+, in order
+% to avoid the need for lots of \verb+\expandafter+s.
+% \begin{macrocode}
+\def\@law@addargument#1\tocitelist{%
+ \@law@leftappendargument#1\to\@law@templistmacro}
+\long\def\@law@leftappendargument#1\to#2{\@ltok@a={\\{#1}}%
+ \@ltok@b=\expandafter{#2}%
+ \xdef#2{\the\@ltok@a\the\@ltok@b}}
+% \end{macrocode}
+% This macro adds the contents of one token register to
+% the temporary list macro.
+% \begin{macrocode}
+\def\@law@addtoken#1\tocitelist{\@law@leftappendtoken#1\to\@law@templistmacro}
+\long\def\@law@leftappendtoken#1\to#2{%
+ \xdef\@law@temp{\noexpand\\\noexpand{\the#1\noexpand}}%
+ \@ltok@a=\expandafter{\@law@temp}%
+ \@ltok@b=\expandafter{#2}%
+ \xdef#2{\the\@ltok@a\the\@ltok@b}}
+% \end{macrocode}
+% This macro cuts one token-register item \verb+#1+ from the
+% end of list macro "\@law@templistmacro". The lopoff
+% portion is almost straight out of the TeXbook, except
+% that it stores the lopped element in a token register
+% instead of a macro.
+% \begin{macrocode}
+\def\@law@cut#1\fromcitelist{\@law@lop\@law@templistmacro\to#1}
+\def\@law@lop#1\to#2{\expandafter\@law@lopoff#1\@law@lopoff#1#2}%
+\long\def\@law@lopoff\\#1#2\@law@lopoff#3#4{\global#4={#1}\gdef#3{#2}}
+\def\@law@pincut#1\frompinlist{\@law@pinlop\@law@argtwolist\to#1}
+\def\@law@pinlop#1\to#2{\expandafter\@law@pinlopoff#1\@law@pinlopoff#1#2}%
+\long\def\@law@pinlopoff\@law@pingroup\@law@pinstart#1\@law@pinend#2\@law@pinlopoff#3#4{\global#4={#1}\gdef#3{#2}}
+% \end{macrocode}
+%
+% \begin{macro}{\@law@addpargument}
+% \begin{macro}{\@law@addptoken}
+% \begin{macro}{\@law@pcut}
+% The following nine macros are used to manipulate a list
+% macro containing parallel citation details, and sets of
+% token registers into which the list is extracted.
+% \begin{macrocode}
+\def\@law@fetchparas{%
+ \ifnum\the\c@law@paranormal>\the\c@law@paracounter\relax%
+ \@law@pcut\@law@tempplist\fromlist%
+ \expandafter\@law@extractparas\@law@tempplist%
+ \fi}
+\def\@law@extractparas#1#2#3#4#5#6#7#8{%
+ \ifcat$\the\@ltok@useratbridge$%
+ \else%
+ \@ltok@userconetop={#1}%
+ \@ltok@userconetopplural={#2}%
+ \@ltok@userptop={#3}%
+ \@ltok@useratbridge={#4}%
+ \@ltok@useratbridgeplural={#5}%
+ \fi%
+ \global\@ltok@usercitefirst={#6}%
+ \global\@ltok@usercitepage={#7}%
+ \global\@ltok@usercitelast={#8}}
+\def\@law@shiftparas{%
+ \ifnum\the\c@law@paranormal>\the\c@law@paracounter\relax%
+ \ifcat$\the\@ltok@useratbridge$%
+ \else%
+ \global\@ltok@conetop\@ltok@userconetop%
+ \global\@ltok@conetopplural\@ltok@userconetopplural%
+ \global\@ltok@ptop\@ltok@userptop%
+ \global\@ltok@ptoctwo\@ltok@userptoctwo%
+ \global\@ltok@atbridge\@ltok@useratbridge%
+ \global\@ltok@atbridgeplural\@ltok@useratbridgeplural%
+ \fi%
+ \global\@ltok@citefirst\@ltok@usercitefirst%
+ \global\@ltok@citepage\@ltok@usercitepage%
+ \global\@ltok@citelast\@ltok@usercitelast%
+ \fi}
+\def\@law@addpargument#1\tolist{%
+ \addtocounter{law@paranormal}{1}%
+ \@law@rightappendpargument#1\to\@law@tempplistmacro}
+\long\def\@law@rightappendpargument#1\to#2{\@ltok@a={\\{#1}}%
+ \@ltok@b=\expandafter{#2}%
+ \xdef#2{\the\@ltok@b\the\@ltok@a}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\def\@law@addptoken#1\tolist{\@law@leftappendptoken#1\to\@law@tempplistmacro}
+\long\def\@law@leftappendptoken#1\to#2{%
+ \xdef\@law@temp{\noexpand\\\noexpand{\the#1\noexpand}}%
+ \@ltok@a=\expandafter{\@law@temp}%
+ \@ltok@b=\expandafter{#2}%
+ \xdef#2{\the\@ltok@a\the\@ltok@b}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\def\@law@pcut#1\fromlist{\@law@plop\@law@tempplistmacro\to#1}
+\def\@law@plop#1\to#2{\expandafter\@law@plopoff#1\@law@plopoff#1#2}%
+\long\def\@law@plopoff\\#1#2\@law@plopoff#3#4{\gdef#4{#1}\gdef#3{#2}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% This macro turns off the gobbling feature (it may be
+% turned on during execution, if {\em Id.} is used),
+% erases any pinpoint reference information that is
+% hanging around, and if we are in a footnote, it
+% increments the counter that was set to zero at the
+% start of the footnote. It then
+% unpacks all of the info for the cite
+% whose nickname is given in \verb+#1+, and puts it into token registers for
+% further processing. After it unpacks the list macro
+% \verb+\@ldata@+\meta{nickname}, it unpacks the formatting
+% details appropriate
+% to the style in which it was declared.
+% After the list is unpacked,
+% {\em if\/} there is no record of a footnote or page number,
+% then this is the first printing of the cite. The note/page
+% and footnote/page number details need to be stored, and
+% then everything has to be {\em repacked\/}
+% for future reference under the appropriate list macro name.
+% The list macro strategy allows on-the-fly editing of
+% macros which adds greatly to the flexibility of
+% the style.\\
+% Note the "parabeta" guard below. When we turn on support for
+% parallel citations, we will need to do the restash work later,
+% after checking for any attached items.
+% \begin{macrocode}
+\def\@law@unstasheverything#1{%
+\gdef\@law@gobble{}%
+\if@law@infoot%
+ \addtocounter{citesinfoot}{1}%
+\fi%
+\expandafter\let\expandafter\@law@templistmacro\csname @ldata@#1\endcsname%
+\global\c@law@footnote\c@footnote%
+\@law@cut\@ltok@plistmacro\fromcitelist%
+\xdef\@law@tempplistmacro{\the\@ltok@plistmacro}%
+\@law@cut\@ltok@a\fromcitelist%
+\expandafter\c@law@paranormal\the\@ltok@a%
+\@law@cut\@ltok@nickname\fromcitelist%
+\@law@cut\@ltok@author\fromcitelist%
+\@law@cut\@ltok@name\fromcitelist%
+\@law@cut\@ltok@citefirst\fromcitelist%
+\@law@cut\@ltok@citepage\fromcitelist%
+\@law@cut\@ltok@citelast\fromcitelist%
+\@law@cut\@ltok@citetype\fromcitelist%
+\@law@cut\@ltok@whereitsat\fromcitelist%
+\@law@cut\@ltok@pageorfootno\fromcitelist%
+\@law@cut\@ltok@hereinafter\fromcitelist%
+\@law@cut\@ltok@bigsourcecite\fromcitelist%(not yet implemented)
+\@law@cut\@ltok@bigsourcepage\fromcitelist%(not yet implemented)
+\@law@cut\@ltok@stylename\fromcitelist%
+\csname \the\@ltok@stylename bridges\endcsname%
+\csname \the\@ltok@stylename faces\endcsname%
+% \end{macrocode}
+% The following lines check one of the special bridge fields
+% for content. If it is empty, we leave the bridges alone.
+% Otherwise, we replace the default bridges with those selected
+% by the user for this citation.
+% \begin{macrocode}
+\@law@cut\@ltok@a\fromcitelist%
+ \ifcat$\the\@ltok@a$%
+ \else%
+ \@ltok@atbridgeplural\@ltok@a%
+ \@law@cut\@ltok@atbridge\fromcitelist%
+ \@law@cut\@ltok@ptoctwo\fromcitelist%
+ \@law@cut\@ltok@ptop\fromcitelist%
+ \@law@cut\@ltok@conetopplural\fromcitelist%
+ \@law@cut\@ltok@conetop\fromcitelist%
+ \@law@specialbridgestrue%
+ \fi%
+\ifcat$\the\@ltok@whereitsat$%
+ \if@law@requiresubjects%
+ \@ifundefined{@law@\@law@citesubject @citelist}%
+ {\expandafter\gdef\csname @law@\@law@citesubject @citelist\endcsname{}}%
+ {\relax}%
+ \fi%
+ \@law@maybeaddcitesubject
+ \global\@law@firstuseofcitetrue%
+% \end{macrocode}
+% \begin{macrocode}
+ \if@law@infoot%
+ \global\@ltok@whereitsat\@ltok@infoot%
+ \global\@ltok@pageorfootno=\expandafter{\the\c@law@footnote}%
+ \else%
+ \global\@ltok@whereitsat\@ltok@onpage%
+ \global\@ltok@pageorfootno=\expandafter{\the\c@page}%
+ \fi%
+% \end{macrocode}
+% \begin{macrocode}
+ \if@law@specialbridges%
+ \@law@addtoken\@ltok@conetop\tocitelist%
+ \@law@addtoken\@ltok@conetopplural\tocitelist%
+ \@law@addtoken\@ltok@ptop\tocitelist%
+ \@law@addtoken\@ltok@ptoctwo\tocitelist%
+ \@law@addtoken\@ltok@atbridge\tocitelist%
+ \@law@addtoken\@ltok@atbridgeplural\tocitelist%
+ \else%
+ \@law@addargument{}\tocitelist%
+ \@law@addargument{}\tocitelist%
+ \@law@addargument{}\tocitelist%
+ \@law@addargument{}\tocitelist%
+ \@law@addargument{}\tocitelist%
+ \@law@addargument{}\tocitelist%
+ \fi%
+\@law@addtoken\@ltok@stylename\tocitelist% style name
+\@law@addtoken\@ltok@bigsourcepage\tocitelist%(not yet implemented)
+\@law@addtoken\@ltok@bigsourcecite\tocitelist%(not yet implemented)
+\@law@addtoken\@ltok@hereinafter\tocitelist% (not yet implemented)
+\@law@addtoken\@ltok@pageorfootno\tocitelist% (1)(b) stash the footnote bridge
+\@law@addtoken\@ltok@whereitsat\tocitelist% (2)(b) footnote number
+\@law@addtoken\@ltok@citetype\tocitelist% cite type
+\@law@addtoken\@ltok@citelast\tocitelist% cite last part
+\@law@addtoken\@ltok@citepage\tocitelist% cite page
+\@law@addtoken\@ltok@citefirst\tocitelist% cite first part
+\@law@addtoken\@ltok@name\tocitelist% name of work
+\@law@addtoken\@ltok@author\tocitelist% author
+\@law@addtoken\@ltok@nickname\tocitelist% nickname
+\@law@addtoken\c@law@paranormal\tocitelist% parallels counter
+\@law@addtoken\@ltok@plistmacro\tocitelist% parallels
+\global\expandafter\let\csname @ldata@#1\endcsname\@law@templistmacro%
+\fi%
+}
+% \end{macrocode}
+% \subsubsection{Calling citation nicknames}
+% The nickname macro defined by this routine
+% (\verb+\@lnick@+\meta{nickname}), is immensely
+% more compact than in the
+% first release. \verb+\@law@argscheck+ eventually
+% leads to \verb+\@law@setup+ after a series of
+% checks for optional arguments. For the longest time I used
+% a "\the" statement for the contents of "\@law@argscheck"; "\noexpand" works
+% just as well and is much simpler to arrange.
+% \begin{macrocode}
+\def\@law@makecitenick#1{%
+ \expandafter\xdef\csname @lnick@#1\endcsname{%
+ \noexpand\@law@unstasheverything\noexpand{#1\noexpand}%
+ \noexpand\@law@setup}}
+% \end{macrocode}
+% \begin{macro}{\@law@newcitefirst}
+% The following code will be used to kick off the existing "\@newcite"
+% routine when hereinafter-style references come to be supported.
+% \begin{macrocode}
+%<*hereinafters>
+\def\@law@newcitefirst{\@ifnextchar[]{\catcode`\[=??
+\catcode`\]=??
+\expandafter\@law@newcitesecond\@law@grabhereinafter}
+{\@law@newcite}}
+\def\@law@grabhereinafter#1{\@ltok@hereinafter={#1}
+%</hereinafters>
+% \end{macrocode}
+% \end{macro}
+% \subsubsection{Table writes and preliminary formatting}
+% Once the printing information has been stashed, the
+% \verb+\@lnick@+\meta{nickname} macro can be used
+% to extract and print it. After extracting the
+% information and storing it in token registers,
+% this looks forward to gather any pinpointing argument
+% that has been appended to the macro in the text.
+% Once all the the necessary information has been
+% collected, the \verb+\@law@setup+ macro tidies up
+% the formatting of the cite and writes it to the
+% export file, if the creation of tables for that
+% type of citation has been toggled on. It then
+% invokes the print routine.
+%
+% This macro assumes that all citation information stored
+% for the cite has already been retrieved to appropriate token
+% registers. The redefinition of the backslash character
+% here allows it to be used to select the alternate
+% typeface within a citation argument. The alternate
+% typeface can be changed for all documents by editing
+% the relevant {\tt .cst} file. Grouping braces enclosing
+% all operations within \verb+\@law@setup+ mean than
+% weird stuff turned on the sole purpose of exporting to
+% tables and printing the citation will turn itself off
+% when the print routine is finished.
+% A routine (\verb+\@law@justabovecheck+) is run to
+% figure out what the citation context is---how
+% a cross-reference should be formatted---and
+% once it's found out what it needs to know about
+% the last citation, information on the current citation
+% is tucked away for reference by this the context-checking
+% routine next time around.
+% A series of checks
+% is performed so that superfluous bridges for which there
+% is no corresponding argument can be erased.
+% Then a file
+% write is performed to the appropriate export file, if
+% creation of that table has been toggled on. And finally
+% the print routine is called. The \verb+\@law@gobble+
+% that follows the end of the group is used to eat
+% a superfluous period if necessary. It is brought to
+% life, if appropriate, by the print routine.
+% Note the special catcode of the "|" character during
+% this definition.
+% \begin{macrocode}
+{\catcode`\|=13%
+\long\gdef\@law@setup{%
+% \end{macrocode}
+% The following operations restash the citation details if
+% necessary; by this point we will have grabbed any parallel
+% citation details that we needed.
+% The backslash character is redefined as a self-resetting
+% font-switching macro.
+% \begin{macrocode}
+{\def\@law@firstslash{\begingroup\def\\{\@law@secondslash}%
+ \the\ltokspecialface}%
+ \def\@law@secondslash{\endgroup\def\\{\@law@firstslash}}%
+ \def\\{\@law@firstslash}%
+% \end{macrocode}
+% This carries out the necessary checks on the context of the
+% current citation.
+% \begin{macrocode}
+\@law@justabovecheck%
+% \end{macrocode}
+% Now that the \verb+\@law@justabovecheck+ macro has been run,
+% it is time to set up for the next comparison.
+% Take note that this source was cited, and of any specific page
+% reference it contains, IF we are in a footnote
+% \begin{macrocode}
+\if@law@infoot%
+ \xdef\@law@currentcite{\the\@ltok@author\the\@ltok@name\the\@ltok@citefirst%
+ \the\@ltok@citepage\the\@ltok@citelast}%
+ \xdef\@law@lastpage{\the\@ltok@argtwo}%
+\fi%
+ \begingroup%
+ \@law@tidybridges%
+ \ifx\@law@citesubject\empty%
+ \relax%
+ \else%
+ \if@law@bibentry%
+ \else%
+ \ifnum\the\c@law@paranormal=0\relax%
+ \csname write@one@\@law@citesubject @entry\endcsname%
+ \fi%
+ \fi%
+ \fi%
+ \endgroup%
+\@law@print}}}
+\def\@law@conetopsetup{%
+ \gdef\@law@temp{}%
+ \ifx\@law@argtwolist\@law@temp%
+ \else%
+ \@law@pincut\@ltok@argtwo\frompinlist%
+ \expandafter\@law@multicheck\the\@ltok@argtwo%
+ \@law@multiflag\query\end%
+ \fi}
+\def\@law@tidybridges{%
+% \end{macrocode}
+% A number of further tidying-up operations are appropriate
+% regardless of the form in which the citation will
+% be printed. If certain elements are missing, their
+% related bridges must be erased if the citation is not
+% going to look awful. This is also where the author or title
+% are suppressed in response to flags given to the "\source" command.
+% \begin{macrocode}
+ \if@law@printauthor\else\global\@ltok@author{}\fi%
+ \if@law@printtitle\else\global\@ltok@name{}\fi%
+ \ifcat$\the\@ltok@author$%
+ \global\@ltok@atot{}%
+ \fi%
+ \ifcat$\the\@ltok@name$%
+ \global\@ltok@ttocone{}%
+ \fi%
+ \ifcat$\the\@ltok@citefirst$%
+ \global\@ltok@ttocone{}%
+ \fi%
+ \ifcat$\the\@ltok@citelast$%
+ \global\@ltok@ptoctwo{}%
+ \else%
+ \xdef\@law@temp{\the\@ltok@citelast}%
+ \gdef\@law@temptwo{()}%
+ \ifx\@law@temp\@law@temptwo%
+ \global\@ltok@citelast{}%
+ \global\@ltok@ptoctwo{}%
+ \fi%
+ \fi%
+ \ifcat$\the\@ltok@citepage$%
+ \global\@ltok@ptop{}%
+ \fi%
+ \ifcat$\the\@ltok@argtwo$%
+ \global\@ltok@ptop{}%
+ \ifcat$\the\@ltok@citepage$%
+ \global\@ltok@conetop{}%
+ \fi%
+ \fi%
+% \end{macrocode}
+% Now we run a series of checks to determine the class
+% of citation we are dealing with, and if tables
+% for that type of citation have been turned on, an export is performed;
+% if a cite for export is to a statute, then the special routines
+% for handling page references is brought into play.
+% \begin{macrocode}
+ \ifcat$\the\@ltok@argtwo$%
+ \global\@ltok@ptop{}%
+ \global\@ltok@atbridge{}%
+ \ifcat$\the\@ltok@citepage$%
+ \global\@ltok@conetop{}%
+ \fi%
+% \end{macrocode}
+% And here the \verb+\@law@setup+ routine comes to an end;
+% punt to the print routine, possibly followed by a gobble,
+% if {\em Id.} is printed.
+% \begin{macrocode}
+ \fi}
+% \end{macrocode}
+% \subsection{Output routines}
+% Once the citation has been unpacked and the
+% basic tidying up appropriate to all appearances
+% of the citation has been carried out, it is time
+% to ship its contents to the various output routines.
+% \subsubsection{The print macro}
+% This section contains the code for the print routine and
+% its supporting macros. We begin with the supporting stuff.
+% \begin{macro}{\@law@justabovecheck}
+% Check if immediately preceding cite is the same as this one.
+% This macro is called immediately before the citation is
+% printed. There are lots of conditions, but the structure
+% is just a straightforward nesting of \verb+\if+ statements,
+% each of which sets a toggle or toggles appropriately.
+% In the end, this macro tells us:
+% \begin{itemize}
+% \item Whether the immediately-preceding citation is to
+% the same work; and if it is
+% \item Whether the preceding cite had no pinpoint
+% page reference; and if it had one
+% \item Whether the pages referred to by the two cites
+% are exactly identical.
+% \end{itemize}
+% Try {\em that\/} with
+% WordPerfect!
+% If {\sc Camel}\ isn't getting the decisions right, let me know.
+% \begin{macrocode}
+\def\@law@justabovecheck{%
+ \xdef\@law@temptwo{\the\@ltok@author\the\@ltok@name%
+ \the\@ltok@citefirst\the\@ltok@citepage%
+ \the\@ltok@citelast}%
+ \ifx\@law@lastcite\@law@temptwo%
+ \ifnum\the\c@citesinfoot=1\relax%
+ \@law@justabovecheckdetails%
+ \else%
+ \ifx\@law@currentcite\@law@temptwo%
+ \@law@justabovecheckdetails%
+ \else%
+ \@justabovefalse%
+ \fi%
+ \fi%
+ \else%
+ \ifnum\the\c@citesinfoot>1\relax%
+ \ifx\@law@currentcite\@law@temptwo%
+ \@law@justabovecheckdetails%
+ \else%
+ \@justabovefalse%
+ \fi%
+ \fi%
+ \fi}
+\def\@law@justabovecheckdetails{%
+ \ifx\@law@lastpage\empty%
+ \@justabovetrue%
+ \@l@quiteexactfalse%
+ \else%
+ \ifcat$\the\@ltok@argtwo$%
+ \@justabovefalse%
+ \else%
+ \@justabovetrue%
+ \xdef\@law@temp{\the\@ltok@argtwo}%
+ \ifx\@law@temp\@law@lastpage%
+ \@l@quiteexacttrue%
+ \else%
+ \@l@quiteexactfalse%
+ \fi%
+ \fi%
+ \fi}
+%</lexitex>
+% \end{macrocode}
+% \end{macro}
+% \subsubsection{Proof sheet master document}
+% The following short document will generate proof sheets
+% for all of the primary styles on the system. With the standard
+% distribution, this produces twelve pages of output.
+% \subsection{Proof sheets}
+% The following macros produce a proof sheet that shows all
+% of the permutations of a citation that I can think of.
+% This is useful for those who have to design new citation styles.
+% This is a pretty straightforward exercise, except for the
+% task of feeding a cite declaration exactly the right
+% arguments; this requires re-definition of "\newcitestyle"
+% and the re-parsing of the "lexicite.tex" file.
+%
+% If you find permutations that are not represented here,
+% let me know and I'll add them.
+%
+% \subsection{Macros for data export}
+%
+% \begin{macro}{\citationsubject}
+% This macro toggles on the requirement that every
+% citation be assigned to a subject category, and
+% adds a subject to the subject list, with all of the
+% information needed to create a classified bibliography.
+% This information consists of:
+% \begin{enumerate}
+% \item The nickname for the category, used as the argument
+% to the "s=" option in each citation;
+% \item The title for use in the bibliography.
+% \end{enumerate}
+% An optional argument of {\tt t} creates a table, and must be accompanied by
+% {\tt o=} and {\tt i=} options giving the extensions of
+% the input and output files, and by {\tt h=} and optionally
+% may be accompanied by an option of {\tt p} to include
+% poinpoints in the table.
+%
+% NOTE: Definition of "\@law@finish" below is just
+% being chucked into as a patch. This code should all
+% be gone over an reorganized sometime when there
+% is time for it.
+% \begin{macrocode}
+%<*lexitex>
+\def\@law@finish#1\@law@nomatch{}
+\def\@law@slone#1#2{\def\@law@listitem{#1}%
+ \ifx\@law@optionitem\@law@listitem #2%
+ \let\\=\@law@finish\fi}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@law@end}
+% The internal ending character is also common to all parsers.
+% \begin{macrocode}
+\def\@law@end{,}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@law@slnomatch}
+% If when we execute the list of options we do not find a match,
+% we want an error message to go to the terminal. This is the
+% macro that gives the appropriate error message.
+% \begin{macrocode}
+\def\@law@slnomatch{\@camel@error{Citation Warning: Invalid
+ option `\@law@optionitem'
+ given to \string\citationsubject.^^J%
+ Valid options are:^^J
+ 2 (force a second-level header for a subject)^^J
+ p (to include pinpoints in an exported table)^^J
+ i=<extension> (use the three-letter extension in^^J
+ exporting a table)^^J
+ o=<volume> (use the three-letter extension in^^J
+ importing a table)^^J%
+To avoid errors in formatting, use commas in the option string^^J%
+only where they are logically necessary to the sense of the^^J%
+string.}\@ehc}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\longestlabelfor}
+% This macro set returns a box the exact width of the longest
+% string given as a label to citations of a specified
+% subject class.
+% \begin{macrocode}
+\newlength{\templen}
+\newlength{\lawlengthone}
+\newlength{\lawlengthtwo}
+\def\@law@getlabel#1{\settowidth\lawlengthone{\csname @law@#1@lab\endcsname}%
+ \ifnum\lawlengthone>\lawlengthtwo%
+ \settowidth\lawlengthtwo{\csname @law@#1@lab\endcsname}%
+ \fi}
+\def\longestlabelfor#1{%
+ \setlength\lawlengthone{0pt}%
+ \setlength\lawlengthtwo{0pt}%
+ \let\\=\@law@getlabel%
+ \csname @law@#1@citelist\endcsname}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@law@subjectoptionlist}
+% The list of options is simple and expansible. The syntax of
+% the last two
+% lines is required if everything is to work as expected.
+% The items in the help message should probably be
+% drawn from here, to provide a hook for expansion
+% if other styles want to tinker with the options to
+% "\source".
+% \begin{macrocode}
+\def\@law@subjectoptionlist{%
+ \\{1}{\gdef\@law@level{1}}%
+ \\{2}{\gdef\@law@level{2}}%
+ \\{p}{\global\@law@usepinpointstrue}%
+ \\{P}{\gdef\@law@bibformat{\global\@law@usepagestrue}}%
+ \\{o}{\gdef\@law@parsemacro##1{\gdef\@law@outputext{##1}}%
+ \let\@law@parse\@law@slparsecomma}%
+ \\{i}{\gdef\@law@parsemacro##1{%
+ \ifcat$##1$\else%
+ \global\@law@maketabletrue%
+ \expandafter\gdef\csname\@law@temp inputext\endcsname{##1}%
+ \fi}%
+ \let\@law@parse\@law@slparsecomma}%
+ \\{=}{\let\@law@parse\@law@slparsebumequal}%
+ \\{,}{}%
+ \\{\end}{\let\@law@nomatch\relax\let\@law@parse\relax}%
+ \@law@nomatch}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@law@parselastcheck}
+% \begin{macro}{\@law@parsecomma}
+% \begin{macro}{\@law@parselastcheck}
+% \begin{macro}{\@law@parseplain}
+% We switch between three possible forms for the "\@law@parse" macro,
+% and we also need to have a special way of ending when the
+% delimiter is found in the list.
+% \begin{macrocode}
+\def\@law@slparsecomma=#1,{%
+ \@law@parsemacro{#1}\let\@law@parse\@law@slparseplain%
+ \@@parse}
+% \end{macrocode}
+% \begin{macrocode}
+\def\@law@slparsebumequal#1,{\let\@law@parse\@law@slparseplain\@@parse}
+% \end{macrocode}
+% \begin{macrocode}
+\def\@law@slparseplain#1{%
+ \let\@law@nomatch=\@law@slnomatch%
+ \def\@law@optionitem{#1}\let\\=\@law@slone\@law@subjectoptionlist\@@parse}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \begin{macrocode}
+\def\citationsubject{%
+ \@ifnextchar[{\@citationsubject}{\@citationsubject[1]}}
+{\catcode`\|=13%
+\gdef\@citationsubject[#1]#2#3{%
+ \global\let\@law@level\relax%
+ \global\@law@usepinpointsfalse%
+ \global\@law@maketablefalse%
+ \global\@law@requiresubjectstrue%
+ \gdef\@law@bibformat{}%
+ \def\@law@temp{#2}%
+ {\let\@law@parse=\@law@slparseplain\@law@parse #1,\end}%
+ \expandafter\gdef\csname write@one@#2@entry\endcsname{}%
+ \if@law@maketable%
+ \expandafter\def\csname the#2table\endcsname{%
+ \@restonecoltrue%
+ \if@twocolumn\@restonecolfalse\fi%
+ \section*{#3}%
+ \@mkboth%
+ {\uppercase{#3}}%
+ {\uppercase{#3}}%
+ \thispagestyle{plain}%
+ \parindent\z@\parskip\z@ plus.3\p@\relax%
+ \let\item\citationtableitem}
+ \expandafter\def\csname endthe#2table\endcsname{%
+ \if@restonecol\onecolumn%
+ \else\clearpage%
+ \fi}%
+ \def\itemspace{%
+ \par\vskip 10\p@ plus5\p@ minus3\p@\relax}
+ \newindex{#2}{\@law@outputext}{\csname#2inputext\endcsname}{#3}%
+ \if@law@usepinpoints%
+ \expandafter\gdef\csname write@one@#2@entry\endcsname{%
+ {\ifcat$\the\@ltok@argtwo$\@ltok@argtwo{\@law@delim}\fi%
+ \@ltok@pagesstring\@ltok@argtwo%
+ \def\@law@comma{\@law@exportapage}%
+ \def\@law@ampersand{\@law@exportapage}%
+ \def\@law@dash{\@law@exportapage}%
+ \def|{\@law@exportapage}%
+ \def\@law@exportapage####1\@law@delim{%
+ \@ltok@argtwo{####1}%
+ \def\@law@temp{\index[#2]}%
+ \edef\@law@temptwo{%
+ \noexpand{\string\bibitem %
+ \string\source[b,Z=\the\@ltok@nickname]%
+ \noexpand{\the\@ltok@nickname\noexpand}%
+ \ifcat$\the\@ltok@argtwo$\else>####1\fi\string|maybe\noexpand}}%
+ \expandafter\@law@temp\@law@temptwo}
+ \expandafter\@law@exportapage\the\@ltok@pagesstring}}%
+ \else%
+ \expandafter\gdef\csname write@one@#2@entry\endcsname{%
+ \def\@law@temp{\index[#2]}%
+ \edef\@law@temptwo{%
+ \noexpand{\string\bibitem %
+ \string\source[b,Z=\csname @law@\the\@ltok@nickname @lab\endcsname]%
+ \string{\the\@ltok@nickname\string}\string|maybe\noexpand}}%
+ \expandafter\@law@temp\@law@temptwo}%
+ \fi%
+ \fi%
+ \@ltok@a=\expandafter{\@law@subjectlist}%
+ \@ltok@c=\expandafter{\@law@bibformat}%
+ \if@law@usepinpoints%
+ \edef\@law@temp{\noexpand\\\noexpand{#2\noexpand}%
+ \noexpand{p\noexpand}%
+ \noexpand{#3\noexpand}
+ \noexpand{\the\@ltok@c\noexpand}}%
+ \@ltok@b=\expandafter{\@law@temp}%
+ \else%
+ \edef\@law@temp{\noexpand\\\noexpand{#2\noexpand}
+ \noexpand{\@law@level\noexpand}
+ \noexpand{#3\noexpand}
+ \noexpand{\the\@ltok@c\noexpand}}%
+ \@ltok@b=\expandafter{\@law@temp}%
+ \fi%
+ \edef\@law@subjectlist{\the\@ltok@a\the\@ltok@b}}}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\printbibliography}
+% To print bibliographies, we use a single command with two
+% modes built into it.
+% \changes{1.0n}{95/07/13}{Hacked in a toggle to turn off labels in
+% printbibliography.}
+% \changes{1.0q}{96/03/08}{Eliminated the stuff for showing holdings,
+% fact patterns, and so forth.}
+% \changes{1.0q}{96/03/08}{Eliminated \texttt{\bs cite} and \texttt{\bs
+% lexicite} aliases of the \texttt{\bs source} command.}
+% \changes{1.0r}{96/03/09}{Brace-enclosed the list-macro executions
+% in printbibliography, to prevent clashes with kernel definition
+% of double-backslash.}
+% \changes{1.0t}{97/02/17}{Added missing termination
+% macro @law@finish for use by parsing routines. Reported
+% by Kevin Haddock, for which many thanks.}
+% \begin{macrocode}
+\def\printbibliography{\@ifnextchar[{\@printbibliography}{\@printbibliography[]}}
+\def\@printbibliography[#1]#2{%
+ \global\@law@forcefootnotesfalse%
+ \gdef\@law@temp{#1}\gdef\@law@temptwo{labels=false}%
+ \let\camelrefname\refname%
+ \expandafter\ifx\csname#2inputext\endcsname\relax%
+ \global\@law@tablefalse%
+ \else%
+ \global\@law@tabletrue%
+ \fi%
+ \begingroup%
+ \def\refname{\@law@getsubjectheader{#2}}%
+ \@law@usepagesfalse%
+ \@law@getbibformat{#2}
+ \let\maybe\@gobble%
+ \let\camelfill\relax%
+ \let\camelarrow\relax%
+ \ifx\@law@temp\@law@temptwo%
+ \advance\@totalleftmargin -\labelsep%
+ \advance\linewidth \labelsep%
+ \def\@biblabel##1{}%
+ \fi%
+ \if@law@table%
+ \if@law@usepages%
+ \let\maybe\relax%
+ \let\camelfill\dotfill%
+ \let\camelarrow\rightarrow%
+ \fi%
+ \else%
+ \longestlabelfor{#2}%
+ \ifdim\lawlengthtwo=0pt%
+ \advance\@totalleftmargin -\labelsep%
+ \advance\linewidth \labelsep%
+ \def\@biblabel##1{}%
+ \fi%
+ \fi%
+ \if@law@requiresubjects%
+ \@law@dobibliography{#2}%
+ \else%
+ \gdef\@law@temp{#2}\gdef\@law@temptwo{all}%
+ \ifx\@law@temp\@law@temptwo%
+ \@law@dobibliography{#2}%
+ \else%
+ \message{^^J===================================================^^J%
+ Camel bibliography ^^J
+ Document type: without-subjects ^^J
+ Bibliography type: subject-specific (#2) ^^J
+ Action: impossible task, ignoring ...^^J%
+ ===================================================^^J}
+ \fi%
+ \fi%
+ \endgroup}
+% \end{macrocode}
+% \end{macro}
+% \begin{macrocode}
+\def\@law@dobibliography#1{%
+ \begin{thebibliography}{\if@law@biblabels\longestlabelfor{#1}\rule{\lawlengthtwo}{5pt}\fi}
+ \if@law@table%
+ \if@law@usepages%
+ \addtolength{\parsep}{-.5\parsep}%
+ \addtolength{\itemsep}{-.5\itemsep}%
+ \fi%
+ \fi%
+ \if@law@requiresubjects%
+ \@law@requiresubjectsfalse%
+ \if@law@table
+ \message{^^J===================================================^^J%
+ Camel bibliography ^^J
+ Document type: subject-classified cites ^^J
+ Bibliography type: subject-specific external (#1) ^^J
+ Action: generating^^J%
+ ===================================================^^J}
+ \@input{\jobname.\csname#1inputext\endcsname}
+ \else%
+ \gdef\@law@temp{#1}\gdef\@law@temptwo{all}%
+ \ifx\@law@temp\@law@temptwo%
+ \message{^^J===================================================^^J%
+ Camel bibliography ^^J
+ Document type: subject-classified cites ^^J
+ Bibliography type: all citations ^^J
+ Action: header only (not yet implemented)^^J%
+ ===================================================^^J}
+ \else%
+ \message{^^J===================================================^^J%
+ Camel bibliography ^^J
+ Document type: subject-classified cites ^^J
+ Bibliography type: subject-specific internal (#1) ^^J
+ Action: generating^^J%
+ ===================================================^^J}
+ {\let\\\@law@bibslash%
+ \csname @law@#1@citelist\endcsname}
+ \fi%
+ \fi%
+ \else%
+ \message{^^J===================================================^^J%
+ Camel bibliography ^^J
+ Document type: without-subjects ^^J
+ Bibliography type: all citations ^^J
+ Action: generating^^J%
+ ===================================================^^J}
+ {\let\\\@law@bibslash%
+ \csname @law@#1@citelist\endcsname}%
+ \fi%
+ \end{thebibliography}}
+\def\@law@bibslash#1{\bibitem [\csname @law@#1@lab\endcsname] \source[b]{#1}. }
+%</lexitex>
+% \end{macrocode}
+%
+% \subsubsection{Citation style definitions}
+% No styles are included here. See the separate style
+% files in the {\sc Camel} archive for the matching
+% ".bst", ".cst" and ".cit" files that make up each {\sc Camel}
+% style variation. These may be distributed as ".doc"
+% files, and should be available on CTAN under
+% "/macros/latex/contrib/supported/camel".
+% \subsection{Index styles}
+% This code, and the table writing code, is provisional;
+% this should be made more general. Less of a hack than the
+% original \LexiTeX{} code, though!
+% \begin{macrocode}
+%<*camelindex>
+actual '#'
+quote '!'
+level '>'
+preamble
+"\n"
+postamble
+"\n"
+item_0 "\n"
+item_x1 "\n \\subitem "
+item_x2 "\n \\subsubitem "
+delim_n "\$\\rightarrow\$"
+delim_0 "\~\\camelfill"
+delim_1 "\$\\camelarrow\$"
+% The next lines will produce some warnings when
+% running Makeindex as they try to cover two different
+% versions of the program:
+lethead_prefix "{\\bf\\hfil "
+lethead_suffix "\\hfil}\\nopagebreak\n"
+lethead_flag 1
+heading_prefix "{\\bf\\hfil "
+heading_suffix "\\hfil}\\nopagebreak\n"
+headings_flag 0
+\ifx\on@line\undefined
+ \def\on@line{ on input line \the\inputlineno}
+ \errhelp{Support for input line numbers has been added
+ to latex.tex <dec91>.^^J^^J%
+ Please update to a newer LaTeX release.}
+ \errmessage{Obsolete LaTeX release (older than Dec.91)}
+\fi
+%</camelindex>
+% \end{macrocode}
+% \section{A \BibTeX{} Library}
+% Considerable modification of an existing ".bst" file
+% may be required to make it give output that can be
+% digested by {\sc Camel}.
+% You may find that it is actually easier to draft
+% you entry type functions from scratch, using
+% the following library of \BibTeX{}
+% functions. See the file "law.dtx" for an example of
+% entry types based on this library, and for an example
+% of how to tie the library and your own functions
+% together through a driver file entry.
+% \newcounter{speccount}
+% \def\addline{ & \arabic{speccount}.\addtocounter{speccount}{1} &\let\item\subsequentitem}
+% \def\startingitem{\setcounter{speccount}{1}\addline}
+% \def\subsequentitem{\\\addline}
+% \long\def\spec#1#2#3{%
+% \noindent\begin{tabular}{|>{\bf}rc%
+% >{\PreserveBackslash\raggedright\small}p{3.5in}|}\hline
+% Expected:
+% \let\item\startingitem #1\\
+% &&\\
+% Left:
+% \let\item\startingitem #2\\
+% &&\\
+% Toggles:
+% \let\item\startingitem #3\\
+% \hline
+% \end{tabular}}
+% Each function defined using the {\tt FUNCTION} operator
+% is accompanied by a brief description of what it is
+% intended to do, followed by a box in the following form:
+% \spec{\item What the function expects to find on the stack,
+% numbered from the top (most recently pushed) to the bottom
+% item.}
+% {\item What the function will leave on the stack, numbered in
+% the
+% same fashion.}
+% {\item {\bf toggle name:} What the effect of any toggles is on the
+% behaviour of the function.}
+%
+% Happy reading.
+% \subsection{Hello!}
+% As ever, we start by telling the world who we are.
+% \begin{macrocode}
+%<*bstheader>
+FUNCTION { hello }
+{
+%<jse>" ============================================"
+%<jse>" for your Camel style and extract again."
+%<jse>" with standard BibTeX, modify the .ins file"
+%<jse>" Warning: localized for jBibTeX. For use "
+" ============================================"
+" bibliography package, version 1.0k or later"
+" Use with LaTeX2e and the Camel prototype "
+" --------------------------------------------"
+" documentation last updated: 5 December 1994 "
+" code last updated: 22 March 1995 "
+" version: 1.0i "
+" Camel style package. "
+" This is the `law' style for BibTeX and the "
+" ============================================"
+stack$
+}
+%</bstheader>
+% \end{macrocode}
+% \subsection{Variable initializations}
+% \DescribeEnv{ENTRY}
+% This command takes three braced arguments, which in order are:
+% \begin{enumerate}
+% \item A list of field names;
+% \item A list of integer variables; and
+% \item A list of string variables.
+% \end{enumerate}
+% The field names created here include some not found in the
+% standard \BibTeX\ styles. The use of both the standard and
+% these new
+% items is fully documented elsewhere, so no commentary is
+% given here. Suffice to say that each item in the list creates
+% a field that
+% subsequent code can work on.
+% \begin{macrocode}
+%<*bstlibrary>
+ENTRY
+% \end{macrocode}
+%
+% \DescribeEnv{field names}
+% \mbox{}
+% \begin{macrocode}
+{ address
+annote
+author
+booktitle
+chapter
+edition
+editor
+howpublished
+institution
+journal
+key
+month
+note
+number
+organization
+pages
+publisher
+school
+series
+title
+type
+volume
+year
+date
+jurisdiction
+court
+division
+divno
+casedate
+translator
+booktranslator
+cites
+units
+}
+% \end{macrocode}
+%
+% \DescribeEnv{entry integers}
+% None are defined. Note that any integers or strings defined
+% with the
+% ENTRY command are created for {\em each\/} entry in the
+% citation list.
+% \begin{macrocode}
+{}
+% \end{macrocode}
+%
+% \DescribeEnv{entry strings}
+% There are no general string variables, either. Such variables
+% might be defined for use in building key labels for use in
+% sorting, or in an end-of-document bibliography style.
+% \begin{macrocode}
+{ label extra.label sort.label }
+% \end{macrocode}
+%
+% \DescribeEnv{STRINGS}
+% A few string macros are needed to hold things
+% temporarily removed from the stack.
+% \BibTeX\ only allows ten such string variables; the named
+% variables in this list will slowly be reduced in number
+% through redesign of the functions that require them.
+% Meanwhile, let's hope we don't find a sudden need for
+% more \ldots
+% \begin{macrocode}
+STRINGS { s t u v scrubdate
+ volume.var year.var number.var journal.var pages.var }
+% \end{macrocode}
+%
+% \DescribeEnv{INTEGERS}
+% The following list of integers is probably also larger than
+% it needs to be. Again, optimization of stack usage will
+% lead to the elimination of some of these variables.
+% \begin{macrocode}
+INTEGERS { itemcount date.specials charcount a b c
+ nameptr namesleft numnames a.logical }
+% \end{macrocode}
+%
+% \DescribeEnv{FUNCTIONS}
+% These functions provide strings used in the parsing of
+% Japanese legal citations. If the language of such citations
+% is not English, these strings may need to be edited.
+% \begin{macrocode}
+FUNCTION {dc..} {"District Court"}
+FUNCTION {sc..} {"Supreme Court"}
+% \end{macrocode}
+%
+% \subsection{Function definitions}
+% \subsubsection{Logic and measurement}
+%
+% \DescribeEnv{not}
+% \DescribeEnv{and}
+% \DescribeEnv{or}
+% These have been copied verbatim from Oren Patashnik's 1988
+% release.
+% His commentary on these functions reads:
+% {\em These three functions pop one or two (integer) arguments
+% from the stack
+% and push a single one, either "0" or "1".
+% The {\tt 'skip\$} in the `"and"' and `"or"' functions are used
+% because
+% the corresponding {\tt if\$} would be idempotent.}
+%
+% \spec{\item The result of a logical test
+% \item The result of a second logical test}
+% {\item A single logical test result}
+% {\item none}
+%
+% \begin{macrocode}
+ FUNCTION {not}
+ { { #0 }
+ { #1 }
+ if$
+ }
+ FUNCTION {and}
+ { 'skip$
+ { pop$ #0 }
+ if$
+ }
+ FUNCTION {or}
+ { { pop$ #1 }
+ 'skip$
+ if$
+ }
+% \end{macrocode}
+%
+% \DescribeEnv{times.ten}
+% One of the date calculation routines requires
+% string-to-integer conversion. \BibTeX\ primitives can only
+% convert in this direction for single characters. Accordingly,
+% we need to be able to raise by a power of ten.
+%
+% \spec{\item A single integer.}
+% {\item A single integer.}
+% {\item none}
+%
+% \begin{macrocode}
+FUNCTION {times.ten}
+ { duplicate$ duplicate$ duplicate$ duplicate$ duplicate$
+ duplicate$ duplicate$ duplicate$ duplicate$
+ + + + + + + + + +
+ }
+% \end{macrocode}
+%
+% \DescribeEnv{character.length}
+% \BibTeX\ provides a built-in command for measuring the length
+% of a string in ``text units''. Sometimes it's nice to know
+% the length of a string in {\em characters\/};
+% this function provides
+% that facility.
+% \changes{1997/01/09}{v1.0s}{Added extraction options for
+% JBibTeX support.}
+%
+% \spec{\item A string.}
+% {\item An integer giving the number of characters in the
+% string.}
+% {\item none}
+%
+% \begin{macrocode}
+FUNCTION {character.length}
+ { 'u :=
+ #0 'charcount :=
+ { u empty$ not }
+ { u
+%<jse> duplicate$
+%<eng> #2
+%<jse> is.kanji.str$ {#3} {#2} if$
+ global.max$ substring$ 'u :=
+ charcount #1 + 'charcount :=
+ }while$
+ charcount
+ }
+% \end{macrocode}
+%
+% \DescribeEnv{first.in.second}
+% This function checks for a substring at the beginning or at the
+% end of a given string. This facility is needed, for example,
+% to provide an automated means of toggling the formatting of
+% the court division string for Japanese cases.
+% In the defintion below, {\tt t} is the substring length, and
+% {\tt u} is the string length.
+%
+% \spec{\item A string toggle.
+% \item A string (the string in which to look).
+% \item A string (the substring to look for).}
+% {\item A single integer ({\tt 0} or {\tt 1}), indicating
+% whether
+% the substring was found at the specified location in the
+% string for search.}
+% {\item {\bf end:} The function looks at the end of the
+% given string.
+% \item{\bf start:} The function looks at the start of the
+% given string.}
+%
+% \begin{macrocode}
+FUNCTION {first.in.second}
+ { 's :=
+ duplicate$ empty$
+ { pop$ pop$ #0 #0 }
+ { swap$ duplicate$ character.length 'a :=
+ swap$ duplicate$ character.length 'b :=
+ b a <
+ { pop$ pop$ #0 #0 }
+ { s "end" =
+ { b a - #1 + global.max$ substring$ =
+ { b a - #1 + #1 }
+ { #0 #0
+ }if$
+ }
+ { s "start" =
+ { #1 a substring$ =
+ { #1 #1 }
+ { #0
+ }if$
+ }
+ { s "reverse" =
+ { b a - #1 + 'b :=
+ { b #0 > }
+ { duplicate$
+ b a substring$
+ 's :=
+ swap$ duplicate$ s =
+ { pop$ pop$ b #0 'b := #1 }
+ { b #1 =
+ { pop$ pop$ #0 #0 'b := #0 }
+ { swap$ b #1 - 'b :=
+ }if$
+ }if$
+ }while$
+ }
+ { b a - #1 + 'b := #1 'c :=
+ { c b < }
+ { duplicate$
+ c a substring$
+ 's :=
+ swap$ duplicate$ s =
+ { pop$ pop$ c b 'c := #1 }
+ { b c - #1 =
+ { pop$ pop$ #0 b 'c := #0 }
+ { swap$ c #1 + 'c :=
+ }if$
+ }if$
+ }while$
+ }if$
+ }if$
+ }if$
+ }if$
+ }if$
+ }
+% \end{macrocode}
+%
+% \DescribeEnv{get.character.type}
+% This function returns one of three strings, `"letter"',
+% `"numeral"' or `"other"` to indicate the type of the
+% character it finds on the stack. This was written for
+% use in the "gather.chars" function, but may find other
+% uses as well.
+% \spec{\item Either {\tt *} or a single character to be scanned
+% for.
+% \item A single character to be examined by the function.}
+% {\item Either {\tt letter}, {\tt numeral} or {\tt other}, the
+% significance of which depends upon the toggle used.}
+% {\item {\tt *} causes the character to be identified as a
+% numeral, and letter or something else.
+% \item Any character other than {\tt *} causes that character to
+% be identified as {\tt other}, and any other characters to be
+% identified as {\tt letter}.}
+% \begin{macrocode}
+FUNCTION { get.character.type }
+ { duplicate$ "*" =
+ { pop$ duplicate$ empty$
+ { pop$ "other" }
+ { chr.to.int$ duplicate$
+ duplicate$ #47 > swap$ #58 < and
+ { pop$ "numeral" }
+ { duplicate$ #64 > swap$ duplicate$ #91 < swap$
+ duplicate$ #96 > swap$ #123 < and 'a.logical :=
+ and a.logical or
+ { "letter" }
+ { "other"
+ }if$
+ }if$
+ }if$
+ }
+ { =
+ { "other" }
+ { "letter"
+ }if$
+ }if$
+ }
+% \end{macrocode}
+% \DescribeEnv{type.last.char}
+% This was written in order to handle situations where
+% trailing punctuation varies depending upon whether the text
+% being punctuated ends in a numeral or not. The power of the
+% library is (finally, in July of 1995) starting to show through.
+% \spec{\item A single string.}
+% {\item A string, either {\tt numeral}, {\tt letter} or {\tt other}.}
+% {\item None.}
+% \begin{macrocode}
+FUNCTION { type.last.char }
+ { duplicate$ character.length
+ #1 substring$
+ "*" get.character.type
+ }
+% \end{macrocode}
+% \changes{1995/07/08}{1.0m}{New function {\tt type.last.char}
+% added, to cope with titles ending in a numeral, hence
+% exceptionally requiring a comma in the Blue Book style.}
+%
+% \subsubsection{Housekeeping}
+% These functions are used to issue warning messages and avoid
+% errors during processing.
+%
+% \DescribeEnv{empty.to.null}
+% This is simply the "field.or.null" function from the standard
+% styles, renamed so that I could more easily remember what it
+% does. Invoked only by the output routines, it assures that
+% empty field markers are replaced with the null string, to
+% prevent smash-ups.
+%
+% \spec{\item The contents of a field, which may be an empty
+% field marker.}
+% {\item A string, possibly the null string.}
+% {\item none}
+%
+% \begin{macrocode}
+ FUNCTION {empty.to.null}
+ { duplicate$ empty$
+ { pop$ "" }
+ 'skip$
+ if$
+ }
+% \end{macrocode}
+%
+% \DescribeEnv{check}
+% This check function isolates the production of warning
+% messages from the output routines, to enhance transparency.
+% Note that this will not convert an empty field marker to
+% the null string; that is left to the output routines.
+%
+% \spec{\item A string for
+% use in an error message.
+% \item The contents of a field.}
+% {\item The field contents.}
+% {\item none}
+%
+% \begin{macrocode}
+FUNCTION { check }
+{ 't :=
+ duplicate$ empty$
+ { "empty " t * " in " * cite$ * warning$}
+ 'skip$
+ if$
+}
+% \end{macrocode}
+%
+% \DescribeEnv{either.or}
+% This checks whether one of a two-item pair is empty.
+% If at least one is empty, the other is returned to the
+% stack. If both are non-empty, a warning is issued, and
+% one item is arbitrarily selected.
+%
+% \spec{\item A string.
+% \item A string.}
+% {\item A single string.}
+% {\item none}
+%
+% \begin{macrocode}
+FUNCTION {either.or}
+ { duplicate$ empty$
+ { pop$ duplicate$ empty$
+ { pop$ "" }
+ 'skip$
+ if$
+ }
+ { swap$ duplicate$ empty$
+ { pop$ }
+ { "both items in an either.or pair are non-empty in " cite$ *
+ warning$
+ " I'm using only ONE of these items (the second passed by the function)."
+ warning$
+ pop$
+ }if$
+ }if$
+ }
+% \end{macrocode}
+% \DescribeEnv{either.or.nowarning}
+% This does the same thing as "either.or", but does not issue a
+% warning if both items exist. As with that function, the second
+% item pushed is preferred.
+%
+% \spec{\item A string.
+% \item A string.}
+% {\item A single string.}
+% {\item none}
+%
+% \begin{macrocode}
+FUNCTION {either.or.nowarning}
+ { duplicate$ empty$
+ { pop$ duplicate$ empty$
+ { empty.to.null }
+ 'skip$
+ if$
+ }
+ { swap$ pop$ }
+ if$
+ }
+% \end{macrocode}
+%
+% \subsubsection{Output}
+% In the interest of transparency, I have tried to make the
+% output functions as simple to use and as flexible in their
+% operation as possible. Every output routine expects to find
+% three items on the stack, and the name of each routine
+% describes how it will react to what it finds there.
+% To keep things tidy, the empty field marker
+% is replaced with the null string only by the output
+% routines.\\
+% The names
+% are sometimes coincidentally comical, but I hope informative
+% as well.
+%
+% \DescribeEnv{must.must.must}
+% The simplest
+% output routine is the "must.must.must" routine; it
+% simply catenates the three strings, replacing any
+% empty field markers it finds with the null string.
+%
+% \spec{\item A string.
+% \item A string.
+% \item A string.}
+% {\item none}
+% {\item none}
+%
+% \begin{macrocode}
+FUNCTION {must.must.must}
+ { empty.to.null 't :=
+ empty.to.null swap$ empty.to.null swap$ t
+ * *
+ write$
+ }
+% \end{macrocode}
+%
+% \DescribeEnv{might.ifone.must}
+% This output routine is heavily used for conditional
+% output. If the deepmost of the three stack items is an empty
+% field marker, the only the topmost item is written to the
+% output file. If this is not the case, then the three items are
+% written in order.
+%
+% \spec{\item A string.
+% \item A string.
+% \item A string.}
+% {\item {\em none}}
+% {\item none}
+%
+% \begin{macrocode}
+FUNCTION {might.ifone.must}
+ { empty.to.null 't :=
+ swap$ duplicate$ empty$
+ { pop$ pop$ t }
+ { swap$ empty.to.null t * * }
+ if$
+ write$
+ }
+% \end{macrocode}
+%
+% \DescribeEnv{iftwo.might.iftwo}
+% This function is typically used to output a formatted item
+% in enclosing braces, where the entire item and its braces
+% should be suppressed if the item is empty.
+%
+% \spec{\item A string.
+% \item A string.
+% \item A string.}
+% {\item none}
+% {\item none}
+%
+% \begin{macrocode}
+FUNCTION {iftwo.might.iftwo}
+ { 't :=
+ duplicate$ empty$
+ { pop$ pop$ }
+ { empty.to.null swap$ empty.to.null swap$
+ t empty.to.null
+ * * write$ }
+ if$
+ }
+% \end{macrocode}
+%
+% \DescribeEnv{must.ifthree.might}
+% This function is used to output a definitely-existing item
+% followed by something that might not exist with intervening
+% punctuation that ought to disappear if it's not needed.
+%
+% \spec{\item A string.
+% \item A string.
+% \item A string.}
+% {\item none}
+% {\item none}
+%
+% \begin{macrocode}
+FUNCTION {must.ifthree.might}
+ { duplicate$ empty$
+ { pop$ pop$ empty.to.null }
+ { 't :=
+ swap$ empty.to.null
+ swap$ empty.to.null
+ t * *
+ }if$
+ write$
+ }
+% \end{macrocode}
+%
+% \subsubsection{Parsing and conversion}
+%
+% \DescribeEnv{field.tag.no.combine}
+% The "no" here stands for ``number''.
+% This function is typically used to simplify the task of
+% building a numbered label for something (e.g.\ a technical
+% report). It provides facilities for handling blank
+% entries, so that these error-handling routines do not
+% need to be drafted from scratch for every such
+% situation.
+%
+% \spec{\item A string toggle.
+% \item An identifier (i.e.\ a report number).
+% \item A text prefix for the identifier.
+% \item A string label (i.e.\ ``Technical Report'' or somesuch).}
+% {\item A single string.}
+% {\item {\bf endlabel:} Combines the text items in the same order
+% in
+% which they are found.
+% \item {frontlabel:} Places the label in front, followed by the
+% identifier, followed by the first item pushed.}
+%
+% \begin{macrocode}
+FUNCTION {field.tag.no.combine}
+ { "endlabel" =
+ { duplicate$ empty$
+ { pop$ pop$ empty.to.null }
+ { empty.to.null 's := empty.to.null
+ swap$ empty.to.null swap$ s * *
+ }if$
+ }
+ { duplicate$ empty$
+ { pop$ pop$ empty.to.null }
+ { empty.to.null 's := empty.to.null
+ swap$ empty.to.null s swap$ * *
+ }if$
+ }if$
+ }
+% \end{macrocode}
+%
+% \DescribeEnv{change.letter.case}
+% This is a simple front-end to the {\tt change.case\$} built-in
+% function, used to change characters in a string from upper to
+% lower case. It slightly enhances the built-in function by
+% providing an option that leaves the string alone.
+%
+% \spec{\item A single character---either
+% an {\tt n}, a {\tt t}, an {\tt l}, or a {\tt u}.
+% \item A string for conversion.}
+% {\item One string, converted according to the option toggle
+% pushed
+% after the string.}
+% {\item {\bf n:} yields the string unchanged.
+% \item {\bf t:} yields
+% all lower case letters except for the first.
+% \item {l:} yields all lower case letters.
+% \item {u:} yields all
+% upper case letters.}
+%
+% \begin{macrocode}
+FUNCTION {change.letter.case}
+ { 't :=
+ duplicate$ empty$
+ 'skip$
+ { t chr.to.int$ "n" chr.to.int$ =
+ 'skip$
+ { t change.case$ }
+ if$
+ }
+ if$
+ }
+% \end{macrocode}
+%
+% \DescribeEnv{n.dashify}
+% The "n.dashify" function makes each single "-" in a string a
+% double "--".
+% if it's not already.\footnote{This comment by Oren Patashnik.}
+%
+% \spec{\item A single string for conversion.}
+% {\item A single converted string.}
+% {\item none}
+%
+% \begin{macrocode}
+ FUNCTION {n.dashify}
+ { 't :=
+ ""
+ { t empty$ not }
+ { t #1 #1 substring$ "-" =
+ { t #1 #2 substring$ "--" = not
+ { "--" *
+ t #2 global.max$ substring$ 't :=
+ }
+ { { t #1 #1 substring$ "-" = }
+ { "-" *
+ t #2 global.max$ substring$ 't :=
+ }
+ while$
+ }
+ if$
+ }
+ { t #1 #1 substring$ *
+ t #2 global.max$ substring$ 't :=
+ }
+ if$
+ }
+ while$
+ }
+% \end{macrocode}
+%
+% \DescribeEnv{gather.chars}
+% The following function was designed for date parsing, but
+% may find other uses as well. It finds the first letter or
+% numeral in a given string, then proceeds to build a substring
+% until it hits a different character type or the end of the
+% string,
+% at which point it
+% stops parsing and terminates.
+%
+% \spec{\item A string for parsing.}
+% {\item A string toggle showing the character type of the
+% first homogenous substring in the string for parsing.
+% \item A string of characters from the front of the given string
+% which are letters or numbers only.
+% \item The remainder of the string.}
+% {\item none}
+%
+% \begin{macrocode}
+FUNCTION { gather.chars }
+ {
+ "forward" =
+ { swap$ duplicate$ character.length 'a :=
+ 't :=
+ duplicate$
+ { t #1 #1 substring$ swap$ get.character.type
+ "other" =
+ t empty$ not and }
+ { t #2 global.max$ substring$ 't := duplicate$
+ }while$
+ duplicate$ t #1 #1 substring$ swap$ get.character.type
+ t #1 #1 substring$ swap$
+ "" swap$ duplicate$ 'u :=
+ t #2 global.max$ substring$ 't :=
+ { u = }
+ { * swap$
+ u * 'u :=
+ u #1 #1 substring$ swap$
+ u #1 #1 substring$
+ u #2 global.max$ substring$ 'u :=
+ t #1 #1 substring$ swap$ get.character.type
+ t #1 #1 substring$ swap$
+ duplicate$ u =
+ { t #2 global.max$ substring$ 't := }
+ { swap$ pop$
+ }if$
+ }while$
+ swap$ pop$ t swap$ u
+ }
+ { swap$ duplicate$ character.length 'a :=
+ 't :=
+ duplicate$
+ { t a #1 substring$ swap$ get.character.type
+ "other" =
+ t empty$ not and }
+ { a #1 - 'a :=
+ t #1 a substring$ 't :=
+ }while$
+ duplicate$ t a #1 substring$ swap$ get.character.type
+ t a #1 substring$ swap$
+ "" swap$ duplicate$ 'u :=
+ a #1 - 'a :=
+ t #1 a substring$ 't :=
+ { u = }
+ { swap$ * swap$
+ u * 'u :=
+ u #1 #1 substring$ swap$
+ u #1 #1 substring$
+ u #2 global.max$ substring$ 'u :=
+ t a #1 substring$ swap$ get.character.type
+ t a #1 substring$ swap$
+ duplicate$ u =
+ { a #1 - 'a := t #1 a substring$ 't := }
+ { swap$ pop$
+ }if$
+ }while$
+ swap$ pop$ t swap$ u
+ }if$
+ }
+% \end{macrocode}
+%
+% \DescribeEnv{tie.or.space.connect}
+% We use this function from the standard styles. It
+% adds a tie if the string it is applied to is three
+% characters or less in length.
+%
+% \spec{\item A string
+% \item A second string}
+% {\item One string}
+% {\item {none}}
+%
+% \begin{macrocode}
+ FUNCTION {tie.or.space.connect}
+ { duplicate$ text.length$ #3 <
+ { "~" }
+ { " " }
+ if$
+ swap$ * *
+ }
+% \end{macrocode}
+%
+% \DescribeEnv{format.pages}
+% This function accepts one toggle option currently,
+% but it is open to expansion. If the "short" toggle is
+% fed to this function, it reads through the field until
+% it hits a non-integer character. Otherwise, it "n.dashify"s
+% the
+% whole field. This needs robustification; the page number
+% might be a roman numeral. Might it be simplest to just
+% drop the scan when we hit a "-"? Deserves some thought.
+%
+% \spec{\item A toggle string.
+% \item page number or possibly
+% a range of pages.}
+% {\item One string, constituting a finished page number, or {\tt
+% empty\$}.}
+% {\item {\bf short:} will return only the
+% first number given in the string.
+% \item {full:}
+% will return the page number, n-dashified.}
+% \changes{1994/12/05}{1.0e}{Altered {\tt format.pages} so
+% that the {\tt short} scan stops at a {\tt-} character,
+% rather than a non-integer. Simpler and more robust.}
+% \begin{macrocode}
+FUNCTION {format.pages}
+ { swap$ duplicate$ empty$
+ { pop$ pop$ "" }
+ { swap$ duplicate$ "short" =
+ { pop$
+ 's :=
+ ""
+ s #1 #1 substring$
+ { "-" = not }
+ { s #1 #1 substring$ *
+ s #2 global.max$ substring$ 's :=
+ s #1 #1 substring$
+ duplicate$ "" =
+ { pop$ "-" }
+ 'skip$
+ if$
+ }
+ while$
+ }
+ { "full" =
+ { pages n.dashify }
+ { "invalid switch fed to the format.pages function"
+ warning$
+ }if$
+ }if$
+ }if$
+}
+% \end{macrocode}
+%
+% \paragraph{Names}
+% The code for parsing and formatting names is extremely
+% economical,
+% thanks to the powerful built-in functions that \BibTeX\
+% supplies
+% for this purpose.
+%
+% \DescribeEnv{format.names}
+% This is based on Oren Patashnik's original function of the same
+% name. His comment was as follows:
+% \begin{quote}
+% The format.names function formats the argument (which should
+% be in
+% \BibTeX name format) into ``{\tt First Von Last, Junior}'',
+% separated by commas
+% and with an "and" before the last (but ending with "et~al." if
+% the last
+% of multiple authors is "others"). This function's argument
+% should always
+% contain at least one name.
+% The format.authors function returns the result of
+% format.names(author)
+% if the author is present, or else it returns the null string.
+% \end{quote}
+%
+% This function is used to format any name field that is
+% thrown at it. It is based on the 1988 release, but with
+% modifications
+% to permit toggling, since the Blue Book requires different
+% author
+% formats for different types of material. The toggling strategy
+% should also make modification of this style a pretty simple
+% matter.
+%
+% \spec{\item The contents of one name field
+% \item string toggle
+% (either {\tt firstinitial}, {\tt lastonly} or {\tt full})}
+% {\item A single string, containing a formatted name or names,
+% or {\tt empty\$}}
+% {\item {\bf firstinitial:} Yields the form ``F.~Bennett, Jr.''
+% \item {lastonly:}
+% Yields the form ``Bennett''
+% \item {\bf full:} yields ``Frank Bennett, Jr.''}
+%
+% \begin{macrocode}
+FUNCTION {format.names}
+ { swap$ duplicate$ empty$
+ { swap$ pop$ }
+ { 's :=
+ 'u :=
+ #1 'nameptr :=
+ s num.names$ 'numnames :=
+ numnames 'namesleft :=
+ { namesleft #0 > }
+ { u "lastonly" =
+ { s nameptr "{vv~}{ll}" format.name$ 't := }
+ { u "firstinitial" =
+ { s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't := }
+ { u "full" =
+ { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't :=}
+ { "style error; invalid or non-existent toggle" warning$ }
+ if$
+ }
+ if$
+ }
+ if$
+ nameptr #1 >
+ { namesleft #1 >
+ { ", " * t * }
+ { numnames #2 >
+ { "," * }
+ 'skip$
+ if$
+ t "others" =
+ { " et~al." * }
+ { " and " * t * }
+ if$
+ }
+ if$
+ }
+ 't
+ if$
+ nameptr #1 + 'nameptr :=
+ namesleft #1 - 'namesleft :=
+ }
+ while$
+ }
+ if$
+ }
+% \end{macrocode}
+%
+% \paragraph{Dates}
+% The style code for parsing and formatting dates is much more
+% complex than that for names. This is due to the need to
+% build the necessary tools out of \BibTeX\ primitives, since
+% no built-in tools for this task are supplied. There are
+% two date formatting routines below. The simpler of the two
+% is "format.month.year". This is basically just the function
+% supplied with the standard \BibTeX\ styles, under a new name.
+% The \LexiBib\ version of "format.date" is underpinned by
+% a whole set of new
+% functions, and allows great flexibility in the syntax
+% for entering dates.
+%
+% \subparagraph{Old format routine}
+%
+% \DescribeEnv{format.month.year}
+% The "format.date" function is for the month and year, but we
+% give a warning if
+% there's an empty year but the month is there, and we return the
+% empty string
+% if they're both empty.\footnote{This comment by Oren
+% Patashnik.}
+%
+% This is not changed over the "format.date" function in the
+% original standard \BibTeX{} styles. It is retained, although
+% the distributed \LexiBib\ styles won't be making use of it.
+%
+% \spec{\item none}
+% {\item A single string.}
+% {\item none}
+%
+% \begin{macrocode}
+ FUNCTION {format.month.year}
+ { year empty$
+ { month empty$
+ { "" }
+ { "there's a month but no year in " cite$ * warning$
+ month
+ }
+ if$
+ }
+ { month empty$
+ 'year
+ { month " " * year * }
+ if$
+ }
+ if$
+ }
+% \end{macrocode}
+%
+% \subparagraph{New date parsing routines}
+% The "format.date" function depends upon a number of
+% supporting functions. Some of these are of general utility,
+% and are presented above. Those presented here are specific
+% to this particular function.
+%
+% \DescribeEnv{fillout.a.year}
+% This adds a leading "19" to a year entered in two-digit
+% form.
+%
+% \spec{\item A single string.}
+% {\item A single string.}
+% {\item none}
+%
+% \begin{macrocode}
+FUNCTION {fillout.a.year}
+ { duplicate$ character.length #2 =
+ { "19" swap$ * }
+ 'skip$
+ if$
+ }
+% \end{macrocode}
+%
+% \DescribeEnv{parse.month}
+% This function is a simple parser, used in converting
+% database entries that have been identified as probable
+% abbreviated month entries into numerical string form.
+%
+% \spec{\item A single string, which should consist of
+% exactly three alphabetic characters.}
+% {\item A single string of numbers.}
+% {\item none}
+%
+% \begin{macrocode}
+FUNCTION {parse.month}
+ { duplicate$ "jan" =
+ { pop$ "1" }
+ { duplicate$ "feb" =
+ { pop$ "2" }
+ { duplicate$ "mar" =
+ { pop$ "3" }
+ { duplicate$ "apr" =
+ { pop$ "4" }
+ { duplicate$ "may" =
+ { pop$ "5" }
+ { duplicate$ "jun" =
+ { pop$ "6" }
+ { duplicate$ "jul" =
+ { pop$ "7" }
+ { duplicate$ "aug" =
+ { pop$ "8" }
+ { duplicate$ "sep" =
+ { pop$ "9" }
+ { duplicate$ "oct" =
+ { pop$ "10" }
+ { duplicate$ "nov" =
+ { pop$ "11" }
+ { duplicate$ "dec" =
+ { pop$ "12" }
+ { "invalid month in " cite$ * warning$
+ "passing text to Camel verbatim" warning$
+ "t" 'scrubdate :=
+ }if$
+ }if$
+ }if$
+ }if$
+ }if$
+ }if$
+ }if$
+ }if$
+ }if$
+ }if$
+ }if$
+ }if$
+ }
+% \end{macrocode}
+%
+%
+%
+% \DescribeEnv{format.month.name}
+% \changes{1994/08/09}{v1.0b}{Added {\tt swap\$} as appropriate
+% to expose string on stack for {\tt empty\$} check.}
+% This takes a numerical string and converts it to either an
+% abbrviated or a spelled-out month name.
+%
+% \spec{\item A toggle string.
+% \item A numerical string.}
+% {\item A string.}
+% {\item {long:} The month name placed on the stack will be
+% spelled out.
+% \item{short:} The month name will be abbreviated.}
+%
+% \begin{macrocode}
+FUNCTION { format.month.name }
+ { swap$ duplicate$ empty$
+ { pop$ pop$ "" }
+ { swap$ "long" =
+ { duplicate$ "1" =
+ { "January" }
+ { duplicate$ "2" =
+ { "February" }
+ { duplicate$ "3" =
+ { "March" }
+ { duplicate$ "4" =
+ { "April" }
+ { duplicate$ "5" =
+ { "May" }
+ { duplicate$ "6" =
+ { "June" }
+ { duplicate$ "7" =
+ { "July" }
+ { duplicate$ "8" =
+ { "August" }
+ { duplicate$ "9" =
+ { "September" }
+ { duplicate$ "10" =
+ { "October" }
+ { duplicate$ "11" =
+ { "November" }
+ { duplicate$ "12" =
+ { "December" }
+ { "invalid month in " cite$ * warning$ ""
+ "passing text to Camel verbatim" warning$
+ "t" 'scrubdate :=
+ }if$
+ }if$
+ }if$
+ }if$
+ }if$
+ }if$
+ }if$
+ }if$
+ }if$
+ }if$
+ }if$
+ }if$
+ }
+ { duplicate$ "1" =
+ { "Jan." }
+ { duplicate$ "2" =
+ { "Feb." }
+ { duplicate$ "3" =
+ { "Mar." }
+ { duplicate$ "4" =
+ { "Apr." }
+ { duplicate$ "5" =
+ { "May" }
+ { duplicate$ "6" =
+ { "Jun." }
+ { duplicate$ "7" =
+ { "Jul." }
+ { duplicate$ "8" =
+ { "Aug." }
+ { duplicate$ "9" =
+ { "Sept." }
+ { duplicate$ "10" =
+ { "Oct." }
+ { duplicate$ "11" =
+ { "Nov." }
+ { duplicate$ "12" =
+ { "Dec." }
+ { ""
+ }if$
+ }if$
+ }if$
+ }if$
+ }if$
+ }if$
+ }if$
+ }if$
+ }if$
+ }if$
+ }if$
+ }if$
+ }if$
+swap$ pop$
+ }if$
+ }
+% \end{macrocode}
+%
+% \DescribeEnv{extract.date}
+% This function takes a labelled stack of numeric items,
+% and places its contents in a formatted string on
+% the stack. It is a subroutine called by "format.date", and is
+% not intended for use directly in entry type functions.
+%
+% The behaviour of this function is a little too complex
+% to describe its input and output behaviour using our
+% usual description box, so we revert to prose here.
+% The expectation of what will appear on the
+% stack depends on the contents of the integer
+% variable "itemcount". For each date item counted, the
+% function expects to find two items on the stack: a
+% string possibly flagging the variable into which the
+% item should be placed; and a numerical string.
+%
+% If "itemcount" is "0", we check to see whether the streamlined
+% format for parallel citations has been used. If not, a warning
+% of an empty date is issued.
+%
+% If "itemcount" is "1", the flag string is ignored,
+% and the numerical item is assumed to be a year.
+%
+% If "itemcount" is "2", the flag strings are both
+% ignored, and the numerical items are assumed to be
+% a year and a month, in that order.
+%
+% If "itemcount" is "3", the first item is assumed to
+% be a year. The assignment of the second two items
+% depends first upon the contents of the integer
+% variable "date.specials". If this is "0", then
+% the flags are ignored, and the numerical items are
+% assumed to be a day and a month, in that order.
+% If "date.specials" is "1" (`true'), then the
+% flag of the first item is checked to see whether it
+% is ``"month"''. If so, the first item is assigned to
+% the "themonth" variable, and the next to the "theday"
+% variable. Otherwise the assignments are reversed.
+%
+% \begin{macrocode}
+FUNCTION {extract.date}
+ { 'v := "" 's := "" 't := "" 'u :=
+ itemcount #0 =
+ { cites empty$
+ { "some date or other is COMPLETELY empty in " cite$ *
+ warning$ }
+ 'skip$
+ if$
+ }
+ { itemcount #1 =
+ { pop$ fillout.a.year 's := "" 'u := "" 't := }
+ { itemcount #2 =
+ { pop$ swap$ pop$ swap$ duplicate$ character.length #4 =
+ { swap$ "--" swap$ * * 's := "" 't := }
+ { swap$ fillout.a.year 's := 't :=
+ }if$
+ "" 'u :=
+ }
+ { itemcount #3 =
+ { date.specials
+ { pop$ fillout.a.year 's :=
+ "month" =
+ { 't :=
+ pop$ 'u := }
+ { 'u :=
+ pop$ 't :=
+ }if$
+ }
+ { pop$ fillout.a.year 's :=
+ pop$ 'u :=
+ pop$ 't :=
+ }if$
+ }
+ { "too many items for date in " cite$ * warning$
+ }if$
+ }if$
+ }if$
+ }if$
+ v duplicate$ "month.dd.yy" =
+ { pop$ s ", " u "\ " t "long" format.month.name }
+ { duplicate$ "dd.month.yy" =
+ { pop$ s "\ " t "long" format.month.name "\ " u }
+ { duplicate$ "mo.dd.yy" =
+ { pop$ s ", " u "\ " t "short" format.month.name }
+ { duplicate$ "dd.mo.yy" =
+ { pop$ s "\ " t "short" format.month.name "\ " u }
+ { duplicate$ "dd.mm.yy" =
+ { pop$ s "/" t "/" u }
+ { duplicate$ "mm.dd.yy" =
+ { s "/" u "/" t }
+ { "yy" =
+ { "" "" "" "" s }
+ { "invalid date toggle in style file" warning$
+ }if$
+ }if$
+ }if$
+ }if$
+ }if$
+ }if$
+ }if$
+ "" 'v :=
+ duplicate$ empty$
+ { pop$ pop$ }
+ { swap$ * 'v := }
+ if$
+ duplicate$ empty$
+ { pop$ pop$ }
+ { swap$ * v swap$ * 'v := }
+ if$
+ duplicate$ empty$
+ { pop$ v }
+ { v swap$ * }
+ if$
+ }
+% \end{macrocode}
+%
+% \DescribeEnv{topup.date}
+% This is used to perform an addition operation on a
+% string of numerals.
+%
+% \spec{\item An integer to be added.
+% \item A string consisting of numerals only.}
+% {\item A string consisting of the sum of the integer and
+% the numeric string.}
+% {\item none}
+%
+% \begin{macrocode}
+FUNCTION {topup.date}
+ { 'a :=
+ duplicate$ character.length #2 =
+ { duplicate$ #1 #1 substring$ chr.to.int$ #48 -
+ times.ten swap$ #2 #1 substring$ chr.to.int$ #48 -
+ +
+ }
+ { duplicate$ character.length #1 =
+ { chr.to.int$ #48 - }
+ { pop$ #0 "I can't cope with more than two Japanese year digits in "
+ cite$ * warning$
+ }if$
+ }if$
+ a + int.to.str$
+ }
+% \end{macrocode}
+%
+% \DescribeEnv{format.jdate}
+% This rather specialized function converts a Japanese
+% Imperial date written
+% in a fixed syntax into the \LexiBib\ internal date stack,
+% for onward handling by "extract.date".
+%
+% \spec{\item A string in the form: {\tt s57.9.27}, where
+% the first letter indicates the Imperial reign of the year
+% given, the first numeric item is the year, the second the
+% month, and the third the day. Any non-alphabetic, non-numeric
+% character may be used as a separator.}
+% {\item {\tt itemcount} is set to {\tt 2} (one more is added
+% by the {\tt format.date} function in which is function is
+% nested).
+% \item Six stack items are output---see {\tt extract.date}
+% for details on stack syntax.}
+% {\item none}
+%
+% \begin{macrocode}
+FUNCTION {format.jdate}
+ { duplicate$ #2 global.max$ substring$ "*" "forward" gather.chars
+ pop$ 't := swap$
+ #1 #1 substring$ duplicate$ "s" =
+ { pop$ t #1925 topup.date }
+ { duplicate$ "m" =
+ { pop$ t #1867 topup.date }
+ { duplicate$ "t" =
+ { pop$ t #1911 topup.date }
+ { "h" =
+ { t #1988 topup.date }
+ { "invalid Imperial calendar code in " cite$ * warning$
+ }if$
+ }if$
+ }if$
+ }if$
+ swap$
+ "*" "forward" gather.chars
+ pop$ swap$
+ "*" "forward" gather.chars
+ pop$ swap$ pop$ 't := swap$ "default" swap$ t swap$ "default"
+ swap$ "default"
+ #2 'itemcount :=
+ }
+% \end{macrocode}
+%
+% \DescribeEnv{format.date}
+% This function makes use of "gather.chars" and other supporting
+% functions to build a stack of date items, which it then parses
+% using "extract.date". The syntax for entering dates is
+% described in the user guide.
+%
+% \spec{\item A single string in appropriate date syntax.}
+% {\item none}
+% {\item none}
+%
+% \begin{macrocode}
+FUNCTION {format.date}
+ { 'v :=
+ empty.to.null 's :=
+ #0 'charcount :=
+ #0 'itemcount :=
+ #0 'date.specials :=
+ { s empty$ not }
+ { s "*" "forward" gather.chars
+ duplicate$ "letter" =
+ { pop$ duplicate$ character.length #1 = itemcount not and
+ { pop$ pop$ s format.jdate "" 's := }
+ { duplicate$ character.length #3 =
+ { swap$ 's :=
+ parse.month "month" #1 'date.specials := }
+ { swap$ 's :=
+ pop$ "1" "invalid date in " cite$ * warning$
+ "passing text to Camel verbatim" warning$
+ "t" 'scrubdate :=
+ "default"
+ }if$
+ }if$
+ }
+ { "numeral" =
+ { duplicate$ character.length #1 =
+ { swap$ 's := "default" }
+ { duplicate$ character.length #2 =
+ { swap$ 's := "default" }
+ { duplicate$ character.length #4 =
+ { swap$ 's := "default" }
+ { swap$ 's := pop$ "1"
+ "invalid numerical element in date for " cite$ * warning$
+ "passing text to Camel verbatim" warning$
+ "t" 'scrubdate :=
+ "default"
+ }if$
+ }if$
+ }if$
+ }
+ { swap$ 's := pop$ "1"
+ "failed to parse date in " cite$ * warning$
+ "default"
+ }if$
+ }if$
+ itemcount #1 + 'itemcount :=
+ }while$
+ v extract.date
+ scrubdate "t" =
+ { pop$ year empty.to.null }
+ 'skip$
+ if$
+ }
+% \end{macrocode}
+% Anyways, here's that line noise. Extracts cite info to variables
+% from a parseable string on the stack. Syntax is:
+%
+%\begin{tabular}{ccccccc}
+% year & volume & / & number & journal name & pages & (year)\\
+% "^" & "^" &"^"& "^" & "^" & "^" & "^"\\
+% OPT & OPT &OPT& OPT & REQ & OPT & OPT\\
+%\end{tabular}
+%
+% You can give a volume without a number (i.e. the backslash
+% and trailing number can be left out).
+% \begin{macrocode}
+FUNCTION {parse.one.cite}
+{ duplicate$ "=" = not
+ { "=" "forward" gather.chars pop$
+ duplicate$ "[" swap$ "forward" first.in.second
+ { swap$ duplicate$ "]" swap$ "forward" first.in.second
+ { "" 'volume.var :=
+ 'b := swap$ 'a := a b <
+ { duplicate$ a #1 + b a #1 + - substring$
+ 'year.var :=
+ b #1 + global.max$ substring$
+ " " "forward" gather.chars pop$
+ duplicate$ "*" "forward" gather.chars
+ "numeral" =
+ { swap$ duplicate$ empty$
+ { pop$ pop$ 'number.var := }
+ { pop$ pop$ swap$ * "" 'number.var :=
+ }if$
+ }
+ { pop$ pop$ " " swap$ * swap$ * "" 'number.var :=
+ }if$
+ }
+ { "Weird syntax error in " cite$ * warning$
+ }if$
+ }
+ { "Opening [ without closing ] in " cite$ * warning$
+ }if$
+ }
+ { pop$ duplicate$ ")" swap$ "reverse" first.in.second
+ { swap$ duplicate$ "(" swap$ "reverse" first.in.second
+ { 'a := swap$ 'b := a b <
+ { duplicate$ a #1 + b a #1 + - substring$
+ 'year.var :=
+ #1 a #1 - substring$
+ " " "forward" gather.chars pop$
+ duplicate$ "/" swap$ "forward" first.in.second
+ { pop$ "/" "forward" gather.chars pop$
+ swap$ duplicate$ empty$
+ { pop$ "" 'number.var := }
+ { #2 global.max$ substring$
+ 'number.var :=
+ }if$
+ }
+ { pop$ "" 'number.var :=
+ }if$
+ duplicate$ empty$
+ { pop$ "" 'volume.var := }
+ { duplicate$ "*" "forward" gather.chars
+ "numeral" =
+ { swap$ duplicate$ empty$
+ { pop$ pop$ 'volume.var := }
+ { pop$ pop$ swap$ * "" 'volume.var :=
+ }if$
+ }
+ { pop$ pop$ " " swap$ * swap$ * "" 'volume.var :=
+ }if$
+ }if$
+ }
+ { "Weird syntax error in " cite$ * warning$
+ }if$
+ }
+ { "Closing ) without opening ( in " cite$ * warning$
+ }if$
+ }
+ { pop$ "No recognizable date in string in " cite$ * warning$
+ }if$
+ }if$
+ " " swap$ * " " "reverse" gather.chars pop$
+ duplicate$ "*" "forward" gather.chars
+ "numeral" =
+ { swap$ duplicate$ empty$
+ { pop$ pop$ 'pages.var := }
+ { pop$ pop$ swap$ * "" 'pages.var :=
+ }if$
+ }
+ { pop$ pop$ swap$ * "" 'pages.var :=
+ }if$
+ duplicate$ empty$
+ { 'journal.var := }
+ { duplicate$ character.length #2 -
+ #3 swap$ substring$ 'journal.var :=
+ }if$
+ }
+ 'skip$
+ if$
+}
+%</bstlibrary>
+% \end{macrocode}
+% \begin{macrocode}
+%<*bsttrailer>
+FUNCTION {sortify}
+{ purify$
+ "l" change.case$
+}
+
+INTEGERS { len }
+
+FUNCTION {chop.word}
+{ 's :=
+ 'len :=
+ s #1 len substring$ =
+ { s len #1 + global.max$ substring$ }
+ 's
+ if$
+}
+
+INTEGERS { et.al.char.used }
+
+FUNCTION {initialize.et.al.char.used}
+{ #0 'et.al.char.used :=
+}
+
+EXECUTE {initialize.et.al.char.used}
+
+FUNCTION {format.lab.names}
+{ 's :=
+ s num.names$ 'numnames :=
+ numnames #1 >
+ { numnames #4 >
+ { #3 'namesleft := }
+ { numnames 'namesleft := }
+ if$
+ #1 'nameptr :=
+ ""
+ { namesleft #0 > }
+ { nameptr numnames =
+ { s nameptr "{ff }{vv }{ll}{ jj}" format.name$ "others" =
+ { "{\etalchar{+}}" *
+ #1 'et.al.char.used :=
+ }
+ { s nameptr "{v{}}{l{}}" format.name$ * }
+ if$
+ }
+ { s nameptr "{v{}}{l{}}" format.name$ * }
+ if$
+ nameptr #1 + 'nameptr :=
+ namesleft #1 - 'namesleft :=
+ }
+ while$
+ numnames #4 >
+ { "{\etalchar{+}}" *
+ #1 'et.al.char.used :=
+ }
+ 'skip$
+ if$
+ }
+ { s #1 "{v{}}{l{}}" format.name$
+ duplicate$ text.length$ #2 <
+ { pop$ s #1 "{ll}" format.name$ #3 text.prefix$ }
+ 'skip$
+ if$
+ }
+ if$
+}
+
+FUNCTION {author.key.label}
+{ author empty$
+ { key empty$
+ { cite$ #1 #3 substring$ }
+ { key #3 text.prefix$ }
+ if$
+ }
+ { author format.lab.names }
+ if$
+}
+
+FUNCTION {author.editor.key.label}
+{ author empty$
+ { editor empty$
+ { key empty$
+ { cite$ #1 #3 substring$ }
+ { key #3 text.prefix$ }
+ if$
+ }
+ { editor format.lab.names }
+ if$
+ }
+ { author format.lab.names }
+ if$
+}
+
+FUNCTION {author.key.organization.label}
+{ author empty$
+ { key empty$
+ { organization empty$
+ { cite$ #1 #3 substring$ }
+ { "The " #4 organization chop.word #3 text.prefix$ }
+ if$
+ }
+ { key #3 text.prefix$ }
+ if$
+ }
+ { author format.lab.names }
+ if$
+}
+
+FUNCTION {editor.key.organization.label}
+{ editor empty$
+ { key empty$
+ { organization empty$
+ { cite$ #1 #3 substring$ }
+ { "The " #4 organization chop.word #3 text.prefix$ }
+ if$
+ }
+ { key #3 text.prefix$ }
+ if$
+ }
+ { editor format.lab.names }
+ if$
+}
+
+FUNCTION {calc.label}
+{ type$ "book" =
+ type$ "inbook" =
+ or
+ 'author.editor.key.label
+ { type$ "proceedings" =
+ 'editor.key.organization.label
+ { type$ "manual" =
+ 'author.key.organization.label
+ 'author.key.label
+ if$
+ }
+ if$
+ }
+ if$
+ duplicate$
+ year "yy" format.date purify$ #-1 #2 substring$
+ *
+ 'label :=
+ year "yy" format.date purify$ #-1 #4 substring$
+ *
+ sortify 'sort.label :=
+}
+
+FUNCTION {sort.format.names}
+{ 's :=
+ #1 'nameptr :=
+ ""
+ s num.names$ 'numnames :=
+ numnames 'namesleft :=
+ { namesleft #0 > }
+ { nameptr #1 >
+ { " " * }
+ 'skip$
+ if$
+ s nameptr "{vv{ } }{ll{ }}{ ff{ }}{ jj{ }}" format.name$ 't :=
+ nameptr numnames = t "others" = and
+ { "et al" * }
+ { t sortify * }
+ if$
+ nameptr #1 + 'nameptr :=
+ namesleft #1 - 'namesleft :=
+ }
+ while$
+}
+
+FUNCTION {sort.format.title}
+{ 't :=
+ "A " #2
+ "An " #3
+ "The " #4 t chop.word
+ chop.word
+ chop.word
+ sortify
+ #1 global.max$ substring$
+}
+
+FUNCTION {author.sort}
+{ author empty$
+ { key empty$
+ { "to sort, need author or key in " cite$ * warning$
+ ""
+ }
+ { key sortify }
+ if$
+ }
+ { author sort.format.names }
+ if$
+}
+
+FUNCTION {case.sort}
+{ title empty$
+ { key empty$
+ { "to sort, need title or key in " cite$ * warning$
+ ""
+ }
+ { key sortify }
+ if$
+ }
+ { title sort.format.title }
+ if$
+}
+
+FUNCTION {author.editor.sort}
+{ author empty$
+ { editor empty$
+ { key empty$
+ { "to sort, need author, editor, or key in " cite$ * warning$
+ ""
+ }
+ { key sortify }
+ if$
+ }
+ { editor sort.format.names }
+ if$
+ }
+ { author sort.format.names }
+ if$
+}
+
+FUNCTION {author.organization.sort}
+{ author empty$
+ { organization empty$
+ { key empty$
+ { "to sort, need author, organization, or key in " cite$ * warning$
+ ""
+ }
+ { key sortify }
+ if$
+ }
+ { "The " #4 organization chop.word sortify }
+ if$
+ }
+ { author sort.format.names }
+ if$
+}
+
+FUNCTION {editor.organization.sort}
+{ editor empty$
+ { organization empty$
+ { key empty$
+ { "to sort, need editor, organization, or key in " cite$ * warning$
+ ""
+ }
+ { key sortify }
+ if$
+ }
+ { "The " #4 organization chop.word sortify }
+ if$
+ }
+ { editor sort.format.names }
+ if$
+}
+
+FUNCTION {presort}
+{ type$ "book" =
+ type$ "inbook" =
+ or
+ 'author.editor.sort
+ { type$ "proceedings" =
+ 'editor.organization.sort
+ { type$ "manual" =
+ 'author.organization.sort
+ { type$ "case" =
+ 'case.sort
+ { type$ "statute" =
+ 'case.sort
+ 'author.sort
+ if$
+ }
+ if$
+ }
+ if$
+ }
+ if$
+ }
+ if$
+ " "
+ *
+ year "yy" format.date sortify
+ *
+ " "
+ *
+ title empty.to.null
+ sort.format.title
+ *
+ #1 entry.max$ substring$
+ 'sort.key$ :=
+}
+
+ITERATE {presort}
+
+SORT
+
+FUNCTION {begin.bib}
+{ et.al.char.used
+ { "\newcommand{\etalchar}[1]{$^{#1}$}" write$ newline$ }
+ 'skip$
+ if$
+ preamble$ empty$
+ 'skip$
+ { preamble$ write$ newline$ }
+ if$
+}
+
+EXECUTE {begin.bib}
+
+ITERATE {call.type$}
+%</bsttrailer>
+% \end{macrocode}
+% \section{A {\tt .bib} file}
+% \begin{macrocode}
+%<*bib>
+@string{asr..="Am.~Soc.\ Rev."}
+@book{bluebook,
+ title = {A Uniform System of Citation},
+ edition = {19th},
+ year = 1989
+}
+@book{knuth,
+ title = {The {\TeX} book},
+ year = 1990,
+ author = {D.E. Knuth}
+}
+@book{leunen,
+ author = {M.-C. van Leunen},
+ title = {A Handbook for Scholars},
+ year = 1979
+}
+@book{latex-book,
+ title = {\LaTeX: a document preparation system},
+ year = 1994,
+ author = {Leslie Lamport}
+}
+@inbook{companion-bibs,
+ title = {Bibliography Generation},
+ chapter = 13,
+ pages = {371},
+ crossref = {latex-companion}
+}
+@book{latex-companion,
+ author = {M. Goosens and Frank Mittelbach and A. Samarin},
+ title = {The \LaTeX\ Companion},
+ booktitle = {The \LaTeX\ Companion},
+ year = 1994
+}
+@techreport{oren-user,
+ author = {Oren Patashnik},
+ title = {\BibTeX ing},
+ year = 1988,
+ type = {CTAN document}
+}
+@techreport{oren-hackers,
+ author = {Oren Patashnik},
+ title = {Designing \BibTeX\ Styles},
+ type = {CTAN document},
+ year = 1988
+}
+@book{maki-constitution,
+ author = {Maki, John McGilvrey},
+ title = {Court and Constitution in Japan: Selected Supreme Court Decisions,
+ 1948-1960},
+ publisher = {Washington University Press},
+ year = 1964
+}
+@booklet{sansom-constitution,
+ author = {Sansom, {Sir} George Bailey},
+ title = {The First Japanese Constitution: A Lecture},
+ note = {delivered before the
+ Asiatic Society of Japan},
+ year = 1938
+}
+@article{macauley,
+ author = {Stuart Macauley},
+ title = {Non-Contractual Relations
+in Business: A Preliminary Study},
+ volume = {28},
+ journal = asr..,
+ pages = {55},
+ year = {1963}
+}
+@mastersthesis{homma-derivative,
+ title = {The Derivative Suit under Japanese Law as a Measure of
+ Corporate Governance},
+ author = {Masahiro Homma},
+ institution = {School of Oriental and African Studies},
+ type = {LL.M. thesis},
+ year = {1994}
+}
+@case{bradshaw-v-us,
+ title = {Bradshaw v United States},
+ cites = {231 Ct.Cl. 144 (1982) = 683 F.2d 365 (1982)}
+}
+@incollection{haley-land-lease,
+ title = {Japan's New Land and House Lease Law},
+ author = {John Owen Haley},
+ crossref = {policy-failure},
+ pages = 149,
+}
+@book{policy-failure,
+ title = {Land Issues in Japan: A Policy Failure?},
+ booktitle = {Land Issues in Japan: A Policy Failure?},
+ year = 1992
+}
+@article{appleyard-heed,
+ author = {Bryan Appleyard},
+ title = {Why Major should heed the press},
+ pages = 21,
+ journal = {The Independent},
+ year = {7 jul 1995},
+ place = {London}
+}
+@statute{sga,
+ title = {Sale of Goods Act},
+ year = {1979},
+ jurisdiction = {england}
+}
+@case{heap,
+ title = {Heap v Motorists' Advisory Agency Ltd},
+ year = 1923,
+ journal = {KB},
+ number = 1,
+ pages = 577
+}
+@case{halsall-v-brizell,
+ title = {Halsall v Brizell},
+ cites = {[1957] Ch 169 = [1957] 1 All ER 371}
+}
+%</bib>
+% \end{macrocode}
+% \section{The Driver File}
+% \begin{macrocode}
+%<*installer>
+\def\batchfile{camel.ins}
+\input docstrip.tex
+\preamble
+
+Copyright (C) 1992--95 Frank Bennett, Jr.
+All rights reserved.
+
+This file is part of the Camel package.
+\endpreamble
+
+\def\batchfile{camel.dst} % ignored in distribution
+\input docstrip.tex % ignored in distribution
+
+\Ask\answer{%
+ **************************************************************
+ ^^J* PLEASE NOTE
+ ^^J*
+ ^^J* Camel requires a large BibTeX, with a wizard-defined
+ ^^J* function space of over 6,000. The function space in
+ ^^J* standard BibTeX is only 3,000, so if your BibTeX has never
+ ^^J* been enlarged, it will probably need to be recompiled.
+ ^^J*
+ ^^J* If this seems terribly cryptic, just go ahead and give
+ ^^J* it a go. Feel free to write me on fb@soas.ac.uk if you
+ ^^J* have problems.
+ ^^J*
+ ^^J* In addition to camel.dtx, you will also need the keyval
+ ^^J* and overword packages, also available from CTAN. You
+ ^^J* should have an up-to-date copy of index.dtx as well.
+ ^^J*
+ ^^J* Also, to print the .dtx files in the Camel bundle, you
+ ^^J* should use the usual gind.ist file for making the indexes;
+ ^^J* camel.ist is used for special purposes outlined in the
+ ^^J* manual.
+ ^^J*
+ ^^J* Shall I unpack my things?
+ ^^J*
+ ^^J* If you want me to go ahead, answer `y' below, otherwise `n'.
+ ^^J*
+ ^^J**************************************************************}
+
+\keepsilent
+
+\preamble
+
+This file is part of the Camel package.
+---------------------------------------
+This is a generated file.
+
+IMPORTANT NOTICE:
+
+You are not allowed to change this file. You may however copy
+this file to a file with a different name and then change the
+copy if (a) you do not charge for the modified code, (b) you
+acknowledge Camel and its author(s) in the new file, if it
+is distributed to others, and (c) you attach these same
+conditions to the new file.
+
+The above conditions do not apply to the demonstration
+file test.tex.
+
+You are not allowed to distribute this file alone. You are not
+allowed to take money for the distribution or use of this file
+(or a changed version) except for a nominal charge for copying
+etc.
+
+You are allowed to distribute this file under the condition that
+it is distributed with all of its contents, intact.
+
+For error reports, or offers to help make Camel a more powerful,
+friendlier, and better package, please contact me on
+`fb' at soas.ac.uk
+
+\endpreamble
+
+
+{\ifx\answer\y
+
+\generate{\file{camel.sty} {\from{camel.dtx}{lexitex}}
+ \file{camel.ist} {\from{camel.dtx}{camelindex}}
+ \file{camel.bib} {\from{camel.dtx}{bib}}
+ \file{test.tex} {\from{camel.dtx}{testtex}}}
+
+\fi}
+
+\keepsilent
+
+
+\ifToplevel{
+\Msg{***********************************************************}
+\Msg{*}
+\Msg{* To finish the installation, you have to move the following}
+\Msg{* file into a directory searched by TeX:}
+\Msg{*}
+\Msg{* \space\space camel.sty}
+\Msg{*}
+\Msg{* You also need to move the following file into a directory}
+\Msg{* searched by makeindex:}
+\Msg{*}
+\Msg{* \space\space camel.ist}
+\Msg{*}
+\Msg{* Note that Camel does not work by itself; style modules}
+\Msg{* (such as law.dtx) are supplied separately. They can}
+\Msg{* be found on CTAN in the Camel subdirectory.}
+\Msg{*}
+\Msg{***********************************************************}
+}
+%</installer>
+% \end{macrocode}
+% \begin{macrocode}
+%<*testtex>
+\documentclass{article}
+\usepackage{camel}
+
+%<+testtex>%\citationsubject[o=sta,i=stb]{statutes}{Statutory Materials}
+%<+testtex>%\citationsubject[o=sec,i=seb]{second}{Secondary Literature}
+%<+testtex>%\citationsubject[o=cas,i=cab]{case}{Cases}
+
+\begin{document}
+\citationstyle{law}
+\citationdata{camel}
+
+\section*{{\sc Camel} tests and examples\footnotemark{}{} }
+\footnotetext{Note that, in addition to admiring the examples in
+ this document, you can tinker with it to produce different
+ kinds of bibliographies. See the comments in the file for
+ suggestions.}
+
+
+We currently have support for articles (including newspaper
+articles), items in collections of
+essays, books, sections of books, ephemeral booklets, masters theses,
+Commonwealth, US and Japanese cases, and statutes from a few
+jurisdictions. An example of each is given below, first without,
+then with a pinpoint. This does not give a complete picture of
+the `formatting tree', it''s just a sample.
+
+\begin{itemize}
+\item Ordinary articles
+ \begin{itemize}
+ \item \source[s=second]{macauley}
+ \item \source[f,s=second]{macauley}[56]
+ \end{itemize}
+\item Newspaper articles
+ \begin{itemize}
+ \item \source[s=second]{appleyard-heed}
+ \item \source[f,s=second]{appleyard-heed}[21] (A silly example,
+ since there's only one page to the piece!)
+ \end{itemize}
+\item Articles in collections of essays
+ \begin{itemize}
+ \item \source[s=second]{haley-land-lease}
+ \item \source[f,s=second]{haley-land-lease}[152]
+ \end{itemize}
+\item Books
+ \begin{itemize}
+ \item \source[f,s=second]{latex-companion}
+ \item \source[f,s=second]{latex-companion}[371]
+ \end{itemize}
+\item Sections of books
+ \begin{itemize}
+ \item \source[f,s=second]{companion-bibs}
+ \item \source[f,s=second]{companion-bibs}[374-75] (The BibTeX{}
+ processing flow shown here is simplified for {\sc Camel} users)
+ \end{itemize}
+\item Ephemeral booklets
+ \begin{itemize}
+ \item \source[f,s=second]{sansom-constitution}
+ \item \source[f,s=second]{sansom-constitution}[2]
+ \end{itemize}
+\item Masters theses
+ \begin{itemize}
+ \item \source[f,s=second]{homma-derivative}
+ \item \source[f,s=second]{homma-derivative}[23]
+ \end{itemize}
+\item Commonwealth law cases
+ \begin{itemize}
+ \item \source[f,s=case]{heap}
+ \item \source[f,s=case]{heap}[578]\footnote{Notice how the
+ pinpointed citation gives only as many parallel as are
+ specified in the pinpoint. Compare this with the next example.}
+ \end{itemize}
+\item US law cases
+ \begin{itemize}
+ \item \source[f,s=case]{bradshaw-v-us}
+ \item \source[f,s=case]{bradshaw-v-us}[145=366]
+ \end{itemize}
+\end{itemize}
+Titles that end in a numeral are a special treat. {\sc Camel}
+is not tricked by them.
+\begin{itemize}
+ \item \source[s=statutes]{maki-constitution}[23]
+ \item \source[f,s=statutes]{maki-constitution}
+\end{itemize}
+Selective suppression of author, title, or the entire citation is
+supported.
+\begin{itemize}
+ \item \source[a,f,s=second]{homma-derivative}
+ \item \source[t,f,s=second]{homma-derivative}
+ \item \source[n,s=second]{homma-derivative} (invisible)
+\end{itemize}
+
+%<+testtex>% If you uncomment the \citationsubject lines above,
+%<+testtex>% you can comment out the `all' entry below, run
+%<+testtex>% makeindex in the appropriate way over the output
+%<+testtex>% files, uncomment the three special bibliography
+%<+testtex>% declarations below, and print a whole different sort
+%<+testtex>% of document. There are a few bugs in the way
+%<+testtex>% bibliographies are set up. Sorting them out will
+%<+testtex>% best be done once BibTeX 1.0 is available, since
+%<+testtex>% integrating with the new BibTeX will affect the same
+%<+testtex>% portions of the code.
+\printbibliography[labels=false]{all}
+%<+testtex>%\printbibliography{statutes}
+%<+testtex>%\printbibliography{case}
+%<+testtex>%\printbibliography{second}
+\end{document}
+%</testtex>
+% \end{macrocode}
+% \Finale \PrintChanges
diff --git a/macros/latex/contrib/camel/camel.ins b/macros/latex/contrib/camel/camel.ins
new file mode 100644
index 0000000000..d904ed72d2
--- /dev/null
+++ b/macros/latex/contrib/camel/camel.ins
@@ -0,0 +1,126 @@
+%%
+%% This is file `camel.ins',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% camel.dtx (with options: `installer')
+%%
+%% IMPORTANT NOTICE:
+%%
+%% For the copyright see the source file.
+%%
+%% You are *not* allowed to modify this file.
+%%
+%% You are *not* allowed to distribute this file.
+%% For distribution of the original source see
+%% the terms for copying and modification in the file camel.dtx.
+%%
+\def\batchfile{camel.ins}
+\input docstrip.tex
+\preamble
+
+Copyright (C) 1992--95 Frank Bennett, Jr.
+All rights reserved.
+
+This file is part of the Camel package.
+\endpreamble
+
+\def\batchfile{camel.dst} % ignored in distribution
+\input docstrip.tex % ignored in distribution
+
+\Ask\answer{%
+ **************************************************************
+ ^^J* PLEASE NOTE
+ ^^J*
+ ^^J* Camel requires a large BibTeX, with a wizard-defined
+ ^^J* function space of over 6,000. The function space in
+ ^^J* standard BibTeX is only 3,000, so if your BibTeX has never
+ ^^J* been enlarged, it will probably need to be recompiled.
+ ^^J*
+ ^^J* If this seems terribly cryptic, just go ahead and give
+ ^^J* it a go. Feel free to write me on fb@soas.ac.uk if you
+ ^^J* have problems.
+ ^^J*
+ ^^J* In addition to camel.dtx, you will also need the keyval
+ ^^J* and overword packages, also available from CTAN. You
+ ^^J* should have an up-to-date copy of index.dtx as well.
+ ^^J*
+ ^^J* Also, to print the .dtx files in the Camel bundle, you
+ ^^J* should use the usual gind.ist file for making the indexes;
+ ^^J* camel.ist is used for special purposes outlined in the
+ ^^J* manual.
+ ^^J*
+ ^^J* Shall I unpack my things?
+ ^^J*
+ ^^J* If you want me to go ahead, answer `y' below, otherwise `n'.
+ ^^J*
+ ^^J**************************************************************}
+
+\keepsilent
+
+\preamble
+
+This file is part of the Camel package.
+---------------------------------------
+This is a generated file.
+
+IMPORTANT NOTICE:
+
+You are not allowed to change this file. You may however copy
+this file to a file with a different name and then change the
+copy if (a) you do not charge for the modified code, (b) you
+acknowledge Camel and its author(s) in the new file, if it
+is distributed to others, and (c) you attach these same
+conditions to the new file.
+
+The above conditions do not apply to the demonstration
+file test.tex.
+
+You are not allowed to distribute this file alone. You are not
+allowed to take money for the distribution or use of this file
+(or a changed version) except for a nominal charge for copying
+etc.
+
+You are allowed to distribute this file under the condition that
+it is distributed with all of its contents, intact.
+
+For error reports, or offers to help make Camel a more powerful,
+friendlier, and better package, please contact me on
+`fb' at soas.ac.uk
+
+\endpreamble
+
+{\ifx\answer\y
+
+\generate{\file{camel.sty} {\from{camel.dtx}{lexitex}}
+ \file{camel.ist} {\from{camel.dtx}{camelindex}}
+ \file{camel.bib} {\from{camel.dtx}{bib}}
+ \file{test.tex} {\from{camel.dtx}{testtex}}}
+
+\fi}
+
+\keepsilent
+
+\ifToplevel{
+\Msg{***********************************************************}
+\Msg{*}
+\Msg{* To finish the installation, you have to move the following}
+\Msg{* file into a directory searched by TeX:}
+\Msg{*}
+\Msg{* \space\space camel.sty}
+\Msg{*}
+\Msg{* You also need to move the following file into a directory}
+\Msg{* searched by makeindex:}
+\Msg{*}
+\Msg{* \space\space camel.ist}
+\Msg{*}
+\Msg{* Note that Camel does not work by itself; style modules}
+\Msg{* (such as law.dtx) are supplied separately. They can}
+\Msg{* be found on CTAN in the Camel subdirectory.}
+\Msg{*}
+\Msg{***********************************************************}
+}
+\endinput
+%%
+%% End of file `camel.ins'.
diff --git a/macros/latex/contrib/camel/index.dtx b/macros/latex/contrib/camel/index.dtx
new file mode 120000
index 0000000000..c65129de87
--- /dev/null
+++ b/macros/latex/contrib/camel/index.dtx
@@ -0,0 +1 @@
+../index/index.dtx \ No newline at end of file
diff --git a/macros/latex/contrib/camel/index.ins b/macros/latex/contrib/camel/index.ins
new file mode 120000
index 0000000000..bdf06ff720
--- /dev/null
+++ b/macros/latex/contrib/camel/index.ins
@@ -0,0 +1 @@
+../index/index.ins \ No newline at end of file
diff --git a/macros/latex/contrib/camel/law.dtx b/macros/latex/contrib/camel/law.dtx
new file mode 100644
index 0000000000..b88eb650c3
--- /dev/null
+++ b/macros/latex/contrib/camel/law.dtx
@@ -0,0 +1,1774 @@
+% \iffalse
+%<*driver>
+\documentclass{ltxdoc}
+\usepackage{camel}
+\usepackage{array}
+
+\def\fileversion{0.1d}
+\def\filedate{1997/01/09}
+\def\docdate {1997/01/09}
+
+\EnableCrossrefs
+\RecordChanges % Gather update information
+\CodelineIndex % Index code by line number
+%\OnlyDescription % comment out for implementation details
+\let\lawhline=\hline
+\begin{document}
+\citationstyle{law}
+\citationdata{camel}
+\title{The {\sc Law} module for the {\sc Camel} Bibliography
+ Engine\thanks{%
+ This file has version number \fileversion{} dated
+ \filedate{}.
+ The documentation was last revised on \docdate.
+ The documentation and the code for {\sc Camel}
+ are \copyright{} 1992--95 Frank Bennett, Jr. Distribution
+ and use are freely welcomed, on the sole condition that
+ acknowledgement of the {\sc Camel} package, its {\sc Law}
+ module and of their author
+ be made in any published using these utilities.
+ }}
+\author{Frank G Bennett, Jr.\thanks{Lecturer in the Commercial
+ Laws of the Far East, School of
+ Oriental and African Studies, University of London.
+ Acknowledgements of the numerous people who have provided
+ comments and suggestions in the development of this module
+ and of the {\sc Camel} package itself are listed in the users'
+ guide to that software.}}
+\maketitle
+\DocInput{law.dtx}
+\end{document}
+%</driver>
+% \fi
+% \CheckSum{741}
+%
+%\iffalse
+%
+% Copyright (C) 1992-1995 by Frank Bennett. All rights reserved.
+%
+% IMPORTANT NOTICE:
+%
+% You are not allowed to change this file. You may however copy
+% this file to a file with a different name and then change the
+% copy if (a) you do not charge for the modified code, (b) you
+% acknowledge Camel and its author(s) in the new file, if it
+% is distributed to others, and (c) you attach these same
+% conditions to the new file.
+%
+% You are not allowed to distribute this file alone. You are not
+% allowed to take money for the distribution or use of this file
+% (or a changed version) except for a nominal charge for copying
+% etc.
+%
+% You are allowed to distribute this file under the condition that
+% it is distributed with all of its contents, intact.
+%
+% For error reports, or offers to help make Camel a more powerful,
+% friendlier, and altogether more thrilling package, please contact me on
+% fb@soas.ac.uk
+%
+%\fi
+%
+%
+% \DoNotIndex{\@,\@@par,\@beginparpenalty,\@empty}
+% \DoNotIndex{\@flushglue,\@gobble,\@input}
+% \DoNotIndex{\@makefnmark,\@makeother,\@maketitle}
+% \DoNotIndex{\@namedef,\@ne,\@spaces,\@tempa}
+% \DoNotIndex{\@tempb,\@tempswafalse,\@tempswatrue}
+% \DoNotIndex{\@thanks,\@thefnmark,\@topnum}
+% \DoNotIndex{\@@,\@elt,\@forloop,\@fortmp,\@gtempa,\@totalleftmargin}
+% \DoNotIndex{\",\/,\@ifundefined,\@nil,\@verbatim,\@vobeyspaces}
+% \DoNotIndex{\|,\~,\ ,\active,\advance,\aftergroup,\begingroup,\bgroup}
+% \DoNotIndex{\cal,\csname,\def,\documentstyle,\dospecials,\edef}
+% \DoNotIndex{\egroup}
+% \DoNotIndex{\else,\endcsname,\endgroup,\endinput,\endtrivlist}
+% \DoNotIndex{\expandafter,\fi,\fnsymbol,\futurelet,\gdef,\global}
+% \DoNotIndex{\hbox,\hss,\if,\if@inlabel,\if@tempswa,\if@twocolumn}
+% \DoNotIndex{\ifcase}
+% \DoNotIndex{\ifcat,\iffalse,\ifx,\ignorespaces,\index,\input,\item}
+% \DoNotIndex{\jobname,\kern,\leavevmode,\leftskip,\let,\llap,\lower}
+% \DoNotIndex{\m@ne,\next,\newpage,\nobreak,\noexpand,\nonfrenchspacing}
+% \DoNotIndex{\obeylines,\or,\protect,\raggedleft,\rightskip,\rm,\sc}
+% \DoNotIndex{\setbox,\setcounter,\small,\space,\string,\strut}
+% \DoNotIndex{\strutbox}
+% \DoNotIndex{\thefootnote,\thispagestyle,\topmargin,\trivlist,\tt}
+% \DoNotIndex{\twocolumn,\typeout,\vss,\vtop,\xdef,\z@}
+% \DoNotIndex{\,,\@bsphack,\@esphack,\@noligs,\@vobeyspaces,\@xverbatim}
+% \DoNotIndex{\`,\catcode,\end,\escapechar,\frenchspacing,\glossary}
+% \DoNotIndex{\hangindent,\hfil,\hfill,\hskip,\hspace,\ht,\it,\langle}
+% \DoNotIndex{\leaders,\long,\makelabel,\marginpar,\markboth,\mathcode}
+% \DoNotIndex{\mathsurround,\mbox,\newcount,\newdimen,\newskip}
+% \DoNotIndex{\nopagebreak}
+% \DoNotIndex{\parfillskip,\parindent,\parskip,\penalty,\raise,\rangle}
+% \DoNotIndex{\section,\setlength,\TeX,\topsep,\underline,\unskip,\verb}
+% \DoNotIndex{\vskip,\vspace,\widetilde,\\,\%,\@date,\@defpar}
+% \DoNotIndex{\[,\{,\},\]}
+% \DoNotIndex{\count@,\ifnum,\loop,\today,\uppercase,\uccode}
+% \DoNotIndex{\baselineskip,\begin,\tw@}
+% \DoNotIndex{\a,\b,\c,\d,\e,\f,\g,\h,\i,\j,\k,\l,\m,\n,\o,\p,\q}
+% \DoNotIndex{\r,\s,\t,\u,\v,\w,\x,\y,\z,\A,\B,\C,\D,\E,\F,\G,\H}
+% \DoNotIndex{\I,\J,\K,\L,\M,\N,\O,\P,\Q,\R,\S,\T,\U,\V,\W,\X,\Y,\Z}
+% \DoNotIndex{\1,\2,\3,\4,\5,\6,\7,\8,\9,\0}
+% \DoNotIndex{\!,\#,\$,\&,\',\(,\),\+,\.,\:,\;,\<,\=,\>,\?,\_}
+% \DoNotIndex{\discretionary,\immediate,\makeatletter,\makeatother}
+% \DoNotIndex{\meaning,\newenvironment,\par,\relax,\renewenvironment}
+% \DoNotIndex{\repeat,\scriptsize,\selectfont,\the,\undefined}
+% \DoNotIndex{\arabic,\do,\makeindex,\null,\number,\show,\write,\@ehc}
+% \DoNotIndex{\@author,\@ehc,\@ifstar,\@sanitize,\@title,\everypar}
+% \DoNotIndex{\if@minipage,\if@restonecol,\ifeof,\ifmmode}
+% \DoNotIndex{\lccode,\newtoks,\onecolumn,\openin,\p@,\SelfDocumenting}
+% \DoNotIndex{\settowidth,\@resetonecoltrue,\@resetonecolfalse,\bf}
+% \DoNotIndex{\clearpage,\closein,\lowercase,\@inlabelfalse}
+% \DoNotIndex{\selectfont,\mathcode,\newmathalphabet,\rmdefault}
+% \DoNotIndex{\bfdefault}
+% \setcounter{StandardModuleDepth}{1}
+% \MakeShortVerb{\"}
+%
+% \begin{abstract}
+% \noindent The {\tt Law} module for the {\sc Camel} bibliography
+% package and \BibTeX{} attempts to implement fully automated typesetting
+% of citations in the so-called Blue Book style used in
+% the publication of legal materials. This
+% demanding style requires context sensitive
+% in-footnote cross-referencing
+% between citations.
+% \end{abstract}
+%
+% \noindent An adage in office management is that you should
+% only touch incoming paper once; to respond to it, to file
+% it, to forward it, or to destroy it. A number of
+% commercial citation
+% database managers provide a facility for ``filing'' citations
+% in a flexible form, the idea being to extend this principle
+% to citations as well as paper. A hanging point for this
+% strategy as been in-text context-sensitive citation styles.
+% Database managers are at their best in exporting
+% entire bibliographies
+% and lists of authorities. Some packages are
+% capable of scanning a document for citation ``tags'',
+% which eliminates the need to separately select bibliography
+% items in the database. Some, too, can replace ``tags''
+% in the document with the formatted text of a citation.
+% But once the text is replaced, the format of citations
+% added in this way is fixed; conversion is a one-way process.
+%
+% A more serious problem is that, while the database manager
+% can easily identify the {\em tag}, it is far more difficult,
+% without logical markup, to identify its
+% {\em context\/}---whether it occurs in a footnote, how many
+% items were in the preceding footnote, how many articles
+% by the same author are cited in the document, and so forth.
+% As a result, citation formatting of cross-referenced styles
+% is still generally done by hand.
+%
+% One of the most demanding cross-referenced styles is that
+% laid down in {\sl A Uniform System of Citation}, or ``the Blue
+% Book'', for the citation of legal materials. This style
+% has survived the era of computerization largely because
+% most U.S. law journals using the style are edited by highly
+% competitive law students. Staff members contribute their
+% editorial time to their journal free of charge, because of
+% the value of listing law journal membership on their resume.
+% The Blue Book style minimizes the bulk of citation
+% text, while conveying sufficient information to the reader
+% for the location of cited material. It is also designed
+% to provide all information required for the location of
+% {\em primary\/} legal authority from the face of any citation
+% to it, without tracing down cross-references.
+%
+% A first attempt to address this problem was made in
+% the complementary \LexiTeX{}
+% and \LexiBib{} packages, for \LaTeX{} and \BibTeX{}
+% respectively. Lessons learned from developing these
+% packages suggested that a comprehensive formatting package
+% for legal citations could serve as the foundation for
+% a modular, highly generalized citation and bibliography
+% formatting system. The logical code from these packages
+% was excised and used in the drafting of the {\sc Camel}
+% bibliography engine. The typesetting code was then used
+% to assemble the {\sc Law} module for {\sc Camel}.
+%
+% The implications of such a system are particularly interesting
+% if it comes to be widely used in the publication of
+% law journals or, even better, in the publication of court
+% judgements. The efficiency with which
+% citations can be reported to citation services would be
+% increased, since \BibTeX-format database entries
+% are in a standard format that can
+% be processed electronically. These same lists could
+% be made available as text-searchable databases of authority.
+% Network discussions of legal issues could be accompanied by
+% growing lists of annotated authority, available for all to
+% use.
+%
+% To use this package, all you should need to do is unpack
+% the files by running {\tt law.ins} (thanks to Robin Fairbairns
+% for pushing me toward a standard-ish method of installation!),
+% copy the style files to their respective homes, and follow the
+% markup conventions described in the {\sc Camel} manual. The
+% same should apply to any other bibliography
+% modules produced for {\sc Camel} in the future, no matter what
+% sort of contortions they put your citation data through before
+% they end up on the page. If it has extensive documentation,
+% it's {\em not\/} a {\sc Camel} module!
+%
+% You are not under an obligation to enjoy this package. If you
+% have complaints, you can contact me on {\tt fb@soas.ac.uk}.
+%
+%\StopEventually{}
+% \section{The style code}
+% \subsubsection{Entry type specific functions}
+% The functions below should not be used as general utilities;
+% they are designed specifically for use with a particular entry
+% type. While they could be placed directly into the entry
+% functions to which they apply, defining them separately
+% helps improve the transparency of the code.
+%
+% \DescribeEnv{build.bridges}
+% I'm not actually sure whether this function belongs in {\tt
+% camel.dtx} or in {\tt law.dtx}. What it does is to insert (or
+% not insert) an appropriate "\bridges" declaration into the {\tt
+% .bbl} file for the current citation. It is governed by a
+% string existing on the stack when it is invoked, and leaves
+% nothing on the stack. Toggles are {\tt schedules}, {\tt sections} and {\tt
+% articles}. Season to taste.
+% \begin{macrocode}
+%<*bstfunctions>
+FUNCTION {build.bridges}
+ { duplicate$ empty$
+ { pop$ skip$ }
+ { duplicate$ "sections" =
+ { pop$ "\bridges{\ \S~}{}{\ \S\S~}{\ }{\ \S~}{\ \S\S~}"
+ "" "" must.must.must
+ }
+
+ { duplicate$ "articles" =
+ { pop$
+ "\bridges{\ art.~}{}{\ arts.~}{\ }{\ art.~}{\ arts.~}"
+ "" "" must.must.must
+ }
+ { "schedules" =
+ { "\bridges{\ sched.~}{}{\ scheds.~}{\ }{\ sched.~}{\ scheds.~}"
+ "" "" must.must.must
+ }
+ 'skip$
+ if$
+ }if$
+ }if$
+ }if$
+ }
+% \end{macrocode}
+% \DescribeEnv{get.a.kinda.sort.key}
+% It is early days for the sorting of bibliographies in {\sc
+% Camel}. This will give a rough key.
+% \begin{macrocode}
+FUNCTION { get.a.kinda.sort.key }
+{ author empty$
+ { title empty$
+ { "0000" }
+ { title "*" "forward" gather.chars pop$
+ duplicate$ "l" change.letter.case "the" =
+ { pop$ "*" "forward" gather.chars pop$ swap$ pop$ }
+ { duplicate$ "l" change.letter.case "a" =
+ { pop$ "*" "forward" gather.chars pop$ swap$ pop$ }
+ { swap$ pop$
+ }if$
+ }if$
+ }if$
+ }
+ { author #1 "{ll}" format.name$
+ }if$
+}
+% \end{macrocode}
+% \DescribeEnv{j.format.division}
+% This function assembles the various fields relevant to the
+% division of a Japanese court into a single string.
+% \begin{macrocode}
+FUNCTION {j.format.division}
+ { division empty$
+ 'skip$
+ { dc.. court "end" first.in.second
+ { pop$ " No.~" 's := "endlabel" 't := }
+ { pop$ sc.. court "start" first.in.second
+ { pop$ "No.\ " 's := "frontlabel" 't := }
+ { pop$ " " 's := "endlabel" 't :=
+ }if$
+ }if$
+ }if$
+ division s divno t field.tag.no.combine
+ }
+% \end{macrocode}
+%
+% \subsubsection{Entry type functions}
+% Now we define the type functions for all entry types that may
+% appear
+% in the {\tt*.bib} file---e.g., functions like `"article"' and
+% `"book"'. These
+% are the routines that actually generate the "*.bbl" file output
+% for
+% the entry. These must all precede the "READ" command. In
+% addition, the
+% style designer should have a function `"default.type"' for
+% unknown types.\footnote{This comment by Oren Patashnik.}
+%
+% \DescribeEnv{article}
+% This function performs the necessary operations for
+% exporting a valid \LexiTeX\ citation to an article.
+% For this and for all citation types defined in the
+% \LexiBib{} style, the goal is to provide reasonably
+% complete commentary, so that anyone wanting to
+% alter the behaviour of the style can set to work
+% with a fair degree of confidence about what needs to
+% be done to achieve a particular result.
+% \begin{macrocode}
+FUNCTION {article}
+% \end{macrocode}
+% The "article" entry is used for all kinds of material, so
+% it ends up as one of the most complex entries. Before we
+% do anything, we have to check whether the default {\sc Camel}
+% bridges are acceptable. There are two types of situations to watch out
+% for. First, if the volume and the number are both
+% non-empty, we need to add a special set of substitute bridges.
+% Alternatively, if both "volume" and "number" are empty,
+% but the date is more specific than just a year, we
+% assume we are dealing with a newspaper. In either case,
+% we use the same special set of bridges.
+% \begin{macrocode}
+{ volume empty$ not number empty$ not and
+ volume empty$ number empty$ year "mo.dd.yy" format.date
+ pop$ itemcount #1 = not and and or
+ { "\bridges{,\ p.~}{,\ }{,\ }{\ }{\ at~}{\ at~}"
+ "" "" must.must.must
+ newline$
+ }
+% \end{macrocode}
+% Second, the {\tt @article} entry type, like many entry types in
+% the Blue Book style normally places
+% white space between the title
+% and a pinpoint page number. If the title ends in a numeral
+% this will be confusing, so the Blue Book requires that we
+% separate the two with a comma in this case. The following
+% adjustment to bridging punctuation accomplishes this purpose.
+% \begin{macrocode}
+ { title type.last.char "numeral" =
+ { "\bridges{,\ }{,\ }{,\ }{\ }{\ at~}{\ at~}"
+ "" "" must.must.must
+ newline$
+ }
+ 'skip$
+ if$
+ }if$
+% \end{macrocode}
+% \changes{1995/07/08}{v0.1a}{Function {\tt type.last.char} and
+% {\tt\protect\string\protect\bridges} declaration used to handle titles ending
+% in a numeral correctly (by the insertion of a comma). Added to
+% the {\tt @article} and {@book} entries as a trial; will
+% propagate to other entry types once this change is trusted.}
+% Then we write the citation leader, to prepare for outputting the
+% actual content of the citation text.
+% \begin{macrocode}
+ "\lexibib{article}{" cite$ "}{" must.must.must
+ get.a.kinda.sort.key
+ "}{" "" must.must.must
+% \end{macrocode}
+% The author name is pushed to the stack, followed by a toggle
+% to trigger last-name-only formatting. Then the "format.names"
+% reduces this to a single, appropriately-formatted string,
+% possibly the null string. All that is left to do is push a
+% set a braces, a null string to make up three arguments to the
+% export routine, and write the lot on the output
+% file unconditionally, using "must.must.must".
+% \begin{macrocode}
+author "lastonly" format.names
+"}{"
+""
+must.must.must
+% \end{macrocode}
+% Next comes the title of the article. This is not specially
+% formatted; we simply push the title field, then a warning
+% string
+% followed by a check for whether it is empty or not, then
+% braces and a null string, and write again.
+% \begin{macrocode}
+title "title" check
+"}{"
+""
+must.must.must
+% \end{macrocode}
+% The next bit is actually rather thorny. There are three
+% possible cases. The first is where both a volume number
+% and an issue number exist. In this case, we use a
+% verbose form of reference. In the second, there is no
+% volume number, but possibly an issue number. This is
+% the proper form for Commonwealth legal materials,
+% and requires the year in brackets, followed by the
+% issue number to show the volume within the year.
+% Third, we may simply have a volume number by itself.
+% This calls for the citation form for most journals,
+% and U.S. case reporters.
+% \begin{macrocode}
+ volume empty$ not number empty$ not and
+ { journal "journal" check ", v.~" volume must.must.must
+ ", n.~" number "}{" must.must.must }
+ { volume empty$ not
+ { volume "\ " journal "journal" check empty.to.null
+ might.ifone.must
+ "}{" "" "" must.must.must}
+ { year "mo.dd.yy" format.date itemcount #1 =
+ { "[" swap$ "] " iftwo.might.iftwo
+ number "\ " journal "journal" check might.ifone.must
+ "}{" "" "" must.must.must}
+ { pop$ number empty$
+ { "\\" journal "journal" check "\\" must.must.must
+ "}{" "" "" must.must.must }
+ { number "\ " journal "journal" check might.ifone.must
+ "}{" "" "" must.must.must
+ }if$
+ }if$
+ }if$
+ }if$
+% \end{macrocode}
+% The Blue Book does not like page ranges
+% so we need to clean
+% out anything following a dash in the "pages" field. The
+% "short" option
+% toggles this behaviour on. We also check to see that the page
+% is not empty. This is followed by braces, a null string, and
+% output.
+% \begin{macrocode}
+pages "short" format.pages "pages" check
+"}{"
+""
+must.must.must
+% \end{macrocode}
+% We add the year next, but only if the "volume" field is
+% non-empty (if "volume" is empty, we'll have put the year
+% is as a bracketed volume number, Commonwealth-style.
+% We could use just the year (this is normal for Blue Book
+% style, but we'll add the month for good measure, if it's
+% been provided in the "year" field.
+% \begin{macrocode}
+volume empty$ not
+ { "(" "" "" must.must.must
+ publisher ":\ " "" might.ifone.must
+ "" year "mo.dd.yy" format.date ")" must.must.must }
+ { year "mo.dd.yy" format.date itemcount #1 =
+ 'pop$
+ { "" "" must.must.must
+ }if$
+ }if$
+% \end{macrocode}
+% Finally, we have to tangle with cross-references.
+% Yuck. (Not a complaint about \BibTeX, just a general
+% response to the design problems inherent in the task).
+% Formatting depends on whether there is a "crossref" entry.
+% Hear that, guys? If you don't use the "crossref" field,
+% we'll short-change you on formatting service.
+% \begin{macrocode}
+crossref empty$
+% \end{macrocode}
+% If there is no "crossref", we just push a brace and a couple
+% of nulls, and write. Done! Hurray!
+% \begin{macrocode}
+{ "}" "" "" must.must.must }
+% \end{macrocode}
+% But if there {\em was\/} a "crossref", we've got work to do.
+% Darn. The first thing we do is have a look at "booktitle".
+% This should be non-null in this situation; there's no sense
+% setting up a cross-reference to an individual volume of
+% a journal unless there's something special to be said
+% about it.
+% \begin{macrocode}
+{ booktitle empty$
+% \end{macrocode}
+% So if no "booktitle" is found, we whinge and format
+% as for a no-cross-reference entry.
+% \begin{macrocode}
+ { "no booktitle (name of special issue) for "
+ cite$ "/" crossref ". Why a crossref?" * * * * warning$
+ "}" "" "" must.must.must }
+% \end{macrocode}
+% If there {\em is\/} a "booktitle", though,
+% and if the "volume" field is non-empty (which
+% means that we just printed, or at least should
+% have printed, the year), we close the
+% parens following the year (which is opened by \LexiTeX),
+% and open another (which will be closed by \LexiTeX).
+% That's it for conditional punctuation; we follow
+% with "booktitle", which should be
+% the title or subject description of the special
+% issue of the journal.
+% \begin{macrocode}
+ { volume empty$ {""} {") ("} if$ booktitle "}" must.must.must}
+ if$
+}if$
+% \end{macrocode}
+% Add a fresh new line in the export file, and we're done! Whew!
+% \begin{macrocode}
+newline$
+}
+% \end{macrocode}
+%
+% \DescribeEnv{book}
+% This is the entry for books, which includes individual
+% volumes in a series, and multi-volume works with a single
+% title. Correct me if I'm wrong, but I think this latter
+% citation type is not supported by \BibTeX. \LexiBib{}
+% manages it by allowing the user to specify the volume
+% number in the text using the optional ":<number>:" argument to
+% the "\lexicite" tag.
+% \begin{macrocode}
+FUNCTION {book}
+% \end{macrocode}
+% This entry type normally places white space between the title
+% and a pinpoint page number. If the title ends in a numeral
+% this will be confusing, so the Blue Book requires that we
+% separate the two with a comma in this case. The following
+% adjustment to bridging punctuation accomplishes this purpose.
+% \begin{macrocode}
+{ title type.last.char "numeral" =
+ { "\bridges{,\ }{}{,\ }{\ }{\ at~}{\ at~}"
+ "" "" must.must.must
+ newline$
+ }
+ { units empty.to.null "paras" =
+ { "\bridges{,\ para.~}{}{,\ paras.~}{\ }{,\ para.~}{,\ paras.}"
+ "" "" must.must.must
+ newline$
+ }
+ 'skip$
+ if$
+ }if$
+% \end{macrocode}
+% Next, after the opener, we push the opening macro tag for a book
+% entry, the nickname of the citation, and a couple of
+% braces. This is all mandatory and can safely be given
+% unconditional export.
+% \begin{macrocode}
+ "\lexibib{book}{" cite$ "}{" must.must.must
+ get.a.kinda.sort.key "" "}{" must.must.must
+% \end{macrocode}
+% A non-empty "volume" field means we need a leading
+% volume number in the Blue Book style. If a volume
+% number (or anything else) is found in the "volume"
+% field of a book entry, we replace it with a
+% "volno" macro. This will expand in the document to
+% whatever the author has specified using the optional
+% ":<number>" argument to "\lexicite". For example,
+% volume 8 of "holdsworth" would be: "\lexicite:8:{holdsworth}".
+% \begin{macrocode}
+ volume empty$
+ { "" }
+ { "\volno\ " }
+ if$
+% \end{macrocode}
+% The author comes first. We push the contents of the
+% "author" field, then the toggle string ``"firstinitial"'',
+% and run the "format.names" function to produce the name
+% formatted properly for a book entry. Then we push
+% fa couple of braces
+% and force all three items ("\volno" or null, "author", and
+% braces) onto the output.
+% \begin{macrocode}
+ author
+ "firstinitial" format.names "}{" must.must.must
+% \end{macrocode}
+% The title may be a simple name for a single volume,
+% or it may be in title/subtitle format. Title/subtitle
+% can be written into the "title" entry directly as
+% ``\meta{title}: \meta{subtitle}''. We provide for
+% an alternative form here, just in case "booktitle"
+% is used for the main title --- conservation of
+% data. If there is no "booktitle", we push the title, then
+% check to be sure it's non-empty, then write it onto output.
+% If "booktitle" exists, we push it, then a colon, then
+% "title", followed by a conditional write on output that
+% will suppress the colon if "title" is empty.
+% Finally, we push the closing braces and an opening
+% parens (for the year info) and write that stuff on output.
+% \begin{macrocode}
+ booktitle empty$
+ { title "title" check "" "" must.must.must }
+ { booktitle ": " title must.ifthree.might
+ }if$
+ type empty.to.null "cmnd" =
+ type empty.to.null "command" =
+ type empty.to.null "command papers" =
+ or or
+ { ", " year "mo.dd.yy" format.date
+ ", " "Cmnd. "
+ * * *
+ series empty$
+ { "no.~" }
+ { "Ser.~" series ", No.~" * *
+ }if$
+ number "number" check
+ * *
+ "" "" must.must.must
+ }
+ 'skip$
+ if$
+ "}{}{}{" "(" "" must.must.must
+% \end{macrocode}
+% We're now in the final ``field'' of the \LexiTeX{} entry.
+% This is mainly for the year, but we also give the
+% name of the editor(s) or translator(s)
+% if present. If there is no
+% editor or translator, we'll put a series name here, to help identify
+% the source. We don't put both, because this would
+% confuse things (there can be book editors and
+% series editors too, and the Blue Book style is
+% too streamlined to distinguish the two elegantly).
+% So our first task is to see if there is an editor\ldots
+% \begin{macrocode}
+ editor empty$ translator empty$ and
+% \end{macrocode}
+% \ldots{} and if there is none, we put in a
+% series name if it exists.
+% The "series" \BibTeX{} field should be used for the
+% name of the series of which a volume forms a part,
+% but some folks might accidentally use "booktitle".
+% We'll be forgiving and accept it anyway.
+% \begin{macrocode}
+ { series empty$
+% \end{macrocode}
+% If both
+% "series" is empty, we've nothing to do.
+% \begin{macrocode}
+ 'skip$
+% \end{macrocode}
+%
+% If "series" exists, we push it, followed by
+% a bridge and a series item number,
+% and a toggle for the "field.tag.no.combine" function.
+% The "endlabel" toggle causes this function to put
+% the bridge and the number after the series name,
+% if a number exists, and push the lot back as a single
+% item on the stack. Otherwise it leaves just the series
+% name.
+%
+% And last, we put up a comma to close, and do a mandatory
+% export of the lot.
+% \begin{macrocode}
+ { series " No.~" number
+ "endlabel" field.tag.no.combine ", " "" must.must.must }
+ if$
+ }
+% \end{macrocode}
+% If either the editor or the translator fields were not empty,
+% we format the editor or translator name
+% instead, and put those details here.
+% \begin{macrocode}
+ { editor translator either.or "firstinitial" format.names
+% \end{macrocode}
+% We need to append the correct designator, either ``ed.''\ or
+% ``trans.''. The "either.or" function will use the second
+% item pushed if both are non-empty, so we take advantage of
+% this ``feature'' in making our choice of designators; the
+% "ed." or "eds." strings are only used if the "translator"
+% field is empty. And finally, we push a null string to
+% round out, and do a compulsory export.
+% \begin{macrocode}
+ translator empty$
+ { editor num.names$ #1 >
+ { " eds.\ " }
+ { " ed.\ " }
+ if$
+ }
+ { " trans.\ " }
+ if$
+ "" must.must.must
+ }if$
+% \end{macrocode}
+% We also need to indicate the edition, if any.
+% \begin{macrocode}
+ edition " ed.\ " "" might.ifone.must
+% \end{macrocode}
+% The year itself is easy. We push the year, do a check to issue
+% a warning if necessary, then run format.date over it,
+% which yields the year in "theyear", which can be pushed
+% back onto the stack. Then we fill out to six
+% \LexiTeX{} fields in
+% all, and do a compulsory export.
+% \begin{macrocode}
+ type empty.to.null "cmnd" =
+ type empty.to.null "command" =
+ type empty.to.null "command papers" =
+ or or
+ { "" }
+ { year "mo.dd.yy" format.date
+ }if$
+ ")}" "" must.must.must
+% \end{macrocode}
+% A new line for a new macro, and we're done! Rejoice!
+% On to the next function definition!
+% \begin{macrocode}
+ newline$
+}
+% \end{macrocode}
+%
+% \DescribeEnv{incollection}
+% This is for those nasty entries that are created when someone
+% publishes an article in a collection of essays edited by someone
+% else.
+% \begin{macrocode}
+FUNCTION{incollection}
+{ "\lexibib{incollection}{" cite$ "}{" must.must.must
+ get.a.kinda.sort.key "" "}{" must.must.must
+ author "lastonly" format.names "author" check
+ "}{" "" must.must.must
+ title "title" check
+ "}{" "" must.must.must
+ chapter empty$
+ { "\\in \\" }
+ { "\\" type empty$
+ { "chapter " chapter "chapter" check " of \\" * * * }
+ { type " " chapter "chapter" check " of \\" * * * *
+ }if$
+ }if$
+ booktitle "booktitle" check
+ "}{" must.must.must
+ pages "short" format.pages "pages" check
+ "}{" "(" must.must.must
+% We're now in the final ``field'' of the \LexiTeX{} entry.
+% The coding here is the same as for a "book" entry; the
+% reader is referred to that entry for the commentary
+% on the following code.
+% \begin{macrocode}
+ editor empty$ translator empty$ and
+ { series empty$
+ 'skip$
+ { series " No.~" number
+ "endlabel" field.tag.no.combine ", " "" must.must.must }
+ if$
+ }
+ { editor booktranslator either.or "firstinitial" format.names
+ booktranslator empty$
+ { editor num.names$ #1 >
+ { " eds.\ " }
+ { " ed.\ " }
+ if$
+ }
+ { " trans.\ " }
+ if$
+ "" must.must.must
+ }if$
+ edition " ed.\ " "" might.ifone.must
+ year "mo.dd.yy" format.date ")}" "" must.must.must
+ newline$
+}
+% \end{macrocode}
+% \DescribeEnv{inbook}
+% There is significant massaging of the use to which
+% "title" and "booktitle" is put here. If both occur,
+% but are different, the form is ``"title" in "booktitle"'',
+% or ``"title", chapter X of "booktitle"''.
+% If both occur, but are the same, the treatment depends
+% on whether "chapter" occurs. If it does not occur,
+% the style complains --- an "@inbook" entry should always
+% refer to a chapter or other specific unit if the
+% "title" and "booktitle" are the same. If it does occur,
+% then the chapter or other specifier is treated as a
+% volume number inserted as an option to "\source" using "v=",
+% the "title" being inserted as the title of the work.
+% \begin{macrocode}
+FUNCTION{inbook}
+{ "\lexibib{inbook}{" cite$ "}{" must.must.must
+ get.a.kinda.sort.key "" "}{" must.must.must
+ author "firstinitial" format.names "author" check
+ "}{" "" must.must.must
+ title booktitle =
+ { chapter empty$
+ { "no chapter or separate title for inbook entry " cite$ * warning$
+ }
+ { "{\rm " "Chapter" type either.or.nowarning
+ " " chapter " of} " * * * *
+ }if$
+ }
+ { ""
+ }if$
+ title "title" check
+ "}{" must.must.must
+ title booktitle =
+ { "" }
+ { chapter empty$
+ { "{\rm in} " }
+ { type empty$
+ { "{\rm Chapter " chapter " of} " * * }
+ { "{\rm " type " " chapter " of} " * * * *
+ }if$
+ }if$
+ }if$
+ booktitle "booktitle" check
+ "}{" must.must.must
+ pages "short" format.pages "pages" check
+ "}{" "(" must.must.must
+% We're now in the final ``field'' of the \LexiTeX{} entry.
+% The coding here is the same as for a "book" entry; the
+% reader is referred to that entry for the commentary
+% on the following code.
+% \begin{macrocode}
+ translator empty$
+ { series empty$
+ 'skip$
+ { series " No.~" number
+ "endlabel" field.tag.no.combine ", " "" must.must.must }
+ if$
+ }
+ { translator "firstinitial" format.names
+ " trans.\ "
+ "" must.must.must
+ }if$
+ edition " ed.\ " "" might.ifone.must
+ year "mo.dd.yy" format.date ")" "}" must.must.must
+ newline$
+}
+% \end{macrocode}
+%
+% \begin{macrocode}
+FUNCTION{booklet}
+{ "\lexibib{booklet}{" cite$ "}{" must.must.must
+ get.a.kinda.sort.key "" "}{" must.must.must
+ author "full" format.names "}{" "" must.must.must
+ "\\" title "\\}{}{}{(" must.must.must
+ howpublished ", " "" might.ifone.must
+ year "mo.dd.yy" format.date
+ ")}" "" must.must.must
+ newline$
+}
+% \end{macrocode}
+% \changes{1994/12/12}{1.0g}{Added the `techreport' function,
+% to support draft article sent to Pedro Aphalo for comments.}
+% \begin{macrocode}
+FUNCTION {techreport}
+{"\lexibib{techreport}{" cite$ "}{" must.must.must
+ get.a.kinda.sort.key "" "}{" must.must.must
+ institution author either.or.nowarning
+ "full" format.names "author & institution" check
+ "}{" title "title" check must.must.must
+ "}{}{}{" "(" "" must.must.must
+ author empty$
+ 'skip$
+ {institution "\ " "" might.ifone.must
+ }if$
+ type empty$
+ { "Technical report" }
+ { type
+ }if$
+ type empty.to.null "Cmnd" =
+ { "\ " }
+ { " No.~"
+ }if$
+ number "endlabel" field.tag.no.combine
+ ", " "" must.must.must
+ year "mo.dd.yy" format.date
+ "" ")}" must.must.must
+ newline$
+ }
+% \end{macrocode}
+% \begin{macrocode}
+FUNCTION {mastersthesis}
+{"\lexibib{mastersthesis}{" cite$ "}{" must.must.must
+ get.a.kinda.sort.key "}{" "" must.must.must
+ author
+ "full" format.names "author" check
+ "}{" title "title" check must.must.must
+ "}{}{}{("
+ type empty$
+ { "Master's Thesis" }
+ { type
+ }if$
+ ", " must.must.must
+ institution "institution" check ", " "" might.ifone.must
+ year "mo.dd.yy" format.date
+ ")" "}" must.must.must
+ newline$
+ }
+% \end{macrocode}
+%
+% \paragraph{Cases} Law cases are all entered using the
+% {\tt @CASE} entry type. The formatting of citations
+% varies from jurisdiction to jurisdiction, so the behaviour
+% of citations of this type is controlled via a "jurisdiction"
+% field. Supported jurisdictions are listed in the user
+% guide. Below, the functions for each jurisdiction are
+% defined first, followed by the "case" function itself.
+%
+% \begin{macrocode}
+FUNCTION {clear.cite.vars}
+ {
+"" 'volume.var :=
+"" 'number.var :=
+"" 'journal.var :=
+"" 'pages.var :=
+"" 'year.var :=
+ }
+FUNCTION {case}
+% \end{macrocode}
+% Like the "article" entry, the "case" entry must make some
+% pretty fine decisions about how to format material
+% fed to it. As a consequence, it is complex, but similar
+% to the "article" entry in many particulars.
+% \begin{macrocode}
+{ cites empty.to.null "=" *
+ journal empty$
+ { parse.one.cite }
+ { volume empty.to.null 'volume.var :=
+ number empty.to.null 'number.var :=
+ journal 'journal.var :=
+ pages empty.to.null 'pages.var :=
+ year empty.to.null 'year.var :=
+ }if$
+ volume.var empty$ not number.var empty$ not and
+ { "\bridges{,\ p.~}{,\ }{,\ }{\ }{\ at~}{\ at~}"
+ "" "" must.must.must
+ newline$ }
+ 'skip$
+ if$
+ "\lexibib{case}{" cite$ "}{" must.must.must
+ get.a.kinda.sort.key "" "}{}{" must.must.must
+ title empty$
+ { "Decision of the " court "court" check "" must.must.must
+ " (" j.format.division ")" iftwo.might.iftwo
+ ", " "" "" must.must.must
+ casedate "month.dd.yy" format.date "" "" must.must.must
+ "}{" "" "" must.must.must
+ }
+ { title "}{" "" must.must.must }
+ if$
+ volume.var empty$ not number.var empty$ not and
+ { journal.var "journal" check ", v.~" volume.var must.must.must
+ ", n.~" number.var "}{" must.must.must }
+ { volume.var empty$
+ { "[" year.var "mo.dd.yy" format.date "] " iftwo.might.iftwo
+ number.var "\ " journal.var "journal" check might.ifone.must
+ "}{" "" "" must.must.must }
+ { volume.var "\ " journal.var "journal" check empty.to.null
+ might.ifone.must
+ "}{" "" "" must.must.must
+ }if$
+ }if$
+pages.var "short" format.pages "pages" check
+"}{"
+"("
+must.must.must
+volume.var empty$
+ 'skip$
+ { year.var "mo.dd.yy" format.date "" "" must.must.must
+ }if$
+crossref empty$
+{ ")}" "" "" must.must.must }
+{ booktitle empty$
+ { "no booktitle (name of special issue) for "
+ cite$ "/" crossref * * * warning$
+ ")}" "" "" must.must.must }
+ { volume.var empty$ {""} {") ("} if$ booktitle "}" must.must.must}
+ if$
+}if$
+{ duplicate$ "=" = not }
+{ parse.one.cite
+ "={" "" "" must.must.must
+ volume.var empty$ not number.var empty$ not and
+ { journal.var "journal" check ", v.~" volume.var must.must.must
+ ", n.~" number.var "}{" must.must.must }
+ { volume.var empty$
+ { "[" year.var "mo.dd.yy" format.date "] " iftwo.might.iftwo
+ number.var "\ " journal.var "journal" check might.ifone.must
+ "}{" "" "" must.must.must }
+ { volume.var "\ " journal.var "journal" check empty.to.null
+ might.ifone.must
+ "}{" "" "" must.must.must
+ }if$
+ }if$
+pages.var "short" format.pages "pages" check
+"}{"
+""
+must.must.must
+volume.var empty$
+ 'skip$
+ { "(" year.var "mo.dd.yy" format.date ")" must.must.must
+ }if$
+crossref empty$
+{ "}" "" "" must.must.must }
+{ booktitle empty$
+ { "no booktitle (name of special issue) for "
+ cite$ "/" crossref * * * warning$
+ "}" "" "" must.must.must }
+ { volume.var empty$ {""} {") ("} if$ booktitle "}" must.must.must}
+ if$
+}if$
+}while$
+pop$
+clear.cite.vars
+newline$
+annote empty.to.null write$ newline$
+}
+% \end{macrocode}
+% The following item adds annotations; this may be eliminated by
+% stripping with "noannotes".
+% \begin{macrocode}
+%<*!noannotes>
+% annote empty.to.null write$ newline$
+%</!noannotes>
+% }
+% \end{macrocode}
+%
+% \DescribeEnv{j.statute}
+% This function applies to Japanese statutory materials.
+% \changes{1994/08/03}{v0.1c}{Added support for Japanese statutes.}
+% \begin{macrocode}
+FUNCTION {j.statute}
+ { "\lexibib{jstatute}{" cite$ "}{" must.must.must
+ get.a.kinda.sort.key "" "}{}{" must.must.must
+ title "title" check empty.to.null "}{}{}{" "" must.must.must
+ title empty$ {""} {"("} if$
+ "" "" must.must.must
+ number empty$
+ 'skip$
+ { type empty$
+ { "Law" }
+ { type
+ }if$
+ "\ no.~" *
+ number "number" check " of "
+ iftwo.might.iftwo
+ }
+ if$
+ year "yy" format.date
+ title empty$ {""} {")"} if$
+ "}" must.must.must
+ newline$
+ }
+% \end{macrocode}
+%
+% \DescribeEnv{s.statute}
+% This function formats a statute entry for Singapore.
+% \begin{macrocode}
+FUNCTION { s.statute }
+{ "\lexibib{statute}{" cite$ "}{" must.must.must
+ get.a.kinda.sort.key "" "}{}{" must.must.must
+ title "title" check ", No.~" number
+ "endlabel" field.tag.no.combine
+ number empty$
+ { "\ " * }
+ { "\ of " * }
+ if$
+ year "mo.dd.yy" format.date "}{}{}{}" must.must.must
+ newline$
+}
+% \end{macrocode}
+% \begin{macrocode}
+FUNCTION { e.statute }
+{ "\lexibib{statute}{" cite$ "}{" must.must.must
+ get.a.kinda.sort.key "" "}{}{" must.must.must
+ title "title" check "\ "
+ year "mo.dd.yy" format.date must.must.must
+ "}{}{}{}" "" "" must.must.must
+ newline$
+}
+% \end{macrocode}
+%
+% \DescribeEnv{statute}
+% This function selects the correct statute entry function.
+% \begin{macrocode}
+FUNCTION { statute }
+ { type build.bridges
+ jurisdiction empty.to.null duplicate$
+ "japan" =
+ { pop$ j.statute }
+ { duplicate$ "singapore" =
+ { pop$ s.statute }
+ { duplicate$ "england" =
+ { pop$ e.statute }
+ { pop$ "IMPORTANT: unknown jurisdiction for " cite$ * warning$
+ }if$
+ }if$
+ }if$
+ }
+% \end{macrocode}
+%
+% \DescribeEnv{unpublished}
+%
+% A hastily drafted function type for unpublished materials.
+%
+% \begin{macrocode}
+FUNCTION {unpublished}
+{ "\lexibib{book}{" cite$ "}{" must.must.must
+ get.a.kinda.sort.key "" "}{" must.must.must
+ author "firstinitial" format.names "}{" "" must.must.must
+ title "title" check "" "" must.must.must
+ "}{}{}{" "(" "" must.must.must
+ note
+ ")}" "" must.must.must
+ newline$
+}
+% \end{macrocode}
+%
+% \DescribeEnv{default.type}
+% We use the "book" type as our default type. When "manual" is
+% completed, we should probably use that type instead.
+% \begin{macrocode}
+FUNCTION {default.type} { book }
+%</bstfunctions>
+% \end{macrocode}
+%
+%
+% \subsection{Macro definitions}
+% We don't define any macros for abbreviating law journal
+% names. Instead, we will use Blue Book abbreviations
+% ``native'', with a special syntax (probably the full
+% form in syntax:
+% ``"\gobble{Accountant}{}"'' immediately after
+% the abbreviation) for resolving
+% ambiguous abbreviations. Meanwhile, trust me: use the
+% Blue Book abbreviations and take this upcoming facility
+% on faith. And besides, do you ever {\em need\/} to spell
+% out journal and reporter names?
+%
+% \subsection{Execution}
+% With all preliminaries out of the way, our first act is
+% to read in the entries from {\tt *.bib}..
+% \begin{macrocode}
+%<*bstfunctions>
+READ
+% \end{macrocode}
+% Then we say ``Hi'' to the user. It would be nice to make this
+% the first message, but the structure of \BibTeX{} style files
+% dictates that it will follow any warnings about missing
+% entries.
+% \begin{macrocode}
+EXECUTE {hello}
+%</bstfunctions>
+% \end{macrocode}
+% \section{Camel style code}
+% \begin{macrocode}
+%<*lawcitestyle>
+\ProvidesFile{law.cst}[1995/01/08]
+% \end{macrocode}
+% \subsection{Word list}
+% A list of inter-words and their corresponding expansions
+% must be provided.
+% \begin{macrocode}
+{\catcode`\_=13%
+ \catcode`\^=13%
+\gdef\@law@wordlist{%
+ \\{\item}{\item}%
+ \\{and}{_\ ^And }%
+ \\{but-see}{_\ ^But see }%
+ \\{,}{_; }%
+ \\{;}{_; }%
+ \\{:}{_; }%
+ \\{eg}{_; ^E.g.~}%
+ \\{accord}{_; ^Accord }%
+ \\{see}{_; ^See }%
+ \\{see-also}{_; ^See also }%
+ \\{cited-in}{ cited in }%
+ \\{citing}{ citing }%
+ \\{cf}{_; ^Cf.~}%
+ \\{compare}{_; ^Compare }%
+ \\{with}{ with }%
+ \\{contra}{_; ^Contra }%
+ \\{but-cf}{_\ ^But cf.~}%
+ \\{see-generally}{_. See generally }%
+ \\{affirmed}{_, ^aff'd }%
+ \\{reprinted-in}{_; ^Reprinted in }%
+ \@law@nomatch}
+}
+% \end{macrocode}
+%
+% \subsection{Print routines}
+% Every ".cst" file must define a "\@law@print" macro.
+% This is the macro that prints the citation, both in the
+% text of the document and in the bibliography.
+% The toggles set by the {\sc Camel} engine allow
+% a high degree of refinement in the formatting of
+% citations. For the styles currently used in
+% publishing with \LaTeX{}, relatively little of this
+% power is required. In-document citation styles
+% are much more demanding; if you digest the operation
+% the following "\@law@print" macro, which is suitable for
+% formatting legal citations, you will find the drafting
+% of author-date styles and the like quite straightforward
+% by comparison.
+% \begin{macrocode}
+\gdef\@law@print{%
+% \end{macrocode}
+% In this particular style, a long citation (for the
+% bibliography, for example) and a first in-text citation
+% are identical. These forms have separate toggles, so
+% we start by equating them.
+% \begin{macrocode}
+ \xdef\@law@argtwolist{\the\@ltok@argtwo}%
+ \if@law@firstuseofcite\@law@longcitetrue\fi%
+% \end{macrocode}
+% This toggles the printing on and off. This toggle is
+% set by the "n" option to the "\source" command.
+% \begin{macrocode}
+\if@law@printcite%
+ \begingroup%
+ \def\@law@firstslash{\begingroup\def\\{\@law@secondslash}%
+ \the\ltokspecialface}%
+ \def\@law@secondslash{\endgroup\def\\{\@law@firstslash}}%
+ \def\\{\@law@firstslash}%
+% \end{macrocode}
+% There are two halves to the macro; one for long cite forms,
+% the other for short. Long cite forms are in the first
+% half.
+% \begin{macrocode}
+\if@law@longcite%
+% \end{macrocode}
+% Long citations are pretty straightforward; we've gathered all
+% the information we needed; now we just need to plunk it
+% all down in order, pretty much.
+% First to print is the author field (the second argument to the
+% citation declaration command), followed by the
+% author-to-title punctuation bridge. The enclosing
+% braces limit the scope of the special active character
+% definitions of "^", "_" and "|".
+% \begin{macrocode}
+ \global\ltokspecialface=\@ltok@authoroptionface%
+ {\the\@ltok@authormainface%
+ \@law@barinfull\the\@ltok@author}\the\@ltok@atot%
+% \end{macrocode}
+% Next comes similar treatment for the title.
+% \begin{macrocode}
+ \global\ltokspecialface=\@ltok@titleoptionface%
+ {\the\@ltok@titlemainface%
+ \@law@barinfull\the\@ltok@name}\the\@ltok@ttocone%
+% \end{macrocode}
+% \begin{macrocode}
+ \@law@longrecurse%
+% \end{macrocode}
+% This else marks the boundary between long-form citations
+% (which we have seen are relatively simple to print)
+% and short-form citations (which are rather complex).
+% This "\else" matches the "\if@law@longcite" conditional.
+% \begin{macrocode}
+\else%
+% \end{macrocode}
+% The footnote number and the accompanying bridge
+% should not appear in a short-form citation if
+% the citation being printed first occurred in the
+% current footnote. Rather than suppressing printing,
+% we just set the relevant tokens to nil.
+% \begin{macrocode}
+ \ifnum\the\@ltok@pageorfootno=\the\c@law@footnote\relax%
+ \xdef\@law@temp{\the\@ltok@whereitsat}%
+ \xdef\@law@temptwo{\the\@ltok@infoot}%
+ \ifx\@law@temp\@law@temptwo%
+ \global\@ltok@whereitsat{}%
+ \global\@ltok@pageorfootno{}%
+ \fi%
+ \fi%
+% \end{macrocode}
+% Special forms of tidying-up may be appropriate to
+% each of the four classes of citation. An appropriate
+% cleaning macro is called here.
+% \begin{macrocode}
+\csname @law@\the\@ltok@citetype preformat\endcsname%
+% \end{macrocode}
+% If it has been found that the same citation has been
+% used immediately previous to this instance,
+% we use {\em Id.} If the "\@justabove" test showed
+% that {\em Id.} by itself is appropriate, we prepare
+% to eat any period immediately following the citation
+% macro. Otherwise, we tack on the pinpoint reference
+% and its accompanying bridge. A fail-safe conditional
+% reverts to the original plan if the pinpoint reference
+% is empty.
+% \begin{macrocode}
+ \if@justabove%
+ {\def\,{,}%
+ \Id%
+ \if@l@quiteexact%
+ \gdef\@law@gobble{\@ifnextchar.{\@gobble}{}}%
+ \else%
+ \ifcat$\the\@ltok@argtwo$%
+ \gdef\@law@gobble{\@ifnextchar.{\@gobble}{}}%
+ \else%
+
+ \the\@ltok@atbridge{\@law@barkill\the\@ltok@argtwo\relax}%
+ \@law@fetchparas%
+ \@law@shiftparas%
+ \@law@shortrecurse%
+ \fi%
+ \fi}%
+% \end{macrocode}
+% If {\em Id.} was not called for, we have to create
+% a proper short-form reference. This "\else" corresponds
+% with the "\@justabove" toggle, above.
+% \begin{macrocode}
+ \else%
+% \end{macrocode}
+% The author will be used in any case. Note that the author
+% and its following bridge may have been set to nil, above.
+% \begin{macrocode}
+ \global\ltokspecialface=\@ltok@authoroptionface%
+ {\the\@ltok@authormainface%
+% print whatever there if for the author
+ \@law@barinshort\the\@ltok@author}\the\@ltok@atot%
+% \end{macrocode}
+% The title information is also used, if it is present.
+% \begin{macrocode}
+ \global\ltokspecialface=\@ltok@titleoptionface%
+ {\the\@ltok@titlemainface%
+% \end{macrocode}
+% If we have specified a nickname for this cite for
+% `hereinafter' references, we use it instead of the
+% title of the work.
+%<*parabeta>
+[Some day this might be hooked up.]
+%</parabeta>
+% \begin{macrocode}
+ \@law@barinshort\the\@ltok@name}%
+% \end{macrocode}
+% At this point, we must make decisions concerning whether
+% to use the {\em supra\/} cross-referencing form. This
+% depends on the type of citation we are working on.
+% The "\@nosupra" condition is set to true if we are working
+% on a case or a statute, otherwise it is set to false.
+% \begin{macrocode}
+ \xdef\@law@temp{\the\@ltok@citetype}%
+ \ifx\@law@temp\@law@case%
+ \@nosupratrue%
+ \else%
+ \ifx\@law@temp\@law@statute%
+ \@nosupratrue%
+ \else%
+ \@nosuprafalse%
+ \fi%
+ \fi%
+% \end{macrocode}
+% Now we put the result of the above test to work.
+% First, the citation form for cases or statutes, which
+% do not permit the {\em supra\/} form.
+% \begin{macrocode}
+ \if@nosupra%
+% \end{macrocode}
+% \begin{macrocode}
+ \the\@ltok@ttocone%
+ \@law@shortprint%
+ \@law@shortrecurse%
+ \else%
+ \supra\the\@ltok@whereitsat\the\@ltok@pageorfootno%
+ \the\@ltok@atbridge%
+ {\def\,{,}%
+ {\@law@barkill\the\@ltok@argtwo\relax}}%
+ \fi%
+% \end{macrocode}
+% In order, these close "\if@justabove", "\if@law@longcite"
+% and "\if@law@printcite".
+% \begin{macrocode}
+ \xdef\@law@temp{\the\@ltok@citetype}%
+ \ifx\@law@temp\@law@statute%
+ \ifcat$\the\@ltok@citefirst$%
+ \the\@ltok@ptoctwo{\@law@barinshort\the\@ltok@citelast}%
+ \fi%
+ \fi%
+ \fi%
+\fi%
+\endgroup%
+\fi% <- end of if@law@printcite
+% \end{macrocode}
+% The "\@law@gobble" here will consume a period inserted
+% automatically after a forced footnote, if the printed
+% form turned out to be an {\em Id.}. See the concluding
+% code of "\@law@setup".
+% \changes{1994/07/26}{2.0c}{Moved {\tt\protect\string%
+% \protect\@law@forcingfalse} outside of a conditional
+% expression at the end of the print routine, to correct
+% the failure of the forcing mechanism to work more than once.}
+% \changes{1994/12/14}{2.0l}{Fairly drastic simplification
+% of the forcing mechanism, in the course of providing for
+% unified handling of citation strings. Code now much
+% easier to follow.}
+% \changes{1996/03/09}{0.1c}{Corrected a fatal bug in the
+% parallel pinpointing mechanmism. This required changes to both
+% Camel and the Law module; the list macro of pinpoints was
+% being parsed in both!}
+% \begin{macrocode}
+\global\@law@longcitefalse\gdef\volno{\message{(No volume %
+ for \the\@ltok@nickname)}}}%
+% \end{macrocode}
+% \begin{macro}{\@law@longrecurse}
+% This macro prints the tail end of long citations until
+% parallels are exhausted.
+% \begin{macrocode}
+\def\@law@longrecurse{%
+ \@law@longprint%
+ \ifnum\the\c@law@parapin>0\relax%
+ \loop%
+ \addtocounter{law@paracounter}{1}%
+ \ifnum\the\c@law@paracounter<\the\c@law@parapin\relax%
+ ; \@law@longprint%
+ \repeat%
+ \else%
+ \loop%
+ \addtocounter{law@paracounter}{1}%
+ \ifnum\the\c@law@paracounter>\the\c@law@paranormal\relax%
+ \else%
+ ; \@law@longprint%
+ \repeat%
+ \fi%
+% \end{macrocode}
+%
+% \textit{Finally, we print the last date item, which might
+% be blank if it's already been printed inside "\@law@longprint".}
+% \changes{1997/01/09}{v2.0m}{Fixed loss of citelast in parallel citations.}
+%
+% \begin{macrocode}
+ \@law@temp}
+\def\@law@shortrecurse{%
+ \ifnum\the\c@law@parapin>0\relax%
+ \loop%
+ \addtocounter{law@paracounter}{1}%
+ \ifnum\the\c@law@paracounter<\the\c@law@parapin\relax%
+ \@law@pincut\@ltok@argtwo\frompinlist%
+ ; \@law@shortprint%
+ \repeat%
+ \else%
+ \loop%
+ \addtocounter{law@paracounter}{1}%
+ \ifnum\the\c@law@paracounter>\the\c@law@paranormal\relax%
+ \else%
+ ; \@law@shortprint%
+ \repeat%
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@law@longprint}
+% \begin{macrocode}
+\def\@law@longprint{%
+ \begingroup%
+ \@law@fetchparas%
+ \@law@tidybridges%
+% \end{macrocode}
+% If for some reason either the pinpoint argument is nil,
+% or it {\em and\/} the location page token register is nil,
+% we set the accompanying bridges to nil.
+% \begin{macrocode}
+ \ifcat$\the\@ltok@argtwo$%
+ \global\@ltok@ptop{}%
+ \global\@ltok@atbridge{}%
+ \ifcat$\the\@ltok@citepage$%
+ \global\@ltok@conetop{}%
+ \fi%
+ \fi%
+% \end{macrocode}
+% \begin{macrocode}
+ \global\ltokspecialface=\@ltok@citefirstoptionface%
+ {\the\@ltok@citefirstmainface%
+ \@law@barinfull\the\@ltok@citefirst}%
+ \@law@conetopsetup%
+ \the\@ltok@conetop%
+% \end{macrocode}
+% Next comes the location page and its following
+% bridge. Both of these may be blank. No funny
+% business with the shorthand active characters is
+% required, since we assume this will not contain
+% any special text for which they will be required.
+% \begin{macrocode}
+ \the\@ltok@citepage\the\@ltok@ptop%
+% \end{macrocode}
+% A special use of "\," is defined before we expand
+% the optional argument stuff.
+% \begin{macrocode}
+ {\def\,{,}\@law@barkill%
+ \expandafter\the\@ltok@argtwo%
+ \relax}%
+% \end{macrocode}
+% \textit{And finally, we print the final portion of the citation.
+% We package the citation part together with its preceding bridge.
+% If it is printed, we blank it; this gives us a simple command that
+% we can put at the end of the recursive routine that invokes this
+% code, so that the tail end of a string cite will be printed if
+% necessary, and only once.}
+% \changes{1997/01/09}{v2.0m}{Modified current-and-last comparison
+% algorithm for the last portion of the cite in parallel citations.}
+%
+% \begin{macrocode}
+ \xdef\@law@temp{%
+ \the\@ltok@ptoctwo%
+ \noexpand\@law@barinfull%
+ \the\@ltok@citelast}%
+ \xdef\@law@temptwo{%
+ \the\@ltok@ptoctwo%
+ \noexpand\@law@barinfull%
+ \the\@ltok@usercitelast}%
+ \ifx\@law@temp\@law@temptwo%
+ \else%
+ {\@law@temp}%
+ \gdef\@law@temp{}%
+ \fi%
+ \@law@shiftparas%
+ \endgroup}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@law@shortprint}
+% \begin{macrocode}
+\def\@law@shortprint{%
+% If {\sc Camel} sees more than one pinpoint page or section,
+% the bridges preceding
+% the page references must be set to their plural form.
+% This change applies to both long and short form citations.
+% It has to be cloned in each, however, because the decision has
+% to be taken with respect to each cite in a string of parallels.
+% \begin{macrocode}
+ \begingroup%
+ \@law@fetchparas%
+ \@law@tidybridges%
+% \end{macrocode}
+% The actual recursive printing works.
+% \begin{macrocode}
+ \global\ltokspecialface=\@ltok@citefirstoptionface%
+ {\the\@ltok@citefirstmainface%
+ \@law@barinshort\the\@ltok@citefirst}%
+% \end{macrocode}
+% If the pinpoint reference is empty, we tack on the
+% location page after the appropriate bridge. Otherwise,
+% we do nothing for the present; any pinpoint reference
+% will be produced later on.
+% Note that the bridge
+% used here will only be in plural form if something was
+% given for use as a pinpoint reference.
+% NB: THIS IS A TEST!!!! ******** BRACKETS TO BE PULLED!!!!
+% \begin{macrocode}
+ \@law@conetopsetup%
+ \the\@ltok@conetop%
+ \ifcat$\the\@ltok@argtwo$%
+ \the\@ltok@citepage%
+ \else%
+ {\@law@barkill\the\@ltok@argtwo}%
+ \fi%
+ \@law@shiftparas%
+ \endgroup}%
+% \end{macrocode}
+% \end{macro}
+%
+% \paragraph{Print format subroutines}
+% \begin{macro}{\@law@casepreformat}
+% This is empty; no special preparations are necessary
+% for the printing of a case citation.
+% \begin{macrocode}
+\gdef\@law@casepreformat{}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@law@statutepreformat}
+% If short statutory references are in force,
+% the title and the following bridge are set to nil,
+% if some reference is provided in the first citation
+% part.
+% \begin{macrocode}
+\gdef\@law@statutepreformat{%
+\if@law@statuteverbose%
+\else%
+ \ifcat$\the\@ltok@citefirst$%
+ \else%
+ \global\@ltok@name{}%
+ \global\@ltok@ttocone{}%
+ \fi%
+\fi%
+}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@law@articlepreformat}
+% If a work by the identical author has been cited more than
+% once, we leave
+% everything intact (the print routine does the necessary
+% culling);
+% otherwise, we cut the title here. The use of
+% "\@law@authortracing"
+% is explained above.
+% \begin{macrocode}
+\gdef\@law@articlepreformat{%
+\ifcat$\the\@ltok@author$%
+\else%
+{\@law@clean\@ltok@author\@law@authortracing%
+\expandafter\expandafter\expandafter\if\expandafter%
+\csname\@law@authortracing\endcsname2%
+ \else%
+ \global\@ltok@atot{}\global\@ltok@name{}%
+\fi}\fi}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\@law@bookpreformat}
+% This provides the same treatment given to articles.
+% \begin{macrocode}
+\gdef\@law@bookpreformat{%
+\ifcat$\the\@ltok@author$%
+\else%
+{\@law@clean\@ltok@author\@law@authortracing%
+\expandafter\expandafter\expandafter\if\expandafter%
+\csname\@law@authortracing\endcsname2%
+ \else%
+ \global\@ltok@atot{}\global\@ltok@name{}%
+ \fi}\fi}%
+%</lawcitestyle>
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Camel citation formats}
+% The style definitions are stored in a separate file,
+% to make it easier and less risky for users to play with
+% the styles to produce desired output. Table 3
+% provides a guide to the macro arguments and their functions.
+% \subsubsection{Books} The styles used for citing books and
+% book-like things follow.
+% \begin{macrocode}
+%<*lawcite>
+\ProvidesFile{law.cit}[1994/12/07]
+\newcitestyle{book}%
+ {srsrrrB}
+ {[a],\ [t][c]\ [p](pl)\ [rp]\ [e]:[id]\ at~(pl)\ at~[xrf]}
+%
+\newcitestyle{booklet}%
+ {riririB}
+ {[a],\ [t][c]\ [p](pl)\ [rp]\ [e]:[id]\ at~(pl)\ at~[xrf]}
+%
+\newcitestyle{techreport}%
+ {riririB}
+ {[a],\ [t][c]\ [p](pl)\ [rp]\ [e]:[id]\ at~(pl)\ at~[xrf]}
+%
+\newcitestyle{mastersthesis}%
+ {riririB}
+ {[a],\ [t][c]\ [p](pl)\ [rp]\ [e]:[id]\ at~(pl)\ at~[xrf]}
+% \end{macrocode}
+% \subsubsection{Articles} Styles used for articles
+% and similar shortish things follow. They're all
+% the same, but the clones help keep things clear when following
+% the action between \LaTeX\ and \BibTeX.
+% \begin{macrocode}
+\newcitestyle{article}%
+ {rsirsrA}
+ {[a],\ [t],\ [c]\ [p],\ (pl),\ [rp]\ [e]:[id]\ at~(pl)\
+at~[xrf]}
+\newcitestyle{incollection}%
+ {rsirsrA}
+ {[a],\ [t],\ [c]\ [p],\ (pl),\ [rp]\ [e]:[id]\ at~(pl)\
+at~[xrf]}
+\newcitestyle{inbook}%
+ {srirsrA}
+ {[a],\ [t],\ [c]\ [p],\ (pl),\ [rp]\ [e]:[id]\ at~(pl)\
+at~[xrf]}
+% \end{macrocode}
+% \subsubsection{Cases} There are several styles for cases; we pretty
+% much need a separate style for each jurisdiction.
+% \begin{macrocode}
+\newcitestyle{case}%
+ {rrirrsC}
+ {[a][t],\ [c]\ [p],\ (pl),\ [rp]\ [e]:[id]\ at~(pl)\ at~[xrf]}
+% \end{macrocode}
+% \subsubsection{Statutes} There are several of these. More may
+% need to be added on an {\em ad hoc\/} basis.
+% \begin{macrocode}
+\newcitestyle{statute}%
+ {rrrsrsS}
+ {[a][t],\ [c]\ \S~[p](pl)\ \S\S~[rp]\ [e]:[id]\ \S~(pl)\
+\S\S~[xrf]}
+%
+\newcitestyle{jstatute}%
+ {rrrsrsS}
+ {[a][t][c]\ \S~[p](pl)\ \S\S~[rp]\ [e]:[id]\ \S~(pl)\
+\S\S~[xrf]}
+%</lawcite>
+% \end{macrocode}
+%
+% \section{Extraction utilities}
+% \subsection{The Driver}
+% Here is a simple driver for extracting the files in the
+% package.
+% \changes{1997/01/09}{v2.0m}{Brought installation file up to
+% date for use with the new docstrip utility.}
+%
+% \begin{macrocode}
+%<*installer>
+\def\batchfile{law.ins}
+\input docstrip.tex
+\preamble
+
+Copyright (C) 1992--97 Frank Bennett, Jr.
+All rights reserved.
+
+This file is part of the Law module for the Camel package.
+\endpreamble
+
+\def\batchfile{camel.dst} % ignored in distribution
+\input docstrip.tex % ignored in distribution
+
+\keepsilent
+
+\preamble
+This file is part of the Law module of the Camel package.
+---------------------------------------------------------
+This is a generated file.
+IMPORTANT NOTICE:
+
+You are allowed to change this file, subject to the following
+conditions. Under any circumstances, new macro definitions
+should not be added to this file. You are welcome to modify
+the macro definitions contained in this file for your own
+use. If you pass a copy of the modified version to someone
+else, you should (a) let me know about the change on
+fb@soas.ac.uk, and (b) put a note of the changes and of your
+own contact details in the file. Furthermore, you must
+acknowledge Camel and its author(s) in the new file (if it
+is distributed to others), and you must attach these same
+conditions to the new file.
+
+You are not allowed to distribute this file alone. You are not
+allowed to take money for the distribution or use of this file
+(or a changed version) except for a nominal charge for copying
+etc.
+
+You are allowed to distribute this file under the condition that
+it is distributed with all of its contents, intact.
+
+For error reports, or offers to help make this a more powerful,
+friendlier, and better package, please contact me on
+`fb' at soas.ac.uk
+
+\endpreamble
+
+
+\generate{\file{law.cst} {\from{law.dtx}{lawcitestyle}}
+ \file{law.cit} {\from{law.dtx}{lawcite}}}
+
+
+\postamble
+\endpostamble
+
+%<installer>% Change eng to jse below for JBibTeX support
+
+\generate{\file{law.bst} {\from{camel.dtx}{bstheader,eng}
+ \from{law.dtx}{bstheader,eng}
+ \from{camel.dtx}{bstlibrary,eng}
+ \from{law.dtx}{bstfunctions,eng}
+ \from{camel.dtx}{bsttrailer,eng}}}
+
+\keepsilent
+
+
+\ifToplevel{
+\Msg{***********************************************************}
+\Msg{*}
+\Msg{* To finish the installation you have to move the following}
+\Msg{* file into a directory searched by TeX:}
+\Msg{*}
+\Msg{* \space\space law.cst}
+\Msg{* \space\space law.cit}
+\Msg{*}
+\Msg{* You should also move the following file into a directory}
+\Msg{* searched for style files by BibTeX:}
+\Msg{*}
+\Msg{* \space\space law.bst}
+\Msg{*}
+\Msg{* Other style modules can be found on CTAN in the `styles'}
+\Msg{* subdirectory below Camel itself.}
+\Msg{*}
+\Msg{***********************************************************}
+}
+%</installer>
+% \end{macrocode}
+% \Finale \PrintIndex \PrintChanges
diff --git a/macros/latex/contrib/camel/law.ins b/macros/latex/contrib/camel/law.ins
new file mode 100644
index 0000000000..29d36927ec
--- /dev/null
+++ b/macros/latex/contrib/camel/law.ins
@@ -0,0 +1,105 @@
+%%
+%% This is file `law.ins',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% law.dtx (with options: `installer')
+%%
+%% IMPORTANT NOTICE:
+%%
+%% For the copyright see the source file.
+%%
+%% You are *not* allowed to modify this file.
+%%
+%% You are *not* allowed to distribute this file.
+%% For distribution of the original source see
+%% the terms for copying and modification in the file law.dtx.
+%%
+\def\batchfile{law.ins}
+\input docstrip.tex
+\preamble
+
+Copyright (C) 1992--95 Frank Bennett, Jr.
+All rights reserved.
+
+This file is part of the Law module for the Camel package.
+\endpreamble
+
+\def\batchfile{camel.dst} % ignored in distribution
+\input docstrip.tex % ignored in distribution
+
+\keepsilent
+
+\preamble
+This file is part of the Law module of the Camel package.
+---------------------------------------------------------
+This is a generated file.
+IMPORTANT NOTICE:
+
+You are allowed to change this file, subject to the following
+conditions. Under any circumstances, new macro definitions
+should not be added to this file. You are welcome to modify
+the macro definitions contained in this file for your own
+use. If you pass a copy of the modified version to someone
+else, you should (a) let me know about the change on
+fb@soas.ac.uk, and (b) put a note of the changes and of your
+own contact details in the file. Furthermore, you must
+acknowledge Camel and its author(s) in the new file (if it
+is distributed to others), and you must attach these same
+conditions to the new file.
+
+You are not allowed to distribute this file alone. You are not
+allowed to take money for the distribution or use of this file
+(or a changed version) except for a nominal charge for copying
+etc.
+
+You are allowed to distribute this file under the condition that
+it is distributed with all of its contents, intact.
+
+For error reports, or offers to help make Camel a more powerful,
+friendlier, and better package, please contact me on
+`fb' at soas.ac.uk
+
+\endpreamble
+
+\generate{\file{law.cst} {\from{law.dtx}{lawcitestyle}}
+ \file{law.cit} {\from{law.dtx}{lawcite}}}
+
+\Msg{*** Generating Camel BibTeX style file (.bst) ***}
+
+\postamble
+\endpostamble
+
+% Change eng to jse below for JBibTeX support
+
+\generate{\file{law.bst} {\from{camel.dtx}{bstheader,eng}
+ \from{law.dtx}{bstheader,eng}
+ \from{camel.dtx}{bstlibrary,eng}
+ \from{law.dtx}{bstfunctions,eng}
+ \from{camel.dtx}{bsttrailer,eng}}}
+
+\keepsilent
+
+\ifToplevel{
+\Msg{***********************************************************}
+\Msg{*}
+\Msg{* To finish the installation you have to move the following}
+\Msg{* file into a directory searched by TeX:}
+\Msg{*}
+\Msg{* \space\space law.cst}
+\Msg{* \space\space law.cit}
+\Msg{*}
+\Msg{* You should also move the following file into a directory}
+\Msg{* searched for style files by BibTeX:}
+\Msg{*}
+\Msg{* \space\space law.bst}
+\Msg{*}
+\Msg{* Other style modules can be found on CTAN in the `styles'}
+\Msg{* subdirectory below Camel itself.}
+\Msg{*}
+\Msg{***********************************************************}
+}
+\endinput
+%%
+%% End of file `law.ins'.