% \iffalse meta-comment -*- mode: doctex -*-
%
% English language definition file of the master bibliography style
% for The Canadian Journal of Statistics | La revue canadienne de
% statistique
%
% Copyright (C) 2023-2024 Statistical Society of Canada | Société
% canadienne de statistique
%
% This file may be distributed and/or modified under the conditions
% of the LaTeX Project Public License, either version 1.3c of this
% license or (at your option) any later version. The latest version
% of this license is in:
%
%   https://www.latex-project.org/lppl.txt
%
% This work has the LPPL maintenance status `maintained'.
%
% The Current Maintainer of this work is Vincent Goulet
% <vincent.goulet@act.ulaval.ca>.
%
% This work derives from english.mbs, part of the custom-bib
% collection, a contribution to the LaTeX2e system.
% Copyright 1994-2002 Patrick W Daly
% Max-Planck-Institut f\"ur Sonnensystemforschung
% Max-Planck-Str. 2
% D-37191 Katlenburg-Lindau
% Germany
% E-mail: daly@mps.mpg.de
%
 %-------------------------------------------------------------------
 % Begin module:
%\fi
 % \ProvidesFile{cjs-rcs-english.mbs}[2024/07/30 v1.1a (VG, PWD)]
%\iffalse
%<*a&!a>
% The following ensures that the driver part is not seen by makebst
% The driver part must not contain any \end other than \end{document} !
\ifx\endoptions\undefined\let\tempx=\relax\else
  \long\def\tempx#1\end#2{}\fi\tempx
%</a&!a>
%<*driver>
\NeedsTeXFormat{LaTeX2e}%
\documentclass[nocjs,x11names,french,english]{cjs-rcs-article}

  %% Loading doc.sty creates some conflicts with the class and memoir. We
  %% need to:
  %%
  %% - keep a copy of the class' \maketitle command;
  %% - undefine the 'glossary' environment created by memoir;
  %% - restore the standard LaTeX commands for the glossary that
  %%   doc.sty relies upon.
  \let\makeCJStitle\maketitle   % keep class definition
  \let\theglossary\relax        % avoid conflict with doc.sty
  \let\endtheglossary\relax     % avoid conflict with doc.sty
  \makeatletter
  \def\makeglossary{%
    \newwrite\@glossaryfile
    \immediate\openout\@glossaryfile=\jobname.glo
    \def\glossary{\@bsphack\begingroup
                  \@sanitize
                  \@wrglossary}\typeout
      {Writing glossary file \jobname.glo }%
    \let\makeglossary\@empty
  }
  \@onlypreamble\makeglossary
  \def\@wrglossary#1{%
     \protected@write\@glossaryfile{}%
        {\string\glossaryentry{#1}{\thepage}}%
   \endgroup
   \@esphack}
  \def\glossary{\@bsphack\begingroup\@sanitize\@index}
  \@twosidefalse\@mparswitchfalse % turn off twoside option
  \makeatother
  \usepackage{doc}
  \def\changes#1#2#3{\glossary{#1>#3}} % simplified
  \DisableCrossrefs
  \CodelineNumbered
  \RecordChanges
  \OnlyDescription
  \DontCheckModules

  \AtEndPreamble{%
    \hypersetup{%
      pdfauthor = {Statistical Society of Canada},
      pdftitle = {French language definition file cjs-rcs-french.mbs}}}

  %% Configuration of the glossary
  \addto\extrasenglish{%
    \def\glossaryname{History of changes}}
  \GlossaryPrologue{\section*{\glossaryname}%
    \addcontentsline{toc}{section}{\glossaryname}}
  \setlength{\GlossaryMin}{5cm}

  %% Additional semantic typesetting
  \newcommand*\class[1]{\textsf{#1}}
  \newcommand*\dtx{\textsf{docstrip}}

  %% Name of the journal
  \makeatletter
  \newcommand*\TheCJS{\@ifstar{\emph{The Journal}}{\emph{\CJS@journalname@en}}}
  \newcommand*\LaRevue{\@ifstar{\emph{La revue}}{\emph{\CJS@journalname@fr}}}
  \newcommand*\CJSclass{\class{cjs-rcs-article}}
  \newcommand*\CJSbsten{\texttt{cjs-rcs-en.bst}}
  \newcommand*\CJSbstfr{\texttt{cjs-rcs-fr.bst}}
  \makeatother

  %% Redefine \year using information from \filedate instead of using
  %% compilation time
  \def\parsedate#1/#2/#3\relax{\def\year{#1}}

  \MakeShortVerb{\|}

\begin{document}
  \DocInput{cjs-rcs-english.mbs}
\end{document}
%</driver>
% end of meta-comment \fi
% \GetFileInfo{cjs-rcs-english.mbs}
% \expandafter\parsedate\filedate\relax
%
% \changes{0.9}{2023-10-14}{Initial version based on version 4.2 of
% \texttt{english.mbs} from \textbf{custom-bib}.}
% \changes{0.93}{2023-11-06}{Add a prefix v in the version number like
% the main file.}
% \changes{1.0}{2023-11-29}{First official release distributed through
% CTAN.}
%
% \title[English language definition file \filename]{%
%   English language definition file \\
%   of the master bibliographic style file \\
%   for \TheCJS}
% \author{Statistical Society of Canada}
% \affil{Developed by Vincent Goulet, Université Laval}
%
% \begin{englishabstract}
%   The list of references in {\TheCJS} is typeset using the
%   bibliographic styles {\CJSbsten} for articles in English and
%   {\CJSbstfr} for articles in French. These styles are created using
%   the program \texttt{makebst} from the master bibliographic file
%   \texttt{cjs-rcs-merlin.mbs}, and the language definition files
%   \texttt{cjs-rcs-english.mbs} and \texttt{cjs-rcs-french.mbs}.
% \end{englishabstract}
% \begin{frenchabstract}
%   La liste des références dans {\LaRevue} est composée avec les
%   style de bibliographie {\CJSbstfr} pour les articles en français
%   et {\CJSbsten} pour les articles en anglais. Ceux-ci sont générés
%   par le programme \texttt{makebst} à partir du fichier maitre
%   \texttt{cjs-rcs-merlin.mbs} et des fichiers de localisation
%   \texttt{cjs-rcs-english.mbs} et \texttt{cjs-rcs-french.mbs}.
% \end{frenchabstract}
%
% ^^A abusing the 'classification' environment. The final period is
% ^^A added by the environment.
% \begin{classification}[Version]
% \item[] This is the documentation for the file \code{\filename}
%   {\fileversion}, dated {\filedate}
% \end{classification}
%
% \licence{{\year}, Statistical Society of Canada~{\textbar}~Société
% canadienne de statistique}
%
% \makeCJStitle
%
% \section{Introduction}
%
% This file is to be used as a language definition file with the
% master bibliographic file for {\TheCJS}. The language it defines is
% English.
%
% This is not a self-sufficient \texttt{.mbs} file, but rather may
% be used together with one that contains language support via
% external definition files.
%
% See the documentation for \texttt{makebst} for formatting details.
%
% \section{The Menu Information}
%
% All the menu information is nested between \dtx{} guard options
% |%<*options>| \dots\ |%</options>|, and the last command is
% |\endoptions|. The rest of the file is nested between |%<*!options&!driver>|
% \dots\ |%</!options&!driver>| in order to exclude it if \dtx{} is used to
% extract only the menu information or the documentation driver.
%
%    \begin{macrocode}
%<*options>
\mes{^^JOptions for ENGLISH}
\wr{\spsp\spsp english,\pc: English language}

\beginoptiongroup{ABBREVIATE WORD `PAGES'}{}
\optdef{*}{}{`Page(s)'}{(no abbreviation)}
\optdef{a}{pp}{`Page' abbreviated}{as p. or pp.}
\optdef{x}{ppx}{`Page' omitted}{}
\getans
\endoptiongroup
\beginoptiongroup{ABBREVIATE WORD `EDITORS':}{}
\optdef{*}{}{`Editor(s)'}{(no abbreviation)}
\optdef{a}{ed}{`Editor' abbreviated}{as ed. or eds.}
\getans
\endoptiongroup
\beginoptiongroup{OTHER ABBREVIATIONS:}{}
\optdef{*}{}{No abbreviations}{of volume, edition, chapter, etc}
\optdef{a}{abr}{Abbreviations}{of such words}
\getans
\endoptiongroup
\beginoptiongroup{ABBREVIATION FOR `EDITION'
 (if abbreviating words)}
 {\if\ans a*\fi}%
\optdef{*}{}{`Edition' abbreviated as `edn'}{}
\optdef{a}{ednx}{`Edition' abbreviated as `ed'}{}
\getans
\beginoptiongroup{MONTHS WITH DOTS:}{}
\optdef{*}{}{Months with dots}{as Jan.}
\optdef{x}{mth-bare}{Months without dots}{as Feb Mar}
\getans
\endoptiongroup
\endoptiongroup
\beginoptiongroup{EDITION NUMBERS:}{}
\optdef{*}{xedn}{Editions as in database}{saving much processing memory}
\optdef{w}{}{Write out editions}{as first, second, third, etc}
\optdef{n}{ord}{Numerical editions}{as 1st, 2nd, 3rd, etc}
\getans
\endoptiongroup
\endoptions
%</options>
%    \end{macrocode}
%
% \StopEventually{\PrintChanges}
%
% \section{The Coding}
%    \begin{macrocode}
%<*!options&!driver>

 % The language selected here is ENGLISH
FUNCTION {bbl.and}
{ "and"}

FUNCTION {bbl.etal}
{ "et~al." }

FUNCTION {bbl.editors}
%<!ed>{ "editors" }
%<ed>{ "eds." }

FUNCTION {bbl.editor}
%<!ed>{ "editor" }
%<ed>{ "ed." }

FUNCTION {bbl.edby}
{ "edited by" }

FUNCTION {bbl.edition}
%<!abr>{ "edition" }
%<abr&!ednx>{ "edn." }
%<abr&ednx>{ "ed." }

FUNCTION {bbl.volume}
%<!abr>{ "volume" }
%<abr>{ "vol." }

FUNCTION {bbl.of}
{ "of" }

FUNCTION {bbl.number}
%<!abr>{ "number" }
%<abr>{ "no." }

FUNCTION {bbl.nr}
{ "no." }

FUNCTION {bbl.in}
{ "in" }

FUNCTION {bbl.pages}
%<!pp&!ppx>{ "pages" }
%<pp>{ "pp." }
%<!pp&ppx>{ "" }

FUNCTION {bbl.page}
%<!pp&!ppx>{ "page" }
%<pp>{ "p." }
%<!pp&ppx>{ "" }

%<*revdata>
FUNCTION {bbl.eidpp}
{ "pages" }

%</revdata>
FUNCTION {bbl.chapter}
%<!abr>{ "chapter" }
%<abr>{ "chap." }

FUNCTION {bbl.techrep}
%<!abr>{ "Technical Report" }
%<abr>{ "Tech. Rep." }

FUNCTION {bbl.mthesis}
{ "Master's thesis" }

FUNCTION {bbl.phdthesis}
{ "Ph.D. thesis" }

%<*!xedn>
FUNCTION {bbl.first}
%<!ord>{ "First" }
%<ord>{ "1st" }

FUNCTION {bbl.second}
%<!ord>{ "Second" }
%<ord>{ "2nd" }

FUNCTION {bbl.third}
%<!ord>{ "Third" }
%<ord>{ "3rd" }

FUNCTION {bbl.fourth}
%<!ord>{ "Fourth" }
%<ord>{ "4th" }

FUNCTION {bbl.fifth}
%<!ord>{ "Fifth" }
%<ord>{ "5th" }

FUNCTION {bbl.st}
{ "st" }

FUNCTION {bbl.nd}
{ "nd" }

FUNCTION {bbl.rd}
{ "rd" }

FUNCTION {bbl.th}
{ "th" }
%    \end{macrocode}
% This function adds English endings for ordinals 1, 2, 3. However, if
% the second last digit is 1, then the ending is `th' for all last digits.
% So far, all other languages included do not have this problem, and it is
% sufficient to add the \textsl{th} equivalent. This might change with further
% languages.
%
%    \begin{macrocode}
FUNCTION {eng.ord}
{ duplicate$ "1" swap$ *
  #-2 #1 substring$ "1" =
     { bbl.th * }
     { duplicate$ #-1 #1 substring$
       duplicate$ "1" =
         { pop$ bbl.st * }
         { duplicate$ "2" =
             { pop$ bbl.nd * }
             { "3" =
                 { bbl.rd * }
                 { bbl.th * }
               if$
             }
           if$
          }
       if$
     }
   if$
}

%</!xedn>
%<*!abr>
MACRO {jan} {"January"}

MACRO {feb} {"February"}

MACRO {mar} {"March"}

MACRO {apr} {"April"}

MACRO {may} {"May"}

MACRO {jun} {"June"}

MACRO {jul} {"July"}

MACRO {aug} {"August"}

MACRO {sep} {"September"}

MACRO {oct} {"October"}

MACRO {nov} {"November"}

MACRO {dec} {"December"}

%</!abr>
%<*abr>
MACRO {jan} {"Jan."}

MACRO {feb} {"Feb."}

MACRO {mar} {"Mar."}

MACRO {apr} {"Apr."}

MACRO {may} {"May"}

MACRO {jun} {"Jun."}

MACRO {jul} {"Jul."}

MACRO {aug} {"Aug."}

MACRO {sep} {"Sep."}

MACRO {oct} {"Oct."}

MACRO {nov} {"Nov."}

MACRO {dec} {"Dec."}

%</abr>
%</!options&!driver>
 % End module: cjs-rcs-english.mbs
%    \end{macrocode}
% \Finale