A More Complicated Example

\input lanlmac
\def\href#1#2{\special{html:<a href="#1">}{#2}\special{html:</a>}}

\Title{HUTP-91/A000}{This is the Template}

%For more complicated situations, substitute for {\it either\/} argument:
%\Title{\vbox{\baselineskip12pt\hbox{HUTP-88/A000}\hbox{SLAC-PUB 88-001}
%		\hbox{photocopy at own risk}}}
%{\vbox{\centerline{This title is too long to fit}
%	\vskip2pt\centerline{comfortably on one line*}}}
%   \footnote{}{*optional footnote on title}

\centerline{Author One and Author Two\footnote{$^\dagger$}
{(author@huhepl.hepnet, \ @huhepl.bitnet, \ or \ @huhepl.harvard.edu)}}
\bigskip\centerline{Lyman Laboratory of Physics}
\centerline{Harvard University}\centerline{Cambridge, MA 02138}

%if too many authors for abstract on same page, say   \vfill\eject\pageno0

\vskip .3in
This modified version of the file harvsamp.tex shows the
use of the package lanlmac, which is a version of harvmac modified for
use with hyperdvi previewers.  It shows how the ordinary harvmac
macros can produce automatic hyperlinks.  Here is a gratuitous network
hyperlink to \href{http://xxx.lanl.gov/}{xxx}.

This sample is produced by the file `sample.tex' in the directory
tex\$macros and is intended to exhibit the conventions used in the
file `harvmac.tex' also in this directory, as inputted above.  {\it
(You do not need to copy {\rm tex\$macros:harvmac.tex} into your own
directory\/}, nor do you need to explicitly specify its directory as
long as there is no harvmac.tex in your default directory.)  The
vskips, etc., on this title page have been chosen to give a reasonable
looking HUTP style preprint in either full-sized or reduced format
(selected by typing b or $\ell$ in response to the big/little query
from the macro).  Note that the `Title' and `Date' macros should be
used together to choose fonts and horizontal size appropriately,
suppress first page number, etc., for `big' and `little' formats with
title page. One may most easily start a new paper by making a copy of
this sample and then replacing the dummy text with something
potentially more interesting. It is useful to read pp.~1--54, 127--201
of Knuth's {\it Texbook\/}.

\Date{4/91} %replace this line by \draft  for preliminary versions
            %or specify \draftmode at some point

%if you want double-space, use e.g. \baselineskip=20pt plus 2pt minus 2pt

\listtoc\writetoc     %(if desired, takes 2 passes)

Here is another gratuitous network hyperlink, this time to
\href{http://xxx.lanl.gov/hypertex/}{xxx hypertex}, again to check
messaging to your www client.

\newsec{Introduction}

Sections are begun 
\def\\#1 {{\tt\char'134#1} }% (defines \\ to single backslash in macro names)
using the macro \\newsec as above. For papers without separate sections, 
leave out \\newsec and equations will automatically be numbered consecutively 
(without section numbers).

References are done using the macro \\ref as follows\ref \rIi{John
Q. Physicist, Phys. Rev. D20 (1980) 1234.}\ref\rIii{Author One and
Author Two, Nucl. Phys. B52 (1975) 439.}.  The labels on the
references\rIi\ and \rIii\ (which include the brackets, note the
second backslash to provide a space) can then be used to refer back to
them\rIi. (note no extra backslash needed before period\rIii, or
before comma.) Here is how to put two papers in one reference\ref
\rAG{L. Alvarez-Gaum\'e and P. Ginsparg, ``The Structure of Gauge and
Gravitational Anomalies,'' Harvard preprint HUTP-84/A016, to appear in
Ann. Phys.\semi L. Alvarez-Gaum\'e and P. Ginsparg, Nucl. Phys. B243
(1984) 449.}.  Note the use of the macro \\semi %(= ;\hfil\break) to
separate them (the macro \\nref can be used to suppress the immediate
appearance of the bracketed reference number in the text if
desired\ref \rSP{Seminal Paper.}% \nref\rMIF{Moderately Interesting
Follow-ups.}% --\ref\rCUR{Completely Useless Ripoffs.}). The
references are listed in the file refs.tmp, and can be of arbitrary
length.

The macro \\foot is used for footnotes.\foot{like this} They also get
automatically numbered\foot{consecutively} throughout the paper.

To do equations we use the macro \\eqn
%
\eqn\eIi{R^a{}_b=d\om ab+\om ac\wedge\om cb}
%
and
%
\eqn\eIii{\om a{{b,\mu}}\equiv e^a{}_\nu\grad\mu e_b{}^\nu=
-e_b{}^\nu\grad\mu e^a{}_\nu.}
%
The equations are then referred to (see \eIi\ or \eIii) using the
label (which includes the parentheses).  In draftmode, the equation
labels appear in the right margin next to the equation.

%To start in the middle of text, initialize for example with
%\pageno=5\secno=3\meqno=2\startrefs{24}%\draftmode

\newsec{Body}

Ordinarily one uses equations with internal eqaligns:
%
\eqn\eIIx{\eqalign{&d=2+2=4\cr
&d=2\times 2=4.\cr}}
%
(How could Nature fail to avail herself of such a fine opportunity to base
herself on the remarkable numerical coincidence embodied in eqn.~\eIIx?)
To specify equation numbers in aligned equations and/or equations
specified with a's, b's, etc., just tag the equation numbers first
using the macro \\eqnn or \\eqna and then use \\eqalignno
\eqna\eIIi	%(only for equation labels with a,b type argument)
\eqnn\eIIii
%
$$\eqalignno{\left(\int_{-\infty}^\infty e^{-x^2}\,dx\right)^2
&={\rm something}&\eIIi a\cr
&={\rm something\ else}\cr
&=\pi&\eIIi b\cr
&=2\pi/2.&\eIIii\cr}$$
%
We can then easily refer back to \eIIii\ or \eIIi{a}\ or \eIIi{a,b}\ 
or even \eIIi{a\hbox{--}c}\ (\\eqna defines a label which takes an argument
$\{a,b,\ldots\}$ when used to refer back; it could be used instead of
\\eqnn if one remembers to type $\{\}$ after the label when referring
back, e.g., \eIIi{}\ ).  (Note also that \\nref and \\eqnn can always be
used to simulate macro packages that require a separate macro to define
labels in advance of using them.)

To list the references, use the macro \\listrefs as at the end of
this file\foot{In draftmode reference labels appear in left margin
next to reference.}.

\newsec{Conclusion}

\seclab\sconcl %   (defines a section label for later use)
To call Tex on a source file filename.tex, issue the command
$$\hbox{\$ tex filename}$$
which creates a file filename.dvi (and also a filename.log file).
The macro package will ask you whether you want ``big''
output, ordinary typewritten pages, or ``little,'' reduced two-column pages
suitable for preprinting.
(Default is for postscript laserprinters. In order to print out in
reduced format on qms printer at HEPL, you need to specify \\qms
after inputting the macros.)

\subsec{At Lyman}

After eliminating any tex errors in your manuscript, issue the command
%
$$\hbox{\$ lw filename}$$
%
to convert the .dvi file to a postscript file that is then automatically
sent to the lyman laserwriter.
(To process only selected portions of a .dvi file,
type instead \ \$ dvips filename --- then type i for interactive [or
? for help at any time].
\$ lw filename.ps with explicit .ps extension then sends the .ps
file to the Lyman laserwriter.)

\subsec{At HEPL}

\subseclab\shepl %   (defines a subsection label for later use)
(at hepl, use instead
%
$$\hbox{\$ qmstex filename}$$
%
to convert the .dvi file to a .qms file that is then automatically
sent to the hepl laserprinter).  Before logging off, it is
probably preferable to get rid of any .ps, .dvi, .qms, and .log files.


\bigbreak\bigskip\bigskip\centerline{{\bf Acknowledgements}}\nobreak
This work was supported in part by various colleagues.  We also thank
NSF contract PHY-82-15249 for discussions.

\appendix{A}{}

Everything same as before, now equations appear as (A.1), etc.
Appendix A has no title.

\appendix{B}{Enhancements added, 11/88}

For fancier treatment of multiple references, say \refs{\rSP{--}\rCUR},
\refs{\rIii,\rSP}, or even \refs{\rIi,\rIii,\rAG{--}\rCUR}. (The arguments
have to be previously defined references, so use \\nref before for any
first occurrences.) To strip off the brackets from a single reference for
some reason, use \\xref to give \xref\rIi\ instead of \rIi.

To refer to equations (or references) that occur much later in the
paper, add \\writedefs after inputting macros.
This redefines the equation and reference macros so they write all the
label definitions to a file labeldefs.tmp. Then tex a second time with a
line inputting this file.  To start from the middle of a paper, tex
the first part with \\writedefs and \\writestop %i.e. \writedefs\writestop
(the latter adds to labeldefs a line with the pagenumber, section number,
etc., at the point \\listrefs was called).  Inputting labeldefs.tmp then
starts the continuation where the previous left off, and allows referring
to any of the previously defined reference and equation labels.

The subsection option in section 3 above is also new.

Another macro, \\footend, redefines \\foot so that it writes the footnotes
in a file foots.tmp, which is then automatically called in by \\listrefs
before the references. For journals that prefer the footnotes at the
end, one can thus add \\footend after inputting harvmac,
with no other changes necessary.

A new macro \\fig (also \\nfig, \\figs, \\xfig) works for figures just
as does \\ref. The label is defined to include the abbreviation fig.
For papers with thousands of figures, the macro
\fig\flabel{This is the figure caption}. This works exactly as does
\ref\rlabel{For a compendium of references missing here, see M. Green,
J. Schwarz, and E. Witten, {\it Superstring theory\/}, Vols. I,II,
Cambridge Univ. Press (1987).}, with the label defined to include the
abbreviation `fig.~'.  The macro \\nfig suppresses immediate appearance of
`fig.~x', \nfig\flabi{second dummy figure}\nfig\flabii{third dummy figure}%
so that one can instead say, for example, \figs{\flabi,\flabii}\
using the macro \\figs.   %(here gives figs.~2,3)
\\xfig strips off the `fig.~' to leave just the figure number,
i.e.\ \xfig\flabel, if necessary for some reason.
The figure captions are written in a file figs.tmp that is called in by
saying \\listfigs after \\listrefs.
(Note that the formerly used macro \\figures need not be used if 
\\fig is instead used in conjunction with \\listfigs.)

% Instead of \listfigs, if \fig not used in text, after \listrefs say
%
%\figures  	% former version, still supported
%\fig{1}{This is the first figure caption.}
%\fig{2}{This is the second figure caption.}
%\fig{3}{Note that \\fig automatically types a colon and lines up the
%text properly.}
%
%\parindent=20pt

\appendix{C}{Enhancements added, 6/89}
\applab\appC

A macro \\seclab  sets a label equal to the current section number, useful
for referring back to the section, e.g.\ as used in section \sconcl\ above
(also there's \\applab for appendices, as in see appendix~\appC).
Similarly, \\subseclab sets a label equal to the current
section.subsection, as in the definition of subsection \shepl\ in the ``at
HEPL'' subsection above (and \\subseclab as well works within subsections
of appendices).
(Using \\writedefs, these definitions will appear in labeldefs.tmp so can
be used as well to refer forward. In draftmode, the definitions appear in
the right margin.)

A macro \\writetoc writes a file \\jobname.toc that contains section and
subsection  numbers and headings with the pagenumbers on which they appear.
The macro \\listtoc writes the heading {\bf Contents} and inputs the file
(if it exists).
%(Note that the pagenumbers will not come out properly in ``little'' mode
% --- the easiest (and least elegant) way around this is to set
% \output={\plainoutput} (after harvmac input) to produce toc.tmp,
% then remove and tex again with \\listtoc to produce final .dvi file.

\appendix{D}{Enhancements added, 1/91}

A macro \\lref (same syntax as \\ref and \\nref) 
\lref\reflabel{Another reference.}
defines the reflabel to be a macro that calls \\ref on itself.
This allows making a list of references via \\lref (in any order) at the 
beginning of a file and only those used in the text will actually appear
(automatically listed in correct order of first appearance by \\listrefs).
(In principle \\lref can be used to compile a long standard reference file 
to input, although this might eventually cause problems due to clogging up tex
memory with too many unused definitions.)

\lref\riii{extra ref three.}
\lref\rii{extra ref two.}
\lref\ri{extra ref one.}
\\refs is defined to not display reference labels that appear in succession
(i.e.\ without intervening delimiter), so that e.g.\ \refs{\ri\rii{--}\riii}
can expand the middle reference \rii\ if it hasn't already appeared.
\\refs will also accept reflabels that are not previously defined so that it is
possible to tex preliminary versions without inputting full reference list
(For this mode, even individual refs, e.g.\ \refs{\reflabel}, need to be
called via \\refs.)

The macro \\sequentialequations inserted at beginning causes 
equations to be numbered sequentially (1)--(n) throughout paper 
(rather than with section numbers (2.1)$\ldots$).

\appendix{E}{Hypertex, 7/94 (hyperbasics.tex macros written by Tanmoy)}

This modified version of the file harvsamp.tex shows the use 
of the macropackage lanlmac, 
which is a version of harvmac modified for use with 
hyperdvi previewers (and ultimately pdf viewers, where pdf is Adobe's
modification of ps to incorporate a hyperlink overlay).
It shows how the ordinary harvmac macros can produce 
automatic hyperlinks by appropriate use of the macros from the
underlying hyperbasics.tex.

In addition to the automated linkages,
one can explicitly define a \hyperdef\mysymbol
{usersymbol}{1}{target} or link (e.g.\ \hyperref{}{appendix}{E}{to E})
using the \\hyperdef and \\hyperref macros.
\goodbreak

The \\hyperdef macro takes four parameters: 
\item{\bf\#1} A macro name (label) which is defined so that
                 \\hyperref can refer back.
\item{\bf\#2} A category for the target: So as to not conflict with
     predefined categories (page, reference, section, etc.), use a category
     whose name starts with {\tt user}.
\item{\bf\#3} A unique name inside the category.
\item{\bf\#4} The text which is to be target of the link.

\def\\#1 {{\tt\char'134#1}}
The above target was created using
{\tt \\hyperdef \\mysymbol $\{$usersymbol$\}\{1\}\{$target$\}$}.
So, one can point back to it from \hyperref\mysymbol{here} by invoking
{\tt \\hyperref \\mysymbol $\{$here$\}$}.

A different use of \\hyperref \ is to refer to a target of
any category inside a dvi file. In such a use, it takes four arguments:
 \item{\bf\#1} A file name. This parameter should be $\{\}$ to refer to
                 the current file.
 \item{\bf\#2} A category name. So far the categories used are: {\tt section,
                 subsection, appendix, equation, footnote, reference, 
                 figure, table, and page}. 
               Users can of course define additional categories.
 \item{\bf\#3} A unique name inside the category. The attempt has been
                 to use the printed label as the unique name whenever
                 possible.
 \item{\bf\#4} The text below the link.

\noindent
Thus \hyperref{}{reference}{7}{this link} was generated using {\tt \\hyperref
$\{\}\{$reference$\}\{7\}\{$this link$\}$}.
\bigskip
Other macros defined are \\href \ (analogous to 
html's $<$a href="URL"$>$text$<$/a$>$
and useful for external URL's, e.g.\
link to {\tt \\href $\{$http://xxx.lanl.gov/$\}\{$xxx$\}$} as used above
the \hyperref{}{section}{1}{introduction}), and
\\hname , which allows defining a custom 
{\tt \\hname $\{$target$\}\{$some text$\}$}
(analogous to html's $<$a name="target"$>$some text$<$/a$>$ ).


\listrefs
\listfigs   %(if necessary)
\bye

Last modified: Thu May 2 13:27:38 1996