diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-12 23:57:34 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-12 23:57:34 +0000 |
commit | 3eb843585fc56ace68d2c095ff32de0c743b9446 (patch) | |
tree | 287b2687611d62336f3d9ce623f6040a9caecb1b /Master/texmf-dist/tex/latex/kluwer/kluref.sty | |
parent | 27fa66bacafe77045cae158eb1a517a5600e3332 (diff) |
kluwer
git-svn-id: svn://tug.org/texlive/trunk@1017 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/kluwer/kluref.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/kluwer/kluref.sty | 465 |
1 files changed, 465 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/kluwer/kluref.sty b/Master/texmf-dist/tex/latex/kluwer/kluref.sty new file mode 100644 index 00000000000..a4d83e0e143 --- /dev/null +++ b/Master/texmf-dist/tex/latex/kluwer/kluref.sty @@ -0,0 +1,465 @@ +% +%<*other> +% +\ifcat a\noexpand @\let\next\relax\else \def\next{% +\documentclass{kluwer}\usepackage{doc}\MakePercentIgnore}\fi\next +\NeedsTeXFormat{LaTeX2e} +\def\filename{kluref.sty} +\def\filedate{2000/04/29} +%\DoNotIndex{\@M,\def,\c@secnumdepth,\baselineskip,\@pnumwidth,\else,\fi} +%\DoNotIndex{\newcommand,\z@,\relax,\renewcommand,\ifnum,\csname,\endcsname} +%\DoNotIndex{\baselineskip,\vskip,\hskip,\relax,\secdef,\refstepcounter} +%\DoNotIndex{\normalsize,\numberline,\protect,\endinput} +%\changes{v??}{2000/01/18}{SK: releft etc. now work as advertised} +%\changes{v??}{1998/03/17}{TH: Fixed optional argument to cite for numreferences} +%\changes{v??}{1997/02/18}{TH: Toggled lines for cite definition and citation write (3x)} +%\CodelineIndex +%\newcommand{\Bs}{} +%\parindent=0pt +%\parskip=3pt +%\hfuzz=10pt +%\addtolength{\textwidth}{4pc} +%\MakeShortVerb{\|} +%\begin{document} +%\begin{article} +%\begin{opening} +%\title{\filename} +%\date{\filedate} +%\author{Kluwer Academic Publishers\surname{}} +%\institute{~} +%\begin{abstract} +%This internal stylefile provides commands for references. Options are +%|openbib|, |numreferences| and |namedreferences|. This documentation +%is compiled on |kluwer.cls| to give some examples. +%\end{abstract} +%\end{opening} +%\tableofcontents +% +%\section{Interface} +% This file provides |namedreferences| and |numreferences| options +% for the stylefiles. |namedreferences| use the syntax that is +% explained in the |named.sty| package, but will be repeated +% below. |numreferences| we wrote ourselves, the major difference with +% standard \LaTeX\ iss that the brackets in the `references' section +% have turned into a dot. +% \subsection{Named references} +% This presumes that the reference list you use is sorted +% alphabetically. The general chape of the references section is this: +% +% \begin{verbatim} +% \begin{thebibliography}{} +% \bibitem[\protect\citeauthoryear{author's name}{year}]{key} +% \end{verbatim} +% In a `real' example this is what it looks like: +% \begin{verbatim} +% \begin{thebibliography}{} +%\bibitem[\protect\citeauthoryear{Bisogni~Jr and Arroyo}{1991}]{BJA91} +%J.J. Bisogni~Jr and S.L. Arroyo. +%\newblock The effect of carbon dioxide equilibrium on p{H} in dilute lakes. +%\newblock {\em Water Research}, 25(2):185--190, 1991. +% \end{verbatim} +% This entry was generated by \BibTeX, using the file |named.bst| +% to do the formatting and sorting. This method of generating +% references is highly recommended, because it tends to prevent +% errors. (The |\protect| is only needed if the output is in an +% external file, like the |.bbl| file.) Until we have a `private' +% |.bst| file, |named.bst| is the best option. +% +% Allthough keying this sort of thing in is quite tedious, It also has +% some advantages: this allows you to use some `special' |\cite| +% commands that are normally not available. The following shows what +% the respective commands output on the previous example: +% +% \begin{tabular}{ll} \hline +%Call: &Produces:\\ \hline +%|\cite{BJA91}| &\cite{BJA91}\\ +%|\cite*{BJA91}| &\cite*{BJA91}\\ +%|\shortcite{BJA91}| &\shortcite{BJA91}\\ +%|\citeyear{BJA91}| &\citeyear{BJA91}\\ +%|\inlinecite{BJA91}| &\inlinecite{BJA91}\\ +%|\opencite{BJA91}| &\opencite{BJA91} +%\end{tabular} +%\section{Implementation} +% From the options follows that the default value is +% |namedreferences|. +% +% \begin{macrocode} +\ProvidesPackage{kluref}[\filedate ] +%</other> +%<*head> +\newif\if@numreferences +\DeclareOption{namedreferences}{\@numreferencesfalse} +\DeclareOption{numreferences}{\@numreferencestrue} +% \end{macrocode} +% +% openbib is ignored (for now ?). +% +% \begin{macrocode} +\DeclareOption{openbib}{} +\ExecuteOptions{namedreferences} +%</head> +%<*other> +\ProcessOptions* +%</other> +%<*main> +% \end{macrocode} +% +% +% |\sectioncmd| is either |\section| or |\chapter|, depending on the used +% major stylefile. Same goes for |\Uppercase|, with regard to pagestyles. +% +% +% \begin{macrocode} +\newenvironment{thebibliography}[1]{% + \sectioncmd*{\refname}\imarkboth{\bibname}{\bibname}% + \footnotesize + \message{\refname} + \def\bibwidthlabel{\releft#1\reright}% +% \end{macrocode} +% |\releft| and |\reright| are usually empty, but they can be defined +% to contain brackets, for instance. This is only useful using +% |numreferences|. +% +% The list and counter are defined below. They vary for the different +% options. +% \begin{macrocode} + \list{\kapbib@counter}{\kapbib@list} + \let\makelabel\@biblabel + \def\newblock{\hskip .11em plus .33em minus .07em}% + \sloppy + \clubpenalty10000 + \widowpenalty10000 + \sfcode`\.=1000\relax + }{\endlist} +% \end{macrocode} +% +% \subsection{Some utilities} +% +% |\refname| and |\bibname| are not |\providecommand|'s to allow for +% already existing definitions, because we do need to be absolutely +% sure we are in control. That's why they are inside +% |\AtBeginDocument|, to circumvent the |babel| package. +% +% I should ask for french/german names, though. +% +% \begin{macrocode} +\AtBeginDocument{% + \def\refname{References}% + \def\bibname{References}} +% \end{macrocode} +% +% +% +% |\releft| and |\reright| are around the text inside the optional +% argument to |\bibitem|. Together with |\redot|, this allows the +% following hack: +% +%\begin{verbatim} +%\documentclass[numreferences]{kluwer} +%\renewcommand{\releft}{[} +%\renewcommand{\reright}{]} +%\renewcommand{\redot}{} +%\begin{document} +%...... +%\begin{thebibliography}{abs} +%\bibitem[abs]{key}... +%\end{verbatim} +%... and the references will look identical to \LaTeX\ Article +% `namedreferences', except for size. Note that this will only work +% using numreferences. +% +% |\coleft| and |\ccright| are the same sort of thing, they allow you +% to change the braces around |\cite| commands into something else: +% ltbibl.dtx contains the following line: +% \begin{verbatim} +% \def\@cite#1#2{[{#1\if@tempswa , #2\fi}]} +% \end{verbatim} +% We redefine this with |\coleft| and |\ccright| for brackets. +% +% This is a hook for klups.sty (oldstyle numerals) +% \begin{macrocode} +\def\i@oldseries{} +% \end{macrocode} +% \begin{macrocode} +\newlength{\bibhang} +\setlength{\bibhang}{14pt} +\newcommand{\redot}{.} +\newcommand{\releft}{} +\newcommand{\reright}{} +\if@numreferences + \def\coleft{[} + \def\ccright{]} +\else + \def\coleft{(} + \def\ccright{)} +\fi +\def\@cite#1#2{\coleft{#1\if@tempswa , #2\fi}\ccright} +% \end{macrocode} +% \begin{macrocode} +\let\oldcite\cite +% \end{macrocode} +% \subsection{Numbered references} +% \begin{macrocode} +\def\numreferences{% + \typeout{KAP -- Numbered references}% + \def\kapbib@counter{\arabic{enumiv}}% + \def\labelsepwidth{1em}% + \def\kapbib@list{% + \setlength{\labelsep}{\labelsepwidth}% + \settowidth{\labelwidth}{\@biblabel{\bibwidthlabel}}% + \setlength{\leftmargin}{\labelwidth}% + \addtolength{\leftmargin}{\labelsep}% + \setlength{\itemindent}{0pt}% + \setlength{\itemsep}{0pt}% + \setlength{\parsep}{0pt}% + \usecounter{enumiv}% + \let\makelabel\kap@biblabel}% +% \end{macrocode} +% This makes flush right labels +% \begin{macrocode} + \def\@biblabel##1{\hfill\releft##1\redot\reright}% +% \end{macrocode} +% |\@bibitem| writes out either |\bibcite{key}{number}| or +% |\bibcite{number}{number}| in case there is no key given. This +% allows |\cite{2}| without a key. +% \begin{macrocode} + \def\@bibitem##1{\item + \def\@tempa{##1}% + \ifx\@tempa\empty + \if@filesw + \immediate\write\@auxout + {\string\bibcite{\thearticle \the\value{\@listctr}}% + {\the\value{\@listctr}}}% + \fi + \else + \if@filesw + \immediate\write\@auxout + {\string\bibcite{\thearticle ##1}{\the\value{\@listctr}}}% + \fi + \fi + \ignorespaces + }% +% \end{macrocode} +% |\@lbibitem| handles the optional argument version. +% +% If no key +% is given, we presume numbered references are really wanted. (It would +% be a bit strange to have entries like |\bibitem[A95]{}| and +% to reference using a counter as in |\cite{1}|). +% +% \begin{macrocode} + \def\@lbibitem[##1]##2{% + \def\@biblabel####1{####1}% + \let\makelabel\@biblabel + \def\@tempa{##2}% + \ifx\@tempa\empty + \item[\@biblabel{\hfill\releft + \arabic{\@listctr}\redot\reright}]% + \if@filesw + {\def\protect####1{\string ####1\space}\immediate + \write\@auxout{\string\bibcite{\thearticle \the\value{\@listctr}}% + {\the\value{\@listctr}}}}% + \fi +% \end{macrocode} +% Otherwise, typeset the argument and write out both argument and key +% to the |.aux| file. +% \begin{macrocode} + \else + \item[\@biblabel{\hfill\releft ##1\redot\reright}]% + \if@filesw + {\def\protect####1{\string ####1\space}\immediate + \write\@auxout{\string\bibcite{\thearticle ##2}{##1}}}% + \fi + \fi + \ignorespaces + }% +% \end{macrocode} +% Now allow some |namedreferences| commands to a least mean something. +% \begin{macrocode} + \let\@internalcite\oldcite + \let\shortcite\@internalcite + \let\citeauthor\@internalcite + \let\citeyear\@internalcite + \let\inlinecite\@internalcite + \let\opencite\@internalcite + \let\cite\@internalcite + \def\citeauthoryear##1##2{}% +% \end{macrocode} +% To end: relatively standard definition of |\@citex|. +% \begin{macrocode} +\def\@citex[##1]##2{% + \let\@citea\@empty + \@cite{\@for\@citeb:=##2\do + {\@citea\def\@citea{,\penalty\@m\ }% + \if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi + \edef\gl@citeb{\expandafter\@firstofone\@citeb}% + \edef\@citeb{\thearticle\expandafter\@firstofone\@citeb}% + \@ifundefined{b@\@citeb}{% + \@ifundefined{b@\gl@citeb}{% + \mbox{\reset@font\bfseries ?}% + \G@refundefinedtrue + \@latex@warning + {Citation `\@citeb' on page \thepage \space undefined}}% + {\hbox{\csname b@\gl@citeb\endcsname}}}% + {\hbox{\csname b@\@citeb\endcsname}}% + }}{##1}} +} +% \end{macrocode} +%\subsection{Named references} +% \begin{macrocode} +\def\namedreferences{% + \typeout{KAP -- Named references}% +% \end{macrocode} +% This (having no optional argument and/or key) +% is typically one of those things that happen if you switch from +% |num| to |named|. Just write out something to indicate that there +% may be a problem. +% +% \begin{macrocode} + \def\@bibitem##1{\item + \def\@tempa{##1}% + \ifx\@tempa\empty + \if@filesw \immediate\write\@auxout{% + \string\bibcite{\thearticle ??}{??}}\fi + \else + \if@filesw \immediate\write\@auxout{% + \string\bibcite{\thearticle ##1}{??}}\fi + \fi + \ignorespaces + }% +% \end{macrocode} +% Not having a key probably indicates that the optional argument is +% also wrong, but hey, we can't do everything. At least now |\cite| +% is something useful if you can count very well... +% +% It is also possible +% that the optional argument is empty, but that is never a problem +% because it will not be typeset anyway (|\@biblabel| will gobble the +% argument). +% +% 21/3/1997 inserted increment of |\@listctr| to prevent multiply +% defined labels. +% \begin{macrocode} + \def\@lbibitem[##1]##2{\item[\@biblabel{##1}\hfill]% + \def\@tempa{##2}% + \stepcounter{\@listctr}% + \ifx\@tempa\empty + \if@filesw{\def\protect####1{\string ####1\space}\immediate + \write\@auxout{\string\bibcite{\thearticle + \the\value\@listctr}{##1}}}\fi + \else + \if@filesw{\def\protect####1{\string ####1\space}\immediate + \write\@auxout{\string\bibcite{\thearticle ##2}{##1}}}\fi + \fi + \ignorespaces + }% +\def\labelsepwidth{1em}% +% \end{macrocode} +% Here is the list again. |\bibhang| allows control over the amount +% of hanging indentation. +% \begin{macrocode} +\def\kapbib@counter{\relax }% + \def\kapbib@list{% + \setlength{\labelsep}{0em}% + \setlength{\labelwidth}{0pt}% + \setlength{\itemindent}{-\bibhang}% + \setlength{\itemsep}{0pt}% + \setlength{\parsep}{0pt}% + \usecounter{enumiv}% + \setlength{\leftmargin}{\bibhang}% + \i@oldseries + }% +% \end{macrocode} +% Gobble |\@biblabel|. Also, save meaning of |\cite| for later use. +% \begin{macrocode} + \def\@biblabel##1{}% + \let\@internalcite\oldcite +% \end{macrocode} +% Differences between these |\cite| commands can be seen above. +% \begin{macrocode} + \def\cite{\@ifstar{\citeyear}{\klu@cite}}% + + \def\klu@cite{\def\@citeseppen{1000}% + \def\@cite####1####2{\coleft{####1\if@tempswa , ####2\fi}\ccright}% + \def\citeauthoryear####1####2{{\rm\i@oldseries ####1, ####2}}\@internalcite }% + + \def\shortcite{\def\@citeseppen{1000}% + \def\@cite####1####2{\coleft{####1\if@tempswa , ####2\fi}\ccright}% + \def\citeauthoryear####1####2{{\rm\i@oldseries ####2}}\@internalcite }% + + \def\citeauthor##1{\def\@citeseppen{1000}% + \def\@cite####1####2{{####1\if@tempswa , ####2\fi}}% + \def\citeauthoryear####1####2{\rm ####1}\@citedata{##1}}% + + \def\citeyear##1{\def\@citeseppen{1000}% + \def\@cite####1####2{{####1\if@tempswa , ####2\fi}}% + \def\citeauthoryear####1####2{{\rm\i@oldseries ####2}}\@citedata{##1}}% + + \def\opencite##1{\citeauthor{##1}, \citeyear{##1}}% + + \def\inlinecite##1{\citeauthor{##1} (\citeyear{##1})}% +% \end{macrocode} +% This is rather tricky stuff, these macros come from |named.sty| and +% I remember that I understood them once, but not any more, +% apparantly. Checking this is left as an exersize to the reader. +% \begin{macrocode} +\def\@citedata##1{% + \@tempswafalse% + \let\@citea\@empty + \@cite{\@for\@citeb:=##1\do + {\@citea\def\@citea{,\penalty\@citeseppen\ }% + \if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi + \edef\gl@citeb{\expandafter\@firstofone\@citeb}% + \edef\@citeb{\thearticle\expandafter\@firstofone\@citeb}% + \@ifundefined{b@\@citeb}{% + \@ifundefined{b@\gl@citeb}{% + \mbox{\reset@font\bfseries ?}% + \G@refundefinedtrue + \@latex@warning + {Citation `\@citeb' on page \thepage \space undefined}}% + {\csname b@\gl@citeb\endcsname}}% + {\csname b@\@citeb\endcsname}}}{}} +\def\@citex[##1]##2{% + \let\@citea\@empty + \@cite{\@for\@citeb:=##2\do + {\@citea\def\@citea{;\penalty\@citeseppen\ }% + \if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi + \edef\gl@citeb{\expandafter\@firstofone\@citeb}% + \edef\@citeb{\thearticle\expandafter\@firstofone\@citeb}% + \@ifundefined{b@\@citeb}{% + \@ifundefined{b@\gl@citeb}{% + \mbox{\reset@font\bfseries ?}% + \G@refundefinedtrue + \@latex@warning + {Citation `\@citeb' on page \thepage \space undefined}}% + {\csname b@\gl@citeb\endcsname}}% + {\csname b@\@citeb\endcsname}}}{##1}} +% \end{macrocode} +% Allow |\citeauthoryear| in |\write| +% \begin{macrocode} +\def\citeauthoryear##1##2{\string\citeauthoryear{##1}{##2}}} +%%%%%%%%%%%%%%%%%%%%%%%%% +\if@numreferences + \numreferences +\else + \namedreferences +\fi +%</main> +%<*other> +\endinput +% \end{macrocode} +%\begin{thebibliography}{} +%\bibitem[\citeauthoryear{Bisogni~Jr and Arroyo}{1991}]{BJA91}% +%J.J. Bisogni~Jr and S.L. Arroyo. +%\newblock The effect of carbon dioxide equilibrium on p{H} in dilute lakes. +%\newblock {\em Water Research}, 25(2):185--190, 1991. +%\end{thebibliography} +%\PrintIndex +%\end{article} +%\end{document} +% end of kluref.sty +%</other> + + + + |