[comp.text.tex] Even newer `newapa.sty' - APA style citations

young@emx.utexas.edu (Young U. Ryu) (06/13/91)

Here is a newer version of `newapa.sty'
for APA (American Psychology Association) style.

Newer things are

	1. The extra space bug has been fixed.
	   (Thanks to Raymond Chen)
	2. More citation formats.
	3. You may change citation punctuations
	4. You may enforce APA style section headings

Report any bug to:
	young@emx.utexas.edu
	youngr@utxvm.bitnet

Read comments of the style file

Enjoy...

Young U. Ryu
young@emx.utexas.edu


%$$$ newapa.sty $$$  --- June 12, 1991
%
% This file implements citations for the ``newapa'' bibliography style.
%
%
%    Stephen N. Spencer
%           modified the ``apalike'' LaTeX style
%    Young U. Ryu
%           further modified
%
% SEE THE FOLLOWING COMMENTS. THEY CONSISTS OF 4 SECTIONS
%   1 - newapa.bst and \bibitem entry
%   2 - citation formats
%   3 - changing citation functions (if you want)
%   4 - enforcing APA style section heading (if you want)
%
%%%%%
% [1] newapa.bst and \bibitem entry
%
% The ``newapa.bst'' BibTeX bibliography style creates citations with labels:
%       \citeauthoryear{author-info}{abbrev. author-info}{year}
%
%%%%%
% [2] Citation Formats
%
% The citations are enclosed within parentheses. ``(,)''
% Abbreviated author lists use the ``et al.'' construct.
% These labels are processed by the following LaTeX commands:
%
% \cite[optional notes] -> (Full Author List, Year)
% \citeA[optional notes]{key} -> Full Author List (Year)
% \citeauthor[optional notes]{key} -> Full Author List
% \shortcite[optional notes]{key} -> (Short Author List, Year)
% \shortciteA[optional notes]{key} -> Short Author List (Year)
% \shortciteauthor[optional notes]{key} -> Short Author List
% \citeyear[optional notes]{key} -> (Year)
%
%%%%%
% [3] Changing Citation Punctuations
%
% However, you may change citation punctuations.
% \citepunct{open paren}%
%           {between author year}%
%           {between citations}%
%           {before notes}%
%           {closing paren}
%
% For example,
%   \citepunct{[}{ }{, }{, }{]}
%        - use square brackets
%          space between author and year
%          comma between citations
%          comma before notes
%     e.g. [Apt 1986, Lloyd 1985]
%
% The default is:
%   \citepunct{(}{, }{; }{, }{)}
%
%%%%%
% [4] Enforcing APA Style Section Heading 
%
% \newapasectioning redefines section headings as described
%       by the APA Publication Manual
%       \section - level 1       (toc entry, paageheading)
%       \subsection - level 2    (toc entry)
%       \subsection - level 3    (toc entry)
%       \paragraph - level 4
%       \subparagraph - level 3
%
%  if place * after \section, \subsection, \subsubsection
%   section headings are not listed in the table of contents
% 
\def\@cite@start{(}
\def\@between@author@year{, }
\def\@between@cites{; }
\def\@before@note{, }
\def\@cite@end{)}
%
\def\citepunct#1#2#3#4#5{%
    \def\@cite@start{#1}
    \def\@between@author@year{#2}
    \def\@between@cites{#3}
    \def\@before@note{#4}
    \def\@cite@end{#5} }
%
\let\@internalcite\cite
%
% comment: \cite -> (Full Author List, Year)
% comment: \citeA -> Full Author List (Year)
% comment: \citeauthor -> Full Author List
%
\def\cite{\def\@citeseppen{-1000}%
    \def\@cite##1##2{\@cite@start##1\if@tempswa \@before@note##2\fi\@cite@end}%
    \def\citeauthoryear##1##2##3{##1\@between@author@year##3}\@internalcite}
\def\citeA{\def\@citeseppen{-1000}%
    \def\@cite##1##2{{##1}\if@tempswa \@before@note##2\@cite@end\else\@cite@end\fi}%
    \def\citeauthoryear##1##2##3{##1 \@cite@start##3}\@citedata}
\def\citeauthor{\def\@citeseppen{-1000}%
    \def\@cite##1##2{##1\if@tempswa \@before@note##2\fi}%
    \def\citeauthoryear##1##2##3{##1}\@citedata}
%
% comment: \shortcite -> (Short Author List, Year)
% comment: \shortciteA -> Short Author List (Year)
% comment: \shortciteauthor -> Short Author List
%
\def\shortcite{\def\@citeseppen{-1000}%
    \def\@cite##1##2{\@cite@start##1\if@tempswa \@before@note##2\fi\@cite@end}%
    \def\citeauthoryear##1##2##3{##2\@between@author@year##3}\@internalcite}
\def\shortciteA{\def\@citeseppen{-1000}%
    \def\@cite##1##2{{##1}\if@tempswa \@before@note##2\@cite@end\else\@cite@end\fi}%
    \def\citeauthoryear##1##2##3{##2 \@cite@start##3}\@citedata}
\def\shortciteauthor{\def\@citeseppen{-1000}%
    \def\@cite##1##2{##1\if@tempswa \@before@note##2\fi}%
    \def\citeauthoryear##1##2##3{##2}\@citedata}
%
% comment: \citeyear -> (Year)
%
\def\citeyear{\def\@citeseppen{-1000}%
    \def\@cite##1##2{\@cite@start##1\if@tempswa \@before@note##2\fi\@cite@end}%
    \def\citeauthoryear##1##2##3{##3}\@citedata}
%
\def\@citedata{\@ifnextchar[{\@tempswatrue\@citedatax}{\@tempswafalse\@citedatax[]}}
%
\def\@citedatax[#1]#2{%
\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi
  \def\@citea{}\@cite{\@for\@citeb:=#2\do
    {\@citea\def\@citea{\@before@note}\@ifundefined
       {b@\@citeb}{{\bf ?}\@warning
       {Citation `\@citeb' on page \thepage \space undefined}}
{\csname b@\@citeb\endcsname}}}{#1}}
%
\def\@citex[#1]#2{%
\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi
  \def\@citea{}\@cite{\@for\@citeb:=#2\do
    {\@citea\def\@citea{\@between@cites}\@ifundefined
       {b@\@citeb}{{\bf ?}\@warning
       {Citation `\@citeb' on page \thepage \space undefined}}%
{\csname b@\@citeb\endcsname}}}{#1}}
%
% (from apalike.sty)
% No labels in the bibliography.
% Set length of hanging indentation for bibliography entries.
\def\@biblabel#1{}
\newlength{\bibhang}
\setlength{\bibhang}{2em}
%
\def\thebibliography#1{\section*{References}
 \addcontentsline{toc}{section}{References}
 \list
  {\relax}{\setlength{\labelsep}{0em}
    \setlength{\itemindent}{-\bibhang}
    \setlength{\leftmargin}{\bibhang}}
    \def\newblock{\hskip .11em plus .33em minus .07em}
    \sloppy\clubpenalty4000\widowpenalty4000
    \sfcode`\.=1000\relax}
%
%
%
%%% Sectioning

\def\newapasectioning{
 \newlength{\sectionheadwidth}
 \setlength{\sectionheadwidth}{\textwidth}
 \addtolength{\sectionheadwidth}{-8em}
 \let\@internalsection\section
 \let\@internalsubsection\subsection
 \let\@internalsubsubsection\subsubsection
 \let\@internalparagraph\paragraph
 \let\@internalsubparagraph\subparagraph
 % Level 1
 \def\section{\@ifnextchar *{\a@sections}{\a@section}}
 \def\a@sections##1##2{%
 \@internalsection*{%
     \centering\parbox{%
         \sectionheadwidth}{%
             \centering\normalsize\bf\uppercase{##2}}\@mkboth{##2}{##2}}}
 \def\a@section##1{%
 \addcontentsline{toc}{section}{##1}
 \@internalsection*{%
     \centering\parbox{%
         \sectionheadwidth}{%
             \centering\normalsize\bf\uppercase{##1}}\@mkboth{##1}{##1}}}
 % Level 2
 \def\subsection{\@ifnextchar *{\a@subsections}{\a@subsection}}
 \def\a@subsections##1##2{%
 \@internalsubsection*{%
     \centering\parbox{\sectionheadwidth}{\centering\normalsize\bf##2}}}
 \def\a@subsection##1{%
 \addcontentsline{toc}{subsection}{##1}
 \@internalsubsection*{%
     \centering\parbox{\sectionheadwidth}{\centering\normalsize\bf##1}}}
 % Level 3
 \def\subsubsection{\@ifnextchar *{\a@subsubsections}{\a@subsubsection}}
 \def\a@subsubsections##1##2{%
 \@internalsubsubsection*{%
     \centering\parbox{%
         \sectionheadwidth}{\centering\normalsize\underbar{##2}}}}
 \def\a@subsubsection##1{%
 \addcontentsline{toc}{subsubsection}{##1}
 \@internalsubsubsection*{%
     \centering\parbox{%
         \sectionheadwidth}{\centering\normalsize\underbar{##1}}}}
 % Level 4
 \def\a@paragraph##1{%
     \@internalsubsubsection*{\normalsize\underbar{##1}}}
 % Level 5
 \def\a@subparagraph##1{%
     \@internalsubparagraph*{\normalsize\underbar{##1}.}}
 % table of contents
 \def\tableofcontents{%
     \section*{Contents}\@starttoc{toc}}
 % list of figures
 \def\listoffigures{%
     \section*{List of Figures}\@starttoc{lof}}
 % list of tables
 \def\listoftables{%
     \section*{List of Tables}\@starttoc{lot}}
 % Change : to . in Figure/Table Caption
 \long\def\@makecaption##1##2{
     \vskip 10pt 
     \setbox\@tempboxa\hbox{##1. ##2}
     \ifdim \wd\@tempboxa >\hsize ##1. ##2\par \else \hbox
     to\hsize{\hfil\box\@tempboxa\hfil} 
     \fi}
}