view writeup/mlapa.sty @ 451:227ebc0be7ae

Add a graph for the NIST training set and normalize the values.
author Arnaud Bergeron <abergeron@gmail.com>
date Mon, 10 May 2010 13:44:11 -0400
parents a11274742088
children
line wrap: on
line source

% mlapa.sty style, used in conjunction with mlapa.bst, will produce 
% an APA-like bibliography style. 
%
% 1) Bibliography entries formatted alphabetically, last name
%    first, each entry having a hanging indentation and no label.
% 2) References in the following formats:
%		(Author, 1986)
%		(Author & Author, 1986)
%		(Author et al., 1986).
% 3) Multiple references in the form (Author1, 1986; Author2, 1987)
%
% To be used as an optional argument to the \documentstyle command; for example
%	\documentstyle[11pt,apalike]{book}
%
% 16-Sep-86, original version by Susan King and Oren Patashnik.
% 13-Oct-87 changes:
%	Fixed bug in last line by adding the {} that disappeard when
%		the \hbox{} was removed from the pre-APALIKE definition;
%	added club and widow penalties;
%	patched the \newblock LaTeX bug from `-.07em' to simply `.07em';
%	and made this work for document styles that don't define `chapter'.
%       Use brackets for \cite, and no label in the bibliography
%
% 12/11/89 Use parenthesis () for \cite, (Risto Miikkulainen)
%
% ---------------------------------------------------------------------------
% The following major changes by Risto Miikkulainen 4/8/92:
% new style name: myapalike.sty
%
% The new commands below generate various embedded citations and multiple
% years for one authorname and citations without the enclosing parenthesis.
% They are enough to generate the standard apa style refs; however,
% there is a lot of room for improvement. For example:
% - the macros should alphabetize the entries automatically (maybe);
% - they should generate multiple years automatically, i.e. if the
%   current author is the same as previous one, do not repeat it.
%   This would make \single macros unnecessary.
% - with multiple emcites, it should add commas and the word ``and''
%   automatically between cites.
% - Bug: in book style sometimes all the bib entries are dumped on an
%   extra page in the end. (Just throw that page away if it ever appears.)
% - Another bug: for some reason, latex adds extra space after et al.
%   with emcites and singlecites. 
% If you have a chance to fix any of these things, let me know.
%
% You have to use this style with myapalike.bst; it generates bibitems
% of the form 
% \bibitem[Elman, 1989a][Elman][1989a]{elman:representation}
% that this file expects to find in the bbl file.
%
% Examples of commands and what they generate:
%
%\cite{foobar:1990,doesmith:1991} -- (Foo and Bar 1990; Doe and Smith 1991)
%\aucite -- (Foo and Bar; Doe and Smith)
%\aunpcite -- Foo and Bar; Doe and Smith
%\yrcite -- (1990; 1991)
%\yrnpcite  -- 1990; 1991
%\npcite -- Foo and Bar 1990; Doe and Smith 1991
%\emcite -- Foo and Bar (1990); Doe and Smith (1991)
%\singlecite -- (Foo and Bar 1990, 1991)
%\singlenpcite -- Foo and Bar 1990, 1991
%\singleemcite -- Foo and Bar (1990, 1991)

% Additional changes made by Pat Langley (1/20/2000). 

\def\@biblabel#1{}

% Set length of hanging indentation for bibliography entries
%
\newlength{\bibhang}
% \setlength{\bibhang}{2em}
% Reduce the handing indent for two-column format
\setlength{\bibhang}{10pt}

% \thebibliography environment depends on whether or not `chapter's can exist
%
\@ifundefined{chapter}{\def\thebibliography#1{\section*{References\@mkboth
  {REFERENCES}{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}}%
{\def\thebibliography#1{\chapter*{Bibliography\@mkboth
  {BIBLIOGRAPHY}{BIBLIOGRAPHY}}\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}}

% `; ' goes between cites, and there's no \hbox around individual cites
%
\def\@citex[#1]#2{\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi
  \def\@citea{}\@cite{\@for\@citeb:=#2\do
    {\@citea\def\@citea{; }\@ifundefined
       {b@\@citeb}{{\bf ?}\@warning
       {Citation `\@citeb' on page \thepage \space undefined}}%
{\csname b@\@citeb\endcsname}}}{#1}}

\def\aucite{\@ifnextchar [{\@tempswatrue\@aucitex}{\@tempswafalse\@aucitex[]}}
\def\aunpcite{\@ifnextchar [{\@tempswatrue\@aunpcitex}{\@tempswafalse\@aunpcitex[]}}
\def\yrcite{\@ifnextchar [{\@tempswatrue\@yrcitex}{\@tempswafalse\@yrcitex[]}}
\def\yrnpcite{\@ifnextchar [{\@tempswatrue\@yrnpcitex}{\@tempswafalse\@yrnpcitex[]}}
\def\npcite{\@ifnextchar [{\@tempswatrue\@npcitex}{\@tempswafalse\@npcitex[]}}
\def\emcite{\@ifnextchar [{\@tempswatrue\@emcitex}{\@tempswafalse\@emcitex[]}}
\def\singlecite{\@ifnextchar [{\@tempswatrue\@singlecitex}{\@tempswafalse\@singlecitex[]}}
\def\singlenpcite{\@ifnextchar [{\@tempswatrue\@singlenpcitex}{\@tempswafalse\@singlenpcitex[]}}
\def\singleemcite{\@ifnextchar [{\@tempswatrue\@singleemcitex}{\@tempswafalse\@singleemcitex[]}}

% use ``,'' between author labels
\def\@aucitex[#1]#2{\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi
  \def\@citea{}\@aucite{\@for\@citeb:=#2\do
    {\@citea\def\@citea{; }\@ifundefined
       {aub@\@citeb}{{\bf ?}\@warning
       {Citation `\@citeb' on page \thepage \space undefined}}%
{\csname aub@\@citeb\endcsname}}}{#1}}

% use ``,'' between author labels
\def\@aunpcitex[#1]#2{\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi
  \def\@citea{}\@aunpcite{\@for\@citeb:=#2\do
    {\@citea\def\@citea{; }\@ifundefined
       {aub@\@citeb}{{\bf ?}\@warning
       {Citation `\@citeb' on page \thepage \space undefined}}%
{\csname aub@\@citeb\endcsname}}}{#1}}

% use ``,'' between year-only-labels,
\def\@yrcitex[#1]#2{\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi
  \def\@citea{}\@yrcite{\@for\@citeb:=#2\do
    {\@citea\def\@citea{; }\@ifundefined
       {yrb@\@citeb}{{\bf ?}\@warning
       {Citation `\@citeb' on page \thepage \space undefined}}%
{\csname yrb@\@citeb\endcsname}}}{#1}}

% use ``,'' between year-only-labels,
\def\@yrnpcitex[#1]#2{\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi
  \def\@citea{}\@yrnpcite{\@for\@citeb:=#2\do
    {\@citea\def\@citea{; }\@ifundefined
       {yrb@\@citeb}{{\bf ?}\@warning
       {Citation `\@citeb' on page \thepage \space undefined}}%
{\csname yrb@\@citeb\endcsname}}}{#1}}

% use `; ' between parenthesisless cites
%
\def\@npcitex[#1]#2{\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi
  \def\@citea{}\@npcite{\@for\@citeb:=#2\do
    {\@citea\def\@citea{; }\@ifundefined
       {b@\@citeb}{{\bf ?}\@warning
       {Citation `\@citeb' on page \thepage \space undefined}}%
{\csname b@\@citeb\endcsname}}}{#1}}

% 
\newcounter{myfoo}
\def\@singleemcitex[#1]#2{\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi
  \setcounter{myfoo}{0}\@for\@citeb:=#2\do{\ifnum\c@myfoo=0{\csname aub@\@citeb\endcsname}\addtocounter{myfoo}{1}\fi}
  \def\@citea{}\@yrcite{\@for\@citeb:=#2\do
    {\@citea\def\@citea{; }\@ifundefined
       {yrb@\@citeb}{{\bf ?}\@warning
       {Citation `\@citeb' on page \thepage \space undefined}}%
{\csname yrb@\@citeb\endcsname}}}{#1}}

% 
\def\@singlecitex[#1]#2{\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi
  \def\@citea{(}\@citea\setcounter{myfoo}{0}\@for\@citeb:=#2\do{\ifnum\c@myfoo=0{\csname aub@\@citeb\endcsname}\addtocounter{myfoo}{1}\fi}
  \def\@citea{}\@yrnpcite{\@for\@citeb:=#2\do
    {\@citea\def\@citea{; }\@ifundefined
       {yrb@\@citeb}{{\bf ?}\@warning
       {Citation `\@citeb' on page \thepage \space undefined}}%
{\csname yrb@\@citeb\endcsname}}}{#1}\def\@citea{)}\@citea}

% 
\def\@singlenpcitex[#1]#2{\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi
  \setcounter{myfoo}{0}\@for\@citeb:=#2\do{\ifnum\c@myfoo=0{\csname aub@\@citeb\endcsname}\addtocounter{myfoo}{1}\fi}
  \def\@citea{}\@yrnpcite{\@for\@citeb:=#2\do
    {\@citea\def\@citea{; }\@ifundefined
       {yrb@\@citeb}{{\bf ?}\@warning
       {Citation `\@citeb' on page \thepage \space undefined}}%
{\csname yrb@\@citeb\endcsname}}}{#1}}

% use ``,'' between embedded cites
\def\@emcitex[#1]#2{\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi
  \def\@citea{}\@for\@citeb:=#2\do
  {\@citea\def\@citea{; }\@aunpcite{\@ifundefined {aub@\@citeb}
       {{\bf ?}\@warning{Citation `\@citeb' on page \thepage \space undefined}}
       {\csname aub@\@citeb\endcsname}}{}
   \@yrcite{\@ifundefined {yrb@\@citeb}
       {{\bf ?}\@warning{Citation `\@citeb' on page \thepage \space undefined}}
       {\csname yrb@\@citeb\endcsname}}{#1}}}

% define b@CITENAME as the full label and aub@CITENAME as the
% authors-only-label and yrb@CITENAME as the year-only-label
\def\bibcite#1#2#3#4{\global\@namedef{b@#1}{#2}
\global\@namedef{aub@#1}{#3}
\global\@namedef{yrb@#1}{#4}}

% parenthesis/no parenthesis around the label
\def\@cite#1#2{(#1\if@tempswa , #2\fi)}
\def\@aucite#1#2{(#1\if@tempswa , #2\fi)}
\def\@yrcite#1#2{(#1\if@tempswa , #2\fi)}
\def\@npcite#1#2{#1\if@tempswa , #2\fi}
\def\@aunpcite#1#2{#1\if@tempswa , #2\fi}
\def\@yrnpcite#1#2{#1\if@tempswa , #2\fi}

\def\@lbibitem[#1][#2][#3]#4{\item[\@biblabel{#1}]\if@filesw 
      { \def\protect##1{\string ##1\space}\immediate
        \write\@auxout{\string\bibcite{#4}{#1}{#2}{#3}}}\fi\ignorespaces}