From 02d941fa9c9895bb08a84ac9afe3559abd1ba8ad Mon Sep 17 00:00:00 2001
From: Norbert Preining <norbert@preining.info>
Date: Thu, 26 May 2022 03:01:06 +0000
Subject: CTAN sync 202205260301

---
 biblio/bibtex/contrib/bath-bst/bath-bst.dtx | 823 ++++++++++++++++++----------
 1 file changed, 539 insertions(+), 284 deletions(-)

(limited to 'biblio/bibtex/contrib/bath-bst/bath-bst.dtx')

diff --git a/biblio/bibtex/contrib/bath-bst/bath-bst.dtx b/biblio/bibtex/contrib/bath-bst/bath-bst.dtx
index 6288be810a..8fce607c22 100644
--- a/biblio/bibtex/contrib/bath-bst/bath-bst.dtx
+++ b/biblio/bibtex/contrib/bath-bst/bath-bst.dtx
@@ -74,7 +74,7 @@ Copyright (C) 2016-2022 by University of Bath
 \ProvidesFile{bath-bst.dtx}
 %</driver>
 %<*driver|tex1>
-    [2022/03/04 v5.0 Harvard referencing style as recommended by the University of Bath Library]
+    [2022/05/25 v6.0 Harvard referencing style as recommended by the University of Bath Library]
 
 \documentclass[10pt,a4paper]{article}
 \usepackage[british]{babel}
@@ -103,6 +103,7 @@ Copyright (C) 2016-2022 by University of Bath
 \xdefinecolor{Green}{rgb}{0,.5,0}
 \xdefinecolor{Slate}{RGB}{80,86,94}
 \xdefinecolor{BathStone}{RGB}{213,211,185}
+\xdefinecolor{SlushPuppy}{RGB}{177,215,237}
 \colorlet{ok}{Green}
 \colorlet{todo}{red}
 \colorlet{hacked}{orange}
@@ -265,6 +266,9 @@ Copyright (C) 2016-2022 by University of Bath
       }
     }
   }
+\def\bstIonly{\tcbset{colback=hacked!10}}
+\def\bstIIonly{\tcbset{colback=SlushPuppy!25}}
+\def\bstboth{\tcbset{colback=BathStone!25}}
 %</driver|tex1>
 %<*driver>
 % For typesetting the implementation
@@ -676,6 +680,22 @@ structures may also change without warning.
   Maps need to be given the \texttt{book} entry type; previously \texttt{manual} was recommended.
 \end{itemize}
 
+\subsection{Version 6}
+
+\begin{itemize}
+%<*driver>
+\item
+  Entry type clarifications such as `Photograph' and `Computer program' are now
+  handled differently from translated titles, in particular as regards their
+  position relative to the version, and how they interact with the `[Online]'
+  tag. As a result, they should now be placed in \texttt{entrysubtype} rather
+  than \texttt{titleaddon}.
+%</driver>
+\item
+  All elements of the title block (including \texttt{titleaddon},
+  \texttt{version}, and \texttt{entrysubtype}) now move to the head of the
+  reference in the absence of an author\slash editor.
+\end{itemize}
 
 
 \section{Examples}
@@ -1285,6 +1305,28 @@ for `preprint'.
 %</driver>
 \end{bibexbox}
 
+\begin{tips}\item
+The Harvard (Bath) style treats preprints as grey literature, and so the
+\texttt{techreport} entry type (or its alias \texttt{report}) is the best match
+semantically.
+\item
+%<*driver>
+Use \texttt{library} to specify the name of the preprint repository.
+Note that the workaround in \texttt{bath.bst} of using \texttt{note} instead
+does not work in \texttt{bathx.bst}.
+\iffalse
+%</driver>
+%<*tex1>
+Use \texttt{note} to specify the name of the preprint repository.
+If you don't want this information showing up in other Bib\TeX\ styles,
+or you think you might want to switch to using \texttt{bathx.bst} later,
+use the \texttt{library} field instead.
+%</tex1>
+%<*driver>
+\fi
+%</driver>
+\end{tips}
+
 \begin{bibexbox}<RX>{ganju2021sed}
   Ganju, V., 2021. \emph{A study of EnGeneIC Dream Vectors (EDV's) packaged with the chemotherapy, E-EDV-D682 given simultaneously as non-targeted EDVs carrying an immune enhancer called EDV-GC, in participants with advanced pancreatic and other cancers whose disease has progressed after one or two treatment regimes, or where other standard therapies are not appropriate}. Sydney: University of Sydney. \emph{Australian and New Zealand Clinical Trials Registry} [Online]. Available from: \url{http://www.anzctr.org.au/Trial/Registration/TrialReview.aspx?id=365258} [Accessed 29 April 2021].
   \tcblower
@@ -1331,12 +1373,6 @@ for `preprint'.
 %</driver>
 \end{bibexbox}
 
-\begin{tips}\item
-The Harvard (Bath) style treats preprints as grey literature, and so the
-\texttt{techreport} entry type (or its alias \texttt{report}) is the best match
-semantically. Use \texttt{library} to specify the name of the preprint repository.
-\end{tips}
-
 
 \subsubsection*{Newspaper article}
 
@@ -1896,35 +1932,32 @@ record the source of the image.
 %</driver>
 \end{bibexbox}
 
-\begin{bibexbox}<RI>{anon1946peb}
-  Anon., 1946. \emph{Prototype electric bicycle displayed at the \enquote{Britain Can Make It} exhibition organised by the Council of Industrial Design and held at the Victoria and Albert Museum, London, 1946. Designed by B.~G. Bowden} [Photograph]. At: London. Design Council Slide Collection.
+\begin{bibexbox}<RI>{brbr1965gph}
+  Bristol Region Building Record, 1965. \emph{Green Park House (since demolished), viewed from southwest} [Photograph]. BRBR, D/877/1. Archives \& Research Collections, University of Bath Library.
   \tcblower
 \begin{Verbatim}
 %</driver|tex1>
 %<*driver|bib>
-@image{anon1946peb,
-  author = {Anon.},
-  year = {1946},
-  title = {Prototype electric bicycle displayed at the \enquote{Britain Can Make It} exhibition
-    organised by the {Council} of {Industrial} {Design} and held at the {Victoria} and {Albert}
-    {Museum}, {London}, 1946. {Designed} by {B.~G.} {Bowden}},
+@image{brbr1965gph,
+  author = {{Bristol Region Building Record}},
+  year = {1965},
+  title = {{Green} {Park} {House} (since demolished), viewed from southwest},
   titleaddon = {Photograph},
-  address = {London},
-  library = {Design Council Slide Collection}}
+  number = {BRBR, D/877/1},
+  library = {Archives \& Research Collections, University of Bath Library}}
 %</driver|bib>
 %<*driver>
 \end{Verbatim}
 \iffalse
 %</driver>
 %<*tex1|bib1>
-@manual{anon1946peb,
-  author = {Anon.},
-  year = {1946},
-  title = {Prototype electric bicycle displayed at the \enquote{Britain Can Make It} exhibition
-    organised by the {Council} of {Industrial} {Design} and held at the {Victoria} and {Albert}
-    {Museum}, {London}, 1946. {Designed} by {B.~G.} {Bowden}},
+@manual{brbr1965gph,
+  author = {{Bristol Region Building Record}},
+  year = {1965},
+  title = {{Green} {Park} {House} (since demolished), viewed from southwest},
   titleaddon = {[Photograph]},
-  note = {At: London. Design Council Slide Collection}}
+  note = {BRBR, D/877/1},
+  organization = {Archives \& Research Collections, University of Bath Library}}
 %</tex1|bib1>
 %<*driver|tex1>
 \end{Verbatim}
@@ -1933,16 +1966,39 @@ record the source of the image.
 %</driver>
 \end{bibexbox}
 
-%<*driver>
 \begin{tips}\item
-Use the \texttt{library} field to record the archive and register number.
+%<*driver>
+Use the \texttt{library} field to record the archive.
 If the image is on display rather than archived,
 use \texttt{institution} instead for the museum, gallery or building.
 If you also wish to provide the name of the organisation that published the image,
 use the \texttt{publisher} field if the location you provide relates to the publisher,
 but the \texttt{organization} field if the location relates to the archive.
-\end{tips}
+\item
+Put archival locator information (e.g.\@ box or shelf number) in the \texttt{number} field.
+\item
+Put the clarification of the resource type in \texttt{entrysubtype}.
+In most cases, you can use \texttt{titleaddon} instead,
+but \texttt{entrysubtype} will correctly suppress \enquote{Online} being shown
+while \texttt{titleaddon} will not.
+\iffalse
 %</driver>
+%<*tex1>
+If the \texttt{organization} is a publisher, put the location in \texttt{address} as normal;
+if it is an archive or where the image is displayed, include the location within the \texttt{organization} field,
+after the archive name and a comma.
+\item
+Put archival locator information (e.g.\@ box or shelf number) in the \texttt{note} field.
+%</tex1>
+%<*driver>
+\fi
+%</driver>
+\end{tips}
+
+\begin{info}\item
+The \texttt{@image} entry type can be used for any visual artistic work,
+including sculptures and interactive exhibits.
+\end{info}
 
 \subsubsection*{Map}
 
@@ -2715,7 +2771,7 @@ You can use \texttt{dataset} instead of \texttt{online} as an alias for \texttt{
   author = {@screencasto},
   title = {{Screencast-O-Matic}},
   version = {2},
-  titleaddon = {computer program},
+  entrysubtype = {computer program},
   url = {https://screencast-o-matic.com/},
   urlyear = {16 May 2016}}
 %</driver|bib>
@@ -2742,6 +2798,15 @@ You can use \texttt{dataset} instead of \texttt{online} as an alias for \texttt{
 \begin{info}\item
 Internally, \texttt{software} is an alias for \texttt{manual}.
 \end{info}
+%<*driver>
+\begin{tips}\item
+Put the clarification of the resource type in \texttt{entrysubtype}. In most
+cases, you can use \texttt{titleaddon} instead, but \texttt{titleaddon} is shown
+immediately after the title and may be shown alongside the \enquote{Online}
+label, whereas \texttt{entrysubtype} is printed after the \texttt{version} and
+supersedes the \enquote{Online} label.
+\end{tips}
+%</driver>
 
 
 \subsection{Works in languages other than English}
@@ -2864,7 +2929,7 @@ Use the \texttt{titleaddon} field to supply the English translation of the title
 
 \newcommand*{\noop}[1]{}
 \begin{bibexbox}(hacked)<RX>{hua1999qys1}
-  Hua, L. 華林甫, 1999. Qingdai yilai Sanxia diqu shuihan zaihai de chubu yanjiu 清代以來三峽地區水旱災害的初步硏 [A preliminary study of floods and droughts in the Three Gorges region since the Qing dynasty]. \emph{Zhongguo shehui kexue \textup{中國社會科學}}, 1, pp.168--79.
+  Hua, L. 華林甫, 1999. Qingdai yilai Sanxia diqu shuihan zaihai de chubu yanjiu 清代以來三峽地區水旱災害的初步硏 [A preliminary study of floods and droughts in the Three Gorges region since the Qing dynasty]. \emph{Zhongguo shehui kexue \emph{中國社會科學}}, 1, pp.168--79.
   \tcblower
 \begin{Verbatim}
 %</driver|tex1>
@@ -2876,7 +2941,7 @@ Use the \texttt{titleaddon} field to supply the English translation of the title
     {清代以來三峽地區水旱災害的初步硏}},
   titleaddon = {A preliminary study of floods and droughts in the {Three} {Gorges} region since
     the {Qing} dynasty},
-  journal = {Zhongguo shehui kexue \textup{中國社會科學}},
+  journal = {Zhongguo shehui kexue \emph{中國社會科學}},
   volume = {1},
   pages = {168-79}}
 %</driver|bib>
@@ -2892,7 +2957,7 @@ Use the \texttt{titleaddon} field to supply the English translation of the title
     {清代以來三峽地區水旱災害的初步硏}},
   titleaddon = {[A preliminary study of floods and droughts in the {Three} {Gorges} region since
     the {Qing} dynasty]},
-  journal = {Zhongguo shehui kexue \textup{中國社會科學}},
+  journal = {Zhongguo shehui kexue \emph{中國社會科學}},
   volume = {1},
   pages = {168-79}}
 %</tex1|bib1>
@@ -3284,7 +3349,8 @@ years in \texttt{series} and the HL and HC numbers in \texttt{number}.
   address = {United Kingdom},
   publisher = {HMSO},
   url = {http://www.legislation.gov.uk/uksi/2012/1916/pdfs/uksi_20121916_en.pdf},
-  urldate = {17 April 2016}}
+  urldate = {17 April 2016},
+  keywords = {uksi}}
 %</tex1|bib1>
 %<*driver|tex1>
 \end{Verbatim}
@@ -3293,11 +3359,19 @@ years in \texttt{series} and the HL and HC numbers in \texttt{number}.
 %</driver>
 \end{bibexbox}
 
-%<*driver>
 \begin{tips}\item
+%<*driver>
 Use the \texttt{entrysubtype} `secondary' to put the number in the right place.
-\end{tips}
+\iffalse
+%</driver>
+%<*tex1>
+Use the \texttt{uksi} keyword to trigger the comma before the publisher.
+It should be ignored harmlessly by other styles.
+%</tex1>
+%<*driver>
+\fi
 %</driver>
+\end{tips}
 
 
 \subsection{Legal or government document: EU reports\slash legislation}
@@ -3670,7 +3744,19 @@ ENTRY
   { label extra.label sort.label short.list }
 %    \end{macrocode}
 %
-% \subsection{Writing references out to a file}
+% \subsection{Writing out references to a file}
+% \label{sec:writing1}
+%
+% This is the first of three sections that deal with writing out to the .bbl
+% bibliography file. That file contains the |thebibliography| environment,
+% which in turn contains |\bibitem| commands each providing citation data and
+% followed by a formatted reference. The business of writing the environment,
+% sorting the items and calculating the first half of the citation data for
+% each item is covered in section \ref{sec:writing3}. Calculating the second
+% half of the citation data and writing the |\bibitem| command is covered in
+% section \ref{sec:writing2}; some of the functions defined there are used in
+% section \ref{sec:writing3}, hence the backward structure. This section
+% contains generic functions for writing out the formatted reference.
 %
 % We define a set of integers for saving an output state. We will use them to
 % to implement the mechanism for stringing the elements of the reference
@@ -3698,9 +3784,11 @@ FUNCTION {init.state.consts}
 STRINGS { s t }
 %    \end{macrocode}
 %
-% The |output.nonnull| function removes an element from the stack, writes the
-% appropriate delimiter to the .bbl file depending on the state, then restores
-% the original element. Afterwards, the output state is set to |mid.sentence|.
+% The |output.nonnull| function takes the top two tokens (strings) from the
+% stack. It appends the appropriate delimiter to the earlier token and writes
+% it to the .bbl file. It then returns the later (topmost) token to the top of
+% the stack ready for the next occurrence of the function. These are the
+% delimiters used in each state:
 %
 % \begin{itemize}
 % \item |before.all| = nothing is written.
@@ -3710,6 +3798,8 @@ STRINGS { s t }
 % \item |after.block| = a period, line break and |\newblock| are written.
 % \end{itemize}
 %
+% Afterwards, the output state is set to |mid.sentence|.
+%
 %    \begin{macrocode}
 FUNCTION {output.nonnull}
 { 's :=
@@ -3749,11 +3839,10 @@ FUNCTION {end.clause}
 }
 %    \end{macrocode}
 %
-% Before writing anything out, we need to make sure there is something to be
-% printed. We provide two functions for this: |output| is silent, while
-% |output.check| will write a warning to the log that the field is empty. The
-% latter consumes an additional string (at the top of the stack) for printing
-% in the warning message.
+% We provide two wrappers around |output.nonull| to avoid passing it empty
+% strings: |output| is silent, while |output.check| will write a warning to the
+% log that the field is empty. The latter consumes an additional string (at the
+% top of the stack) for printing in the warning message.
 %
 %    \begin{macrocode}
 FUNCTION {output}
@@ -3818,13 +3907,13 @@ FUNCTION {date.block}
 }
 %    \end{macrocode}
 %
-% The |bibinfo| functions consume two tokens: the value and name of a field
-% respectively. If the value is non-null, the tokens are concatenated in
-% the form |\bibinfo{field name}| |{field value}|. Otherwise, the field name
-% is removed from the stack; if the value is missing rather than empty, it is
-% replaced with an empty string. The |check| version does this silently, while
-% the |warn| version issues a warning in the log file if the value is missing
-% or empty.
+% The |bibinfo| functions consume two tokens -- the value and name of a
+% field respectively -- and return a single string. If the value is non-null,
+% the tokens are concatenated in the form |\bibinfo{field name}{field value}|,
+% otherwise an empty string is returned.
+%
+% The |check| version does this silently, while the |warn| version issues a
+% warning in the log file if the value is missing or empty.
 %
 %    \begin{macrocode}
 FUNCTION {bibinfo.check}
@@ -3920,7 +4009,7 @@ FUNCTION {field.or.null}
 }
 %    \end{macrocode}
 %
-% The \texttt{emphasize} function applies emphasis.
+% The \texttt{emphasize} function applies emphasis to the topmest token.
 %
 %    \begin{macrocode}
 FUNCTION {emphasize}
@@ -4137,7 +4226,8 @@ MACRO {dec} {"December"}
 
 %    \end{macrocode}
 %
-% This function allows us to convert cardinal numbers to English ordinals.
+% This function takes a cardinal number and replaces it with the corresponding
+% English ordinal.
 %
 %    \begin{macrocode}
 FUNCTION {eng.ord}
@@ -4160,10 +4250,20 @@ FUNCTION {eng.ord}
      }
    if$
 }
+%    \end{macrocode}
+%
+% |word.in| provides the `In:' before book titles.
+%
+%    \begin{macrocode}
+  FUNCTION {word.in}
+{ bbl.in capitalize
+  ":" *
+  " " * }
 
 %    \end{macrocode}
 %
-% \subsection{Name handling}
+% \subsection{Writing out citation data to a file}
+% \label{sec:writing2}
 %
 % |format.names| consumes two tokens (field, string field name) and returns a
 % list of names in the form `Surname, Suffix, Initials Prefix'. To help with this,
@@ -4428,14 +4528,14 @@ FUNCTION {make.full.names}
 }
 %    \end{macrocode}
 %
-% |output.bibitem| writes out the very start of the entry in the bibliography,
+% |output.bibitem| writes out the start of an entry in the bibliography,
 % which looks like |\bibitem[{|author--year elements|}]{|entry key|}|. The
 % author--year part uses special \textsf{natbib} syntax: either `Author(Year)'
 % or `Truncated author list(Year)Full author list'. The |calc.label| function
 % below supplies the truncated author list, opening parenthesis and year; you
 % see here the closing parenthesis and conditional inclusion of the full list.
-% The function then starts a new line and puts the entry driver into the
-% |before.all| output state.
+% The function then starts a new line, puts the entry driver into the
+% |before.all| output state, and puts an empty string at the top of the stack.
 %
 %    \begin{macrocode}
 FUNCTION {output.bibitem}
@@ -4480,10 +4580,15 @@ FUNCTION {format.key}
 }
 %    \end{macrocode}
 %
-% \subsection{Titles}
+% \subsection{Field formats}
 %
-% |select.language| checks if the field before was written out, and if so,
-% wraps |{\selectlanguage{language}|\dots|}| around it.
+% Each of the |format.*| functions below (and above) add a single string
+% (possibly empty) to the stack, based on the value of one or more fields.
+%
+% \subsubsection{Title block}
+%
+% |select.language| checks if the string at the top of the stack is empty, and
+% if not, wraps |{\selectlanguage{language}|\dots|}| around it.
 %
 %    \begin{macrocode}
 FUNCTION {select.language}
@@ -4557,13 +4662,13 @@ FUNCTION {format.avtitle}
   if$
 }
 %    \end{macrocode}
-%
-% |format.titleaddon| returns the titleaddon field. This is the
-% |bath.bst| version:
-%
 % \iffalse
 %<*bst1>
-% \fi
+% \fi\addtocounter{lstnumber}{-\value{mismatch}}\bstIonly
+%
+% |format.titleaddon| returns the titleaddon field. This is the |bath.bst|
+% version:
+%
 %    \begin{macrocode}
 FUNCTION {format.titleaddon}
 { titleaddon
@@ -4575,7 +4680,7 @@ FUNCTION {format.titleaddon}
 % \iffalse
 %</bst1>
 %<*bst2>
-% \fi\addtocounter{lstnumber}{-6}
+% \fi\addtocounter{lstnumber}{\numexpr\value{mismatch}-6\relax}\bstIIonly
 %
 % This is the |bathx.bst| version:
 %
@@ -4589,7 +4694,7 @@ FUNCTION {format.titleaddon}
 %    \end{macrocode}
 % \iffalse
 %</bst2>
-% \fi
+% \fi\bstboth
 %
 % |format.version| returns the version field.
 %
@@ -4605,102 +4710,195 @@ FUNCTION {format.version}
 }
 %    \end{macrocode}
 %
-% |get.title.online| is a the function for writing `[Online]' after
-% a title. In \texttt{bath.bst} it prints the titleaddon field:
+% |print.labeltitle.addenda| is a convenience for writing out the elements that
+% normally follow the title when it appears at the head of the reference.
 %
+%    \begin{macrocode}
+FUNCTION {print.labeltitle.addenda}
+{ continue.clause
+%    \end{macrocode}
 % \iffalse
 %<*bst1>
-% \fi
+% \fi\addtocounter{lstnumber}{-\value{mismatch}}\bstIonly
+%
+% In \texttt{bath.bst} it prints the version and then |titleaddon| field:
+%
 %    \begin{macrocode}
-FUNCTION {get.title.online}
-{ online.shown
+  online.shown
     'skip$
-    { continue.clause
+    { format.version output
+      continue.clause
       format.titleaddon output
       #1 'online.shown :=
     }
   if$
-}
 %    \end{macrocode}
-%\iffalse
+% \iffalse
 %</bst1>
 %<*bst2>
-%\fi\addtocounter{lstnumber}{-9}
+% \fi\addtocounter{lstnumber}{\numexpr\value{mismatch}-8\relax}\bstIIonly
 %
-% In \texttt{bathx.bst} it conditionally prints the |bbl.online| string:
+% In \texttt{bathx.bst} it prints the |titleaddon| field, then the version,
+% then either the |entrysubtype| or the |bbl.online| string as appropriate:
 %
 %    \begin{macrocode}
-FUNCTION {get.title.online}
-{ is.online
-  journal empty$
-  and
-    booktitle empty$
-      type$ "inreference" =
-      author empty$
-      and
-    or
-  and
-    library empty$
-    type$ duplicate$ "image" =
-    swap$ duplicate$ "booklet" =
-    swap$ duplicate$ "audio" =
-    swap$ duplicate$ "video" =
-    swap$ duplicate$ "music" =
-    swap$ "movie" =
-    or
-    or
-    or
-    or
-    or
-    or
-  and
-  type$ "software" = not
+  format.titleaddon output
+  continue.clause
+  type$ duplicate$ "legislation" = not
+  swap$ "jurisdiction" = not
   and
-    series empty$
-      type duplicate$ empty$
-        { pop$ #1 }
-        { duplicate$ "TV" =
-          swap$ "Radio" =
-          or not
+    { format.version output
+      is.online
+        { entrysubtype duplicate$ empty$
+            { pop$
+              journal empty$
+                booktitle empty$
+                  type$ "inreference" =
+                  author empty$
+                  and
+                or
+              and
+                library empty$
+                type$ duplicate$ "image" =
+                swap$ duplicate$ "audio" =
+                swap$ duplicate$ "video" =
+                swap$ duplicate$ "music" =
+                swap$ "movie" =
+                or
+                or
+                or
+                or
+                or
+              and
+                series empty$
+                  type field.or.null
+                  duplicate$ "TV" =
+                  swap$ "Radio" =
+                  or not
+                or
+              and
+                { continue.clause
+                  bbl.online output
+                  #1 'online.shown :=
+                }
+                'skip$
+              if$
+            }
+            { "entrysubtype" bibinfo.check
+              "[" swap$ * "]" *
+              continue.clause output
+            }
+          if$
         }
+        'skip$
       if$
-    or
-  and
-    { continue.clause
-      bbl.online output
-      #1 'online.shown :=
     }
     'skip$
   if$
-}
 %    \end{macrocode}
-%\iffalse
+% \iffalse
 %</bst2>
-%\fi\addtocounter{mismatch}{34}
+% \fi\addtocounter{mismatch}{45}\bstboth
 %
-% |get.title.addenda| is a convenience for writing out the elements that
-% normally follow the title in |mid.clause| state.
+% |print.title.addenda| is a convenience for writing out the elements that
+% normally follow the title in its regular position. It is similar to
+% |print.labeltitle.addenda| but has somewhate different logic.
 %
 %    \begin{macrocode}
-FUNCTION {get.title.addenda}
+}
+FUNCTION {print.title.addenda}
 { continue.clause
-  format.version output
 %    \end{macrocode}
+% \iffalse
+%<*bst1>
+% \fi\addtocounter{lstnumber}{-\value{mismatch}}\bstIonly
 %
-% These two lines are peculiar to |bathx.bst|, where |titleaddon| doesn't get moved:
+% In \texttt{bath.bst} it prints the version and then |titleaddon| field:
 %
+%    \begin{macrocode}
+  online.shown
+    'skip$
+    { format.version output
+      continue.clause
+      format.titleaddon output
+      #1 'online.shown :=
+    }
+  if$
+%    \end{macrocode}
 % \iffalse
+%</bst1>
 %<*bst2>
-% \fi
+% \fi\addtocounter{lstnumber}{\numexpr\value{mismatch}-8\relax}\bstIIonly
+%
+% In \texttt{bathx.bst} it prints the |titleaddon| field, then the version,
+% then either the |entrysubtype| or the |bbl.online| string as appropriate:
+%
 %    \begin{macrocode}
-  continue.clause
-  format.titleaddon output
+  type$ duplicate$ "legislation" = not
+  swap$ "jurisdiction" = not
+  and
+    { format.titleaddon output
+      continue.clause
+    }
+    'skip$
+  if$
+  format.version output
+  is.online
+    { entrysubtype duplicate$ empty$
+        type$ duplicate$ "legislation" =
+        swap$ "jurisdiction" =
+        or
+      or
+        { pop$
+          journal empty$
+            booktitle empty$
+              type$ "inreference" =
+              author empty$
+              and
+            or
+          and
+            library empty$
+            type$ duplicate$ "image" =
+            swap$ duplicate$ "audio" =
+            swap$ duplicate$ "video" =
+            swap$ duplicate$ "music" =
+            swap$ "movie" =
+            or
+            or
+            or
+            or
+            or
+          and
+            series empty$
+              type field.or.null
+              duplicate$ "TV" =
+              swap$ "Radio" =
+              or not
+            or
+          and
+            { continue.clause
+              bbl.online output
+              #1 'online.shown :=
+            }
+            'skip$
+          if$
+        }
+        { "entrysubtype" bibinfo.check
+          "[" swap$ * "]" *
+          continue.clause output
+        }
+      if$
+    }
+    'skip$
+  if$
 %    \end{macrocode}
 % \iffalse
 %</bst2>
-% \fi\addtocounter{mismatch}{2}
+% \fi\addtocounter{mismatch}{49}\bstboth
+%
+% We finish off with editor\slash translator information.
+%
 %    \begin{macrocode}
-  get.title.online
   continue.clause
   type$ "reference" =
     { format.byeditors output }
@@ -4710,15 +4908,6 @@ FUNCTION {get.title.addenda}
 }
 %    \end{macrocode}
 %
-% |word.in| provides the `In:' before book titles.
-%
-%    \begin{macrocode}
-FUNCTION {word.in}
-{ bbl.in capitalize
-  ":" *
-  " " * }
-%    \end{macrocode}
-%
 % |format.label.booktitle| returns the booktitle field upright
 %
 %    \begin{macrocode}
@@ -4750,12 +4939,12 @@ FUNCTION {format.in.ed.booktitle}
     'skip$
     {
 %    \end{macrocode}
+% \iffalse
+%<*bst2>
+% \fi\bstIIonly
 %
 % In |bathx.bst|, we conditionally include the |bbl.online| string:
 %
-% \iffalse
-%<*bst2>
-% \fi
 %    \begin{macrocode}
       is.online
         { " " *
@@ -4767,7 +4956,7 @@ FUNCTION {format.in.ed.booktitle}
 %    \end{macrocode}
 % \iffalse
 %</bst2>
-% \fi\addtocounter{mismatch}{7}
+% \fi\addtocounter{mismatch}{7}\bstboth
 %    \begin{macrocode}
       editor "editor" format.names.ed duplicate$ empty$ 'pop$
         { "," *
@@ -4795,14 +4984,14 @@ FUNCTION {legal.journal.shape}
   if$
 }
 %    \end{macrocode}
+% \iffalse
+%<*bst1>
+% \fi\addtocounter{lstnumber}{-\value{mismatch}}\bstIonly
 %
-% \subsection{Dates}
+% \subsubsection{Dates}
 %
 % In |bath.bst|, |nodate.check| doesn't do anything:
 %
-% \iffalse
-%<*bst1>
-% \fi\addtocounter{lstnumber}{-\value{mismatch}}
 %    \begin{macrocode}
 FUNCTION {nodate.check}
 {
@@ -4812,7 +5001,7 @@ FUNCTION {nodate.check}
 % \iffalse
 %</bst1>
 %<*bst2>
-% \fi\addtocounter{lstnumber}{\numexpr\value{mismatch}-4\relax}
+% \fi\addtocounter{lstnumber}{\numexpr\value{mismatch}-4\relax}\bstIIonly
 %
 % In |bathx.bst|, it looks at the most recent token. If it is empty, replaces
 % it with `n.d.' unless either |sortyear| or the |nonodate| option is present.
@@ -4834,7 +5023,7 @@ duplicate$ empty$
 %    \end{macrocode}
 % \iffalse
 %</bst2>
-% \fi\addtocounter{mismatch}{9}
+% \fi\addtocounter{mismatch}{9}\bstboth
 %
 % |format.date| returns the year and any disambiguation label.
 %
@@ -4908,7 +5097,7 @@ FUNCTION {format.eu.date}
 }
 %    \end{macrocode}
 %
-% \subsection{Series, volumes, editions}
+% \subsubsection{Series, types and numbering}
 %
 % |format.series| returns the case-altered series field.
 %
@@ -5239,7 +5428,7 @@ FUNCTION {format.manual.number}
 }
 %    \end{macrocode}
 %
-% |format.chapter| prints out the chapter field in the form `c.1', for use with
+% |format.chapter| returns the chapter field in the form `c.1', for use with
 % UK primary legislation.
 %
 %    \begin{macrocode}
@@ -5253,7 +5442,7 @@ FUNCTION {format.chapter}
 }
 %    \end{macrocode}
 %
-% |format.series.number.chapter| prints out the series and chapter/number fields
+% |format.series.number.chapter| returns the series and chapter/number fields
 % in the form `(series, c.1)' or `(series, number)', for use with UK legislation.
 %
 %    \begin{macrocode}
@@ -5374,7 +5563,7 @@ FUNCTION {eu.case.check}
 }
 %    \end{macrocode}
 %
-% \subsection{Notes}
+% \subsubsection{Notes}
 %
 % |format.note| returns the note field, but changes the case of the first
 % letter according to the output state (unless protected by braces).
@@ -5401,15 +5590,15 @@ FUNCTION {format.note}
 }
 %    \end{macrocode}
 %
-% \subsection{Addresses and publishers}
+% \subsubsection{Publication block}
 %
-% |format.org.or.pub| intercepts a publisher (or whatever) being written out as
-% bibinfo. If the write will succeed and an address has been specified, the
-% address is written out first, then a colon and space; then the original write
-% is allowed to proceed.
+% |prepend.address| prepends the address field to the string at the top of the
+% stack, which should be a publisher (or equivalent) bibinfo string. If both
+% the input string and address field are non-empty, a colon and space are
+% interposed between them.
 %
 %    \begin{macrocode}
-FUNCTION {format.org.or.pub}
+FUNCTION {prepend.address}
 { 't :=
   ""
   address empty$ t empty$ and
@@ -5429,17 +5618,17 @@ FUNCTION {format.org.or.pub}
 }
 %    \end{macrocode}
 %
-% The next three functions write out the address plus the publisher,
+% The next three functions return the address plus the publisher,
 % organization and institution respectively.
 %
 %    \begin{macrocode}
 FUNCTION {format.publisher.address}
-{ publisher "publisher" bibinfo.warn format.org.or.pub
+{ publisher "publisher" bibinfo.warn prepend.address
 }
 FUNCTION {format.organization.address}
 { publisher empty$
-    { organization "organization" bibinfo.check format.org.or.pub }
-    { publisher "publisher" bibinfo.warn format.org.or.pub
+    { organization "organization" bibinfo.check prepend.address }
+    { publisher "publisher" bibinfo.warn prepend.address
       organization duplicate$ empty$
         'pop$
         { "organization" bibinfo.check ". " * swap$ * }
@@ -5449,8 +5638,8 @@ FUNCTION {format.organization.address}
 }
 FUNCTION {format.institution.address}
 { publisher empty$
-    { institution "institution" bibinfo.check format.org.or.pub }
-    { publisher "publisher" bibinfo.warn format.org.or.pub
+    { institution "institution" bibinfo.check prepend.address }
+    { publisher "publisher" bibinfo.warn prepend.address
       institution duplicate$ empty$
         'pop$
         { "institution" bibinfo.check ". " * swap$ * }
@@ -5467,12 +5656,12 @@ FUNCTION {format.library}
 { library "library" bibinfo.check
   emphasize
 %    \end{macrocode}
+% \iffalse
+%<*bst2>
+% \fi\bstIIonly
 %
 % In |bathx.bst|, we conditionally include the |bbl.online| string:
 %
-% \iffalse
-%<*bst2>
-% \fi
 %    \begin{macrocode}
   duplicate$ empty$ not
   is.online
@@ -5487,45 +5676,35 @@ FUNCTION {format.library}
 %    \end{macrocode}
 % \iffalse
 %</bst2>
-% \fi\addtocounter{mismatch}{10}
+% \fi\addtocounter{mismatch}{10}\bstboth
 %
-% The library field is also used for where a physical image is kept.
-% As we have only one address field, it will attach to whichever is
-% present out of organization, publisher and library. In case there
-% is more than one, it will attach to |publisher| in preference to
-% |library| and |library| in preference to |organization|.
+% The |library| (or |institution|) field is also used for where a physical
+% image is kept. As we have only one address field, it will attach to whichever
+% is present out of organization, publisher and library. In case there is more
+% than one, it will attach to |publisher| in preference to |library| and
+% |library| in preference to |organization|.
 %
 %    \begin{macrocode}
 }
 FUNCTION {format.img.library}
+{ library "library" bibinfo.check
+}
+FUNCTION {format.img.library.address}
 { library duplicate$ empty$
-    { pop$ "" }
-    { "library" bibinfo.check
-      "At: " swap$ *
+    { pop$
+      institution duplicate$ empty$
+        'skip$
+        { "institution" bibinfo.check }
+      if$
     }
+    { "library" bibinfo.check }
   if$
-}
-FUNCTION {format.img.library.address}
-{ address empty$ library empty$ and institution empty$ and
-    { "" }
-    { "At: "
-      address "address" bibinfo.check *
-      library duplicate$ empty$
-        { institution duplicate$ empty$
-            { pop$ "" }
-            { address empty$
-              'skip$
-              { ". " swap$ }
-              if$
-              "institution" bibinfo.check * *
-            }
-          if$
-        }
-        { address empty$
-            'skip$
-            { ". " swap$ }
-          if$
-          "library" bibinfo.check * *
+  duplicate$ empty$
+    { address "address" bibinfo.check * }
+    { address duplicate$ empty$
+        'pop$
+        { "address" bibinfo.check
+          swap$ ", " * swap$ *
         }
       if$
     }
@@ -5539,7 +5718,7 @@ FUNCTION {format.pub.org.lib.address}
         format.img.library.address }
       { "organization" bibinfo.check
         library empty$
-          { format.org.or.pub }
+          { prepend.address }
           { ". " *
             format.img.library.address *
           }
@@ -5547,7 +5726,7 @@ FUNCTION {format.pub.org.lib.address}
       }
     if$
   }
-  { "publisher" bibinfo.warn format.org.or.pub
+  { "publisher" bibinfo.warn prepend.address
     library empty$
       'skip$
       { ". " *
@@ -5560,7 +5739,7 @@ FUNCTION {format.pub.org.lib.address}
 
 %    \end{macrocode}
 %
-% \subsection{Pinpointing}
+% \subsubsection{Pinpointing}
 %
 % |multi.page.check| should operate on the pages field. If the value is a range,
 % that is, contains `-', `,' or `+', returns 1, otherwise returns 0.
@@ -5803,12 +5982,12 @@ FUNCTION {format.journal.series.vol.pages}
         }
         { "journal" bibinfo.check
 %    \end{macrocode}
+% \iffalse
+%<*bst2>
+% \fi\bstIIonly
 %
 % In |bathx.bst|, we conditionally include the |bbl.online| string:
 %
-% \iffalse
-%<*bst2>
-% \fi
 %    \begin{macrocode}
           is.online
             { " " * bbl.online *
@@ -5819,7 +5998,7 @@ FUNCTION {format.journal.series.vol.pages}
 %    \end{macrocode}
 % \iffalse
 %</bst2>
-% \fi\addtocounter{mismatch}{6}
+% \fi\addtocounter{mismatch}{6}\bstboth
 %    \begin{macrocode}
           volume "volume" bibinfo.check
           duplicate$ empty$
@@ -5843,9 +6022,9 @@ FUNCTION {format.journal.series.vol.pages}
 }
 %    \end{macrocode}
 %
-% \subsection{URLs}
+% \subsubsection{Access and URLs}
 %
-% |format.eprint| constructs a string |\eprint[archive]{eprint}|.
+% |format.eprint| returns a string |\eprint[archive]{eprint}|.
 %
 %    \begin{macrocode}
 FUNCTION {format.eprint}
@@ -5862,7 +6041,7 @@ FUNCTION {format.eprint}
 }
 %    \end{macrocode}
 %
-% |format.url| constructs a string |Available from: \url{url} [Accessed urldate]|.
+% |format.url| returns a string |Available from: \url{url} [Accessed urldate]|.
 % We also allow the \texttt{library} field to be used as a fallback URL.
 %
 %    \begin{macrocode}
@@ -5898,7 +6077,7 @@ FUNCTION {format.url}
 }
 %    \end{macrocode}
 %
-% \subsection{Cross referencing between entries}
+% \subsubsection{Related items}
 %
 % The following functions are used for entries that look like `Author, (Year).
 % Title. In: Author (Year).' In practice, they should never be used with Harvard
@@ -5936,7 +6115,7 @@ FUNCTION {format.book.crossref}
 
 %    \end{macrocode}
 %
-% \subsection{Formatting drivers for specific entry types}
+% \subsection{Drivers for formatting specific entry types}
 %
 % These functions are called when an entry of the given type is being
 % formatted.
@@ -5951,7 +6130,7 @@ FUNCTION {article}
   format.date "year" output.check
   date.block
   format.title "title" output.check
-  get.title.addenda
+  print.title.addenda
   new.block
   crossref missing$
     { journal "t" change.case$
@@ -5959,12 +6138,12 @@ FUNCTION {article}
       emphasize
       "journal" output.check
 %    \end{macrocode}
+% \iffalse
+%<*bst2>
+% \fi\bstIIonly
 %
 % In |bathx.bst|, we conditionally include the |bbl.online| string:
 %
-% \iffalse
-%<*bst2>
-% \fi
 %    \begin{macrocode}
       is.online
         { continue.clause
@@ -5976,7 +6155,7 @@ FUNCTION {article}
 %    \end{macrocode}
 % \iffalse
 %</bst2>
-% \fi\addtocounter{mismatch}{7}
+% \fi\addtocounter{mismatch}{7}\bstboth
 %    \begin{macrocode}
       format.vol.num.pages output
     }
@@ -6006,16 +6185,16 @@ FUNCTION {book}
             { format.title "title" output.check }
             { format.btitle "title" output.check }
           if$
-          get.title.online
+          print.labeltitle.addenda
           format.date "year" output.check
           year empty$ 'skip$ { date.block } if$
-          get.title.addenda
+          print.title.addenda
         }
         { format.editors "author and editor" output.check
           format.date "year" output.check
           date.block
           format.btitle "title" output.check
-          get.title.addenda
+          print.title.addenda
         }
       if$
     }
@@ -6027,15 +6206,20 @@ FUNCTION {book}
       format.date "year" output.check
       date.block
       format.btitle "title" output.check
-      get.title.addenda
+      print.title.addenda
     }
   if$
   format.bvolume output
   format.number.series output
   new.block
   format.edition output
+  new.block
+  format.note output
   crossref missing$
-    { new.sentence
+    { keywords field.or.null "uksi" =
+        { mid.sentence 'output.state := }   
+        { new.sentence }
+      if$
       format.publisher.address output
     }
     { new.block
@@ -6043,8 +6227,6 @@ FUNCTION {book}
     }
   if$
   new.block
-  format.note output
-  new.block
   format.eprint output
   format.url output
   fin.entry
@@ -6058,28 +6240,28 @@ FUNCTION {booklet}
 { output.bibitem
   author empty$
     { format.avtitle "title" output.check
-      get.title.online
+      print.labeltitle.addenda
       format.date "year" output.check
       year empty$ 'skip$ { date.block } if$
-      get.title.addenda
+      print.title.addenda
     }
     { format.authors output
       author format.key output
       format.date "year" output.check
       date.block
       format.avtitle "title" output.check
-      get.title.addenda
+      print.title.addenda
     }
   if$
   new.block
   format.series.episode output
 %    \end{macrocode}
+% \iffalse
+%<*bst2>
+% \fi\bstIIonly
 %
 % In |bathx.bst|, we conditionally include the |bbl.online| string:
 %
-% \iffalse
-%<*bst2>
-% \fi
 %    \begin{macrocode}
   is.online
     { continue.clause
@@ -6091,7 +6273,7 @@ FUNCTION {booklet}
 %    \end{macrocode}
 % \iffalse
 %</bst2>
-% \fi\addtocounter{mismatch}{7}
+% \fi\addtocounter{mismatch}{7}\bstboth
 %    \begin{macrocode}
   new.block
   type "type" bibinfo.check output
@@ -6129,9 +6311,12 @@ FUNCTION {inbook}
   format.date "year" output.check
   date.block
   format.btitle "title" output.check
-  get.title.addenda
+  print.title.addenda
   new.block
   format.edition output
+  new.block
+  format.note output
+  new.block
   crossref missing$
     { format.publisher.address output
       format.bvolume output
@@ -6146,8 +6331,6 @@ FUNCTION {inbook}
     }
   if$
   new.block
-  format.note output
-  new.block
   format.eprint output
   format.url output
   fin.entry
@@ -6163,21 +6346,21 @@ FUNCTION {incollection}
     { type$ "inreference" =
         { format.label.booktitle output}
         { format.title "title" output.check
-          get.title.online
+          print.labeltitle.addenda
         }
       if$
       format.date "year" output.check
       year empty$ 'skip$ { date.block } if$
       type$ "inreference" =
         'skip$
-        { get.title.addenda }
+        { print.title.addenda }
       if$
     }
     { format.authors output.nonnull
       format.date "year" output.check
       date.block
       format.title "title" output.check
-      get.title.addenda
+      print.title.addenda
     }
   if$
   new.block
@@ -6195,23 +6378,25 @@ FUNCTION {incollection}
       author empty$
       and
         { format.btitle "title" output.check
-          get.title.addenda
+          print.title.addenda
           new.block
         }
         'skip$
       if$
+      format.note output
+      new.block
       format.publisher.address output
       format.bvolume output
       format.number.series output
       format.chapter.pages output
     }
-    { format.incoll.inproc.crossref output.nonnull
+    { format.note output
+      new.block
+      format.incoll.inproc.crossref output.nonnull
       format.chapter.pages output
     }
   if$
   new.block
-  format.note output
-  new.block
   format.eprint output
   format.url output
   fin.entry
@@ -6228,12 +6413,13 @@ FUNCTION {inproceedings}
   format.date "year" output.check
   date.block
   format.title "title" output.check
-  get.title.addenda
+  print.title.addenda
   new.block
   crossref missing$
     { format.in.ed.booktitle "booktitle" output.check
       eventyear output
       venue output
+      format.note output
       new.sentence
       publisher empty$
         { format.organization.address output }
@@ -6245,13 +6431,13 @@ FUNCTION {inproceedings}
       format.number.series output
       format.pages output
     }
-    { format.incoll.inproc.crossref output.nonnull
+    { format.note output
+      new.block
+      format.incoll.inproc.crossref output.nonnull
       format.pages output
     }
   if$
   new.block
-  format.note output
-  new.block
   format.eprint output
   format.url output
   fin.entry
@@ -6274,10 +6460,10 @@ FUNCTION {jurisdiction}
         'new.sentence
         'continue.clause
       if$
-      get.title.online
+      print.labeltitle.addenda
       format.jur.date "year" output.check
       year empty$ 'skip$ { eu.case.check } if$
-      get.title.addenda
+      print.title.addenda
     }
     { format.authors output
       author format.key output
@@ -6285,7 +6471,8 @@ FUNCTION {jurisdiction}
       date.block
       continue.clause
       format.btitle "title" output.check
-      get.title.addenda
+      print.labeltitle.addenda
+      print.title.addenda
     }
   if$
   eu.case.check
@@ -6316,9 +6503,10 @@ FUNCTION {uklegislation}
 { output.bibitem
   author empty$
     { format.btitle "title" output.check
+      print.labeltitle.addenda
       continue.clause
       format.date emphasize "year" output.check
-      get.title.addenda
+      print.title.addenda
     }
     { format.authors output
       author format.key output
@@ -6326,7 +6514,8 @@ FUNCTION {uklegislation}
       date.block
       continue.clause
       format.btitle "title" output.check
-      get.title.addenda
+      print.labeltitle.addenda
+      print.title.addenda
     }
   if$
   entrysubtype field.or.null "secondary" =
@@ -6372,9 +6561,10 @@ FUNCTION {eulegislation}
 { output.bibitem
   author empty$
   { format.title "title" output.check
+    print.labeltitle.addenda
     continue.clause
     format.eu.date "year" output.check
-    get.title.addenda
+    print.title.addenda
   }
   { format.authors output
     author format.key output
@@ -6382,7 +6572,8 @@ FUNCTION {eulegislation}
     date.block
     continue.clause
     format.title "title" output.check
-    get.title.addenda
+    print.labeltitle.addenda
+    print.title.addenda
   }
   if$
   eu.case.check
@@ -6419,17 +6610,17 @@ FUNCTION {manual}
 { output.bibitem
   author empty$
     { format.btitle "title" output.check
-      get.title.online
+      print.labeltitle.addenda
       format.date "year" output.check
       year empty$ 'skip$ { date.block } if$
-      get.title.addenda
+      print.title.addenda
     }
     { format.authors output
       author format.key output
       format.date "year" output.check
       date.block
       format.btitle "title" output.check
-      get.title.addenda
+      print.title.addenda
     }
   if$
   month "month" bibinfo.check output
@@ -6437,12 +6628,12 @@ FUNCTION {manual}
   new.block
   format.manual.number output
   new.block
+  format.note output
+  new.block
   format.library output
   organization address new.block.checkb
   format.organization.address output
   new.block
-  format.note output
-  new.block
   format.eprint output
   format.url output
   fin.entry
@@ -6456,27 +6647,27 @@ FUNCTION {image}
 { output.bibitem
   author empty$
   { format.btitle "title" output.check
-    get.title.online
+    print.labeltitle.addenda
     format.date "year" output.check
     year empty$ 'skip$ { date.block } if$
-    get.title.addenda
+    print.title.addenda
   }
   { format.authors output
     author format.key output
     format.date "year" output.check
     date.block
     format.btitle "title" output.check
-    get.title.addenda
+    print.title.addenda
   }
   if$
   format.edition output
   new.block
+  format.note output
+  new.block
   format.manual.number output
   new.block
   format.pub.org.lib.address output
   new.block
-  format.note output
-  new.block
   format.eprint output
   format.url output
   fin.entry
@@ -6493,15 +6684,15 @@ FUNCTION {mastersthesis}
   format.date "year" output.check
   date.block
   format.btitle "title" output.check
-  get.title.addenda
+  print.title.addenda
+  new.block
+  format.note output
   new.block
   bbl.mthesis format.thesis.type output.nonnull
   new.block
   school "school" bibinfo.warn output
   address "address" bibinfo.check output
   new.block
-  format.note output
-  new.block
   format.eprint output
   format.url output
   fin.entry
@@ -6515,17 +6706,17 @@ FUNCTION {misc}
 { output.bibitem
   author empty$
     { format.title "title" output.check
-      get.title.online
+      print.labeltitle.addenda
       format.date "year" output.check
       year empty$ 'skip$ { date.block } if$
-      get.title.addenda
+      print.title.addenda
     }
     { format.authors output
       author format.key output
       format.date "year" output.check
       date.block
       format.title "title" output.check
-      get.title.addenda
+      print.title.addenda
     }
   if$
   new.block
@@ -6549,15 +6740,15 @@ FUNCTION {phdthesis}
   format.date "year" output.check
   date.block
   format.btitle "title" output.check
-  get.title.addenda
+  print.title.addenda
+  new.block
+  format.note output
   new.block
   bbl.phdthesis format.thesis.type output.nonnull
   new.block
   school "school" bibinfo.warn output
   address "address" bibinfo.check output
   new.block
-  format.note output
-  new.block
   format.eprint output
   format.url output
   fin.entry
@@ -6571,21 +6762,22 @@ FUNCTION {proceedings}
 { output.bibitem
   editor empty$
     { format.btitle "title" output.check
-      get.title.online
+      print.labeltitle.addenda
       format.date "year" output.check
       year empty$ 'skip$ { date.block } if$
-      get.title.addenda
+      print.title.addenda
     }
     { format.editors output
       editor format.key output
       format.date "year" output.check
       date.block
       format.btitle "title" output.check
-      get.title.addenda
+      print.title.addenda
     }
   if$
   format.bvolume output
   format.number.series output
+  format.note output
   new.sentence
   publisher empty$
     { format.organization.address output }
@@ -6594,8 +6786,6 @@ FUNCTION {proceedings}
     }
   if$
   new.block
-  format.note output
-  new.block
   format.eprint output
   format.url output
   fin.entry
@@ -6609,22 +6799,58 @@ FUNCTION {techreport}
 { output.bibitem
   author empty$
     { format.btitle "title" output.check
-      get.title.online
+      print.labeltitle.addenda
       format.date "year" output.check
       year empty$ 'skip$ { date.block } if$
-      get.title.addenda
+      print.title.addenda
     }
     { format.authors output
       author format.key output
       format.date "year" output.check
       date.block
       format.btitle "title" output.check
-      get.title.addenda
+      print.title.addenda
     }
   if$
   new.block
   format.tr.number output
   new.block
+%    \end{macrocode}
+% \iffalse
+%<*bst2>
+% \fi\bstIIonly
+%
+% In |bathx.bst|, the |library| field is used for the repository,
+% so the note can go in the same position as in \textsf{biblatex-bath}:
+%
+%    \begin{macrocode}
+  format.note output
+  new.block
+%    \end{macrocode}
+% \iffalse
+%</bst2>
+%<*bst1>
+% \fi\addtocounter{mismatch}{2}\addtocounter{lstnumber}{-\value{mismatch}}\bstIonly
+%
+% In |bath.bst|, the |note| field is recommended for the repository,
+% therefore has to go after the publisher (unless the |library| field
+% has been used):
+%
+%    \begin{macrocode}
+  library empty$
+    'skip$
+    { format.note output
+      new.block
+    }
+  if$
+%    \end{macrocode}
+% \iffalse
+%</bst1>
+% \fi\addtocounter{mismatch}{-6}\addtocounter{lstnumber}{\numexpr\value{mismatch}\relax}\bstboth
+%
+% This bit is the same.
+%
+%    \begin{macrocode}
   publisher empty$
     { format.institution.address output }
     { institution "institution" bibinfo.check output
@@ -6632,9 +6858,36 @@ FUNCTION {techreport}
     }
   if$
   new.block
+%    \end{macrocode}
+% \iffalse
+%<*bst2>
+% \fi\bstIIonly
+%
+% In |bathx.bst|, the |library| field always comes after the publisher:
+%
+%    \begin{macrocode}
   format.library output
-  new.block
-  format.note output
+%    \end{macrocode}
+% \iffalse
+%</bst2>
+%<*bst1>
+% \fi\addtocounter{mismatch}{1}\addtocounter{lstnumber}{-\value{mismatch}}\bstIonly
+%
+% In |bath.bst|, we fall back to |note| if |library| is not provided:
+%
+%    \begin{macrocode}
+  library empty$
+    { format.note output }
+    { format.library output }
+  if$
+%    \end{macrocode}
+% \iffalse
+%</bst1>
+% \fi\addtocounter{mismatch}{-4}\addtocounter{lstnumber}{\numexpr\value{mismatch}\relax}\bstboth
+%
+% The rest is the same.
+%
+%    \begin{macrocode}
   new.block
   format.eprint output
   format.url output
@@ -6649,17 +6902,17 @@ FUNCTION {unpublished}
 { output.bibitem
   author empty$
     { booktitle empty$ 'format.btitle 'format.title if$ "title" output.check
-      get.title.online
+      print.labeltitle.addenda
       format.date "year" output.check
       year empty$ 'skip$ { date.block } if$
-      get.title.addenda
+      print.title.addenda
     }
     { format.authors output
       author format.key output
       format.date "year" output.check
       date.block
       booktitle empty$ 'format.btitle 'format.title if$ "title" output.check
-      get.title.addenda
+      print.title.addenda
     }
   if$
   new.block
@@ -6667,10 +6920,10 @@ FUNCTION {unpublished}
   new.block
   howpublished "howpublished" bibinfo.check output
   new.block
-  bbl.unpublished output
-  new.block
   format.note output
   new.block
+  bbl.unpublished output
+  new.block
   format.eprint output
   format.url output
   fin.entry
@@ -6714,7 +6967,8 @@ FUNCTION {default.type} { misc }
 
 %    \end{macrocode}
 %
-% \subsection{Bibliography processing}
+% \subsection{Writing out the bibliography to a file}
+% \label{sec:writing3}
 %
 % We are now ready for Bib\TeX\ to read in the \texttt{.bib} file.
 %
@@ -6906,9 +7160,10 @@ FUNCTION {calc.short.authors}
 }
 %    \end{macrocode}
 %
-% |calc.label| creates a string in the form `Truncated Author List(Year'. The
-% closing parenthesis is supplied by |output.bibitem| (see above), into which
-% this string is incorporated.
+% |calc.label| creates a string in the form `Truncated Author List(Year' and
+% saves it to the |label| variable. The closing parenthesis is supplied by
+% |output.bibitem| (see section \ref{sec:writing2}), into which this string is
+% incorporated.
 %
 %    \begin{macrocode}
 FUNCTION {calc.label}
-- 
cgit v1.2.3

