
\section{Special problems}
\label{sec:SpecPr}


\subsection{Make lists of references formatted with different fonts}
\label{sec:SpecPrListRDiffFonts}

As \texttt{References} only produces plain text files, information on font
type for certain elements of these citations as \texttt{typewriter-like 
monospaced font}, \textit{italicized}, \textit{underlined} or
\textbf{bold} has to be added indirectly.  A practical convention in this
version of References\footnote{You may, however, introduce yout own
  mechanism!}  proposes that you can write format definitions for lists of
references like:

\begin{verbatim}
  ... ___open-it(text to appear in italics)close-it___ ...
  ... ___open-tt(text to appear monospaced)close-tt___ ...
  ... ___open-bf(text to appear bold)close-bf___ ...
  ... ___open-ul(text to appear undelined)close-ul___ ...
  ... ___open-sc(text to appear in small capitals)close-sc___ ...
\end{verbatim}

\texttt{References} provides two scripts, which can convert text files with 
these tags either into HTML-documents or into text for \LaTeX-documents.
The ``tags'' \verb+___open-sc(...)close-sc___+ are only processed for
\LaTeX\ documents, they are ignored for HTML.
\index{fonts!formatting in lists of references}%
\index{HTML-files!fonts!formatting in lists of references}%
\index{LaTeX-files, fonts@\LaTeX-files, fonts}%
As an example, you may study the bibliographic format definition \texttt{APA-FS
  BFD}. If you use a normal text processor, you can convert a list of
  references into a complete formatted HTML-file with \mopt{edit-main-p htm}.
 and import it into the manuscript.
To produce a text to be included into a \LaTeX\ document, select
  \mopt{edit-main-p ltx}\footnote{This allows you to use or write one format
  definition for HTML and \LaTeX-documents}. If you use ``underlined'' in a
  \LaTeX{} document, please load the soul-package.


\subsection{How to create formatted citations of references in a manuscript}
\label{sec:FormattedCitationsMS}


\subsubsection{Principles}
\label{sec:PrinciplesFormattedCitations}

  \index{citations}
  \index{refscite()@\texttt{refscite()}}
Scientific manuscripts have to provide a list of references at the end which
contain all items cited in the text of the manuscript. It is therefore
necessary to enter citations in a ``raw'' format in the text which allows
automatic processing of the manuscript. These citations in the text must be
converted later into either a \emph{numeric format} or the \emph{author-date
format} (cf. section \ref{sec:GeneralReferencesMS}).%
  \index{author-date citations}
  \index{numeric citations}
The default method for
\texttt{References} is to enter reference numbers in the format
\texttt{refscite(reference-number)}\footnote{At present, only one reference
number can be entered in this way}.  The second step is to read the manuscript
automatically to extract all reference numbers into a tbt- or bbt-file.
Therefore you will have to create a copy of the manuscript with all portions
containing citations in a unformatted text file. This is most easily done by
copying the manuscript into the clipboard%
  \index{clipboard}
and save it as text file with the
text editor\footnote{Therefore open start the editor with an empty file,
  paste the clipboard into the document and save it as text file}. 


Citations can be formatted manually\footnote{using search-and-replace function
of the word processor} in a document written by a word processor. Therefore
\texttt{References} can prepare a list of items to be searched and the
corresponding items to be replaced (see section
\ref{sec:PrinciplesFormattedCitations}). Citations in a large
document\footnote{written in StarOffice Writer or Microsoft Word} can also be processed
automatically. Therefore, \texttt{References} can generate a macro for the
text processor (things are much easier with \LaTeX, details are
described in section \ref{LaTeXRefsGeneralDescription}). 
For all these tasks, \texttt{References}%
  \index{generic macro!processing of citations in a word processor manuscript}
makes a \emph{generic macro} first, which is  then converted either into a
list for manual search-and-replace processing in a text processing program or
a macro (e.\,g. for a word processor). The generic macro has the format:

\begin{verbatim}
  ///A///refscite(i03544)///B///[8]///C///
\end{verbatim}

\index{macro format definitions} such a macro can be generated with
\mopt{main-l m} command using the macro format definition
\texttt{CITATION-NUM-1 MFD}, in its converted form it is intended to replace
raw citations of the type \texttt{refscite(i03544)} to numeric citations like
``\texttt{[8]}''. With the macro format definition \texttt{CITATION-AY-1 MFD}
generic macros for citations in author-date format: ``(Mueller et al.,
2001)''can be made.

\begin{verbatim}
  ///A///refscite(i03544)///B///(Mueller et al., 2001)///C///
  ///A///refscite(i03522)///B///(Grandfather and Smith, 1920)///C///
\end{verbatim}

These generic macros can be converted into a list for manual
search-and-replace commands for a text processor with 
\mopt{edit-main-p msr}:

\begin{verbatim}
   refscite(i03544)
   (Mueller et al., 2001)
   done:

   refscite(i03522)
   (Grandfather and Smith, 1920)
   done:
\end{verbatim}

or into macros for text processors as described in sections
\ref{sec:OOOMacros}, \ref{sec:MSWordMacros}. Scripts for generation of these
macros have been written following analysis of search and replace operations
recorded by the macro recorder of the respective word processor.

\subsubsection{Format citations automatically in an OpenOffice.org/StarOffice
Writer document}

\label{sec:OOOMacros}
\index{macro (StarOffice Writer) for creating citations in the manuscript}
\index{macro (OpenOffice.org Writer) for creating citations in the manuscript}
\index{StarOffice Writer macro for creating citations in the manuscript}
\index{OpenOffice.org Writer macro for creating citations in the manuscript}
\index{Writer (StarOffice, OpenOffice.org) macro for creating citations in 
 the manuscript}

\emph{The procedures described in this section work satisfactorily in the
hands of the program author. However, the program author does not assume any
liability for damages, resulting from the use of macros generated by
\texttt{References} in the StarOffice/OpenOffice.org package. The user may
apply these functions at her/his own risk.\footnote{These macros have been
developed and extensively tested with StarOffice Writer v.7 including product
update 1. They should, however work also in OpenOffice.org Writer. Information 
of users about better solutions for this problem is welcome!}}

\begin{itemize}
\item Write the manuscript with ``raw'' citations in the format:
  \texttt{...refscite(ref-number)...}\footnote{only \emph{one} reference
  number can be entered as one \texttt{refscite()-argument}}
\item Save a copy of the manuscript as pure text file, this is most easily
  achieved by selecting the text in the text processor, copying it into the
  clipboard of the  operating system and saving it as text file
  (e.\,g. with the filename extension \texttt{.txt} in the text editor), as an
  example, save this text file under the name \texttt{ex.txt}.
\item Extract the reference numbers from this (\texttt{ex.txt}) file:
  \begin{itemize}
  \item select \mopt{main-t xr txt}
  \item select the number assigned to \texttt{ex.txt}
  \item enter the name of the bbt-file to be created for the reference
  numbers, as an example \texttt{cits} (this will create \texttt{cits.bbt})
  \item confirm the default search pattern (\texttt{refscite()}) with
   \mopt{Enter}
  \end{itemize}
\item extract duplicate records:
  \begin{itemize}
  \item Select \mopt{main b rd}
  \item enter the number assigned to \texttt{cits.bbt}
\end{itemize}
\item Create the generic macro with 
  \begin{itemize}
  \item \mopt{main-l m}
  \item confirm ``\texttt{macro}'' as default for output text file, if this
    file already exists, confirm overwriting with \mopt{y}
  \item select number assigned to bbt-file (\texttt{cits.bbt})
  \item find appropriate macro definition (\texttt{CITATION-NUM-1~MFD}): close 
   selection list with  \mopt{q}, enter number assigned to 
   \texttt{CITATION-NUM-1~MFD}
 \item confirm ``\texttt{1}'' for number assigned to the first reference with
   \mopt{Enter}, $\rightarrow$ \texttt{macro.txt} is written, it looks like
\begin{verbatim}
   ///A///refscite(i05592)///B///[1]///C///
\end{verbatim}
\end{itemize}
  \item convert it to a StarOffice Writer\footnote{also: OpenOffice.org Writer}
  macro with 

  \begin{itemize}
  \item Enter \mopt{edit-main-p osw}
  \item select the file \texttt{macro.txt}, this creates a StarOffice
    macro, named \texttt{ooo-mak.txt} to be inserted into a macro module, it
    should look like figure \ref{fig:OOOrgCitations} after replacing the empty
    \texttt{Sub Main} definition:
\begin{verbatim}
REM  *****  BASIC  *****

Sub Main

End Sub
\end{verbatim}

    by the contents of \texttt{ooo-mak.txt}.
 \end{itemize}

\item Run the macro within StarOffice/OpenOffice.org Writer.
\end{itemize}

The code for the search-and-replace
operations in figure \ref{fig:OOOrgCitations} was derived from code
descibed in \cite[page 104]{StarOfficeBasicPHv7}. It was tested using 
StarOffice~7.

\begin{figure}[t]
%% \footnotesize
%%  \begin{center}
%%  \begin{boxedverbatim}
%%  REM  *****  BASIC  *****
%%  
%%  
%%  sub Main
%%  rem ----------------------------------------------------------------------
%%  rem define variables
%%  dim document   as object
%%  dim dispatcher as object
%%  rem ----------------------------------------------------------------------
%%  rem get access to the document
%%  document   = ThisComponent.CurrentController.Frame
%%  dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
%%  
%%  rem ----------------------------------------------------------------------
%%  dispatcher.executeDispatch(document, ".uno:GoToStartOfDoc", "", 0, Array())
%%  
%%  rem ----------------------------------------------------------------------
%%  dim args2(18) as new com.sun.star.beans.PropertyValue
%%  args2(0).Name = "SearchItem.StyleFamily"
%%  args2(0).Value = 2
%%  args2(1).Name = "SearchItem.CellType"
%%  args2(1).Value = 0
%%  args2(2).Name = "SearchItem.RowDirection"
%%  args2(2).Value = true
%%  args2(3).Name = "SearchItem.AllTables"
%%  args2(3).Value = false
%%  args2(4).Name = "SearchItem.Backward"
%%  args2(4).Value = false
%%  args2(5).Name = "SearchItem.Pattern"
%%  args2(5).Value = false
%%  args2(6).Name = "SearchItem.Content"
%%  args2(6).Value = false
%%  args2(7).Name = "SearchItem.AsianOptions"
%%  args2(7).Value = false
%%  args2(8).Name = "SearchItem.AlgorithmType"
%%  args2(8).Value = 0
%%  args2(9).Name = "SearchItem.SearchFlags"
%%  args2(9).Value = 65536
%%  args2(10).Name = "SearchItem.SearchString"
%%  args2(10).Value = "refscite(i05592)"
%%  args2(11).Name = "SearchItem.ReplaceString"
%%  args2(11).Value = "[1]"
%%  args2(12).Name = "SearchItem.Locale"
%%  args2(12).Value = 255
%%  args2(13).Name = "SearchItem.ChangedChars"
%%  args2(13).Value = 2
%%  args2(14).Name = "SearchItem.DeletedChars"
%%  args2(14).Value = 2
%%  args2(15).Name = "SearchItem.InsertedChars"
%%  args2(15).Value = 2
%%  args2(16).Name = "SearchItem.TransliterateFlags"
%%  args2(16).Value = 1280
%%  args2(17).Name = "SearchItem.Command"
%%  args2(17).Value = 3
%%  args2(18).Name = "Quiet"
%%  args2(18).Value = true
%%  
%%  dispatcher.executeDispatch(document, ".uno:ExecuteSearch", "", 0, args2())
%%  
%%  
%%  end sub
%%  \end{boxedverbatim}
%%  \end{center}

\centering 
\small
\begin{boxedverbatim}
REM  *****  BASIC  *****

Sub Main
Dim I As Long
Dim Doc As Object
Dim Replace As Object
Dim RawWords(2) As String
Dim FormattedWords(2) As String
RawWords() = Array(_
"refscite(i07160)",_
"refscite(i07161)",_
"refscite(i07162)"_
)
FormattedWords() = Array(_
"(Ahmad et al., 2004)",_
"(Shattil, 2004)",_
"(Nguyen et al., 2004)"_
)
Doc = StarDesktop.CurrentComponent
Replace = Doc.createReplaceDescriptor
For I = 0 To 2
        Replace.SearchString = RawWords(I)
        Replace.ReplaceString = FormattedWords(I)
        Doc.replaceAll(Replace)
Next I
End Sub
\end{boxedverbatim}

  \caption[Macro to process citations in StarOffice/OpenOffice.org
   Writer documents]{Macro to process
   citations in StarOffice/OpenOffice.org
   Writer documents, this fragment replaces \texttt{refscite(i07160)} by
   \texttt{(Ahmad et al., 2004)},
   \texttt{refscite(i07161)} by
   \texttt{(Shattil, 2004)} and 
   \texttt{refscite(i07162)} by
   \texttt{(Nguyen et al., 2004)}.}
  \label{fig:OOOrgCitations}
\end{figure}

% Apparently, StarOffice Writer has a limitation for the maximal size of macro
% source code. Therefore the \mopt{edit-main-p osw} command produces macro files
% with a maximum of 30 search and replace operations named
% \texttt{ooo-mak1.txt}, \texttt{ooo-mak2.txt} \dots \texttt{ooo-makN.txt}. You
% should copy these files into separate modules and run the code in these
% modules subsequently.


\subsubsection{Format citations automatically in a Microsoft Word document}
\label{sec:MSWordMacros}

\index{macro (Microsoft Word) for creating citations in the manuscript}
\index{Microsoft Word macro for creating citations in the manuscript}
\emph{The procedures described in this section work satisfactorily in the
hands of the program author. However, the program author does not assume any
liability for damages, resulting from the use of macros generated by
\texttt{References} in Microsoft Word or the Microsoft 
Office package. The user may apply these functions at her/his own risk.}

\texttt{References} provides a method to create appropriate citations in a
manuscript written with the Word module of the Microsoft Office package.
Therefore, a Word macro can be created with \texttt{References}. 
You can use it by loading a copy of your manuscript with the raw
\texttt{refscite()}-citations, by opening
the Macro dialog, creating an empty macro \emph{for the current document} as:

\begin{verbatim}
   Sub repl()
   '
   ' repl Makro
   ' Makro erstellt am 09.06.03 ...
   '

   End Sub
\end{verbatim}

and by pasting the code of the macro generated by \texttt{References} between
\texttt{Sub macroname()} and \texttt{End Sub}. Make the macro available to the
current document and run (execute) the macro\footnote{For detailed information
  of the the user is referred to the documentation of the office package}. It
is highly recommended to run the macro on a \emph{copy of the original
  manuscript file} (to be used only for the final printing).


The following steps are necessary to create a macro for Microsoft Word
generating numeric citations referring to a list with the references in the
same order as they appear in the text:

\begin{itemize}
\item Write the manuscript with ``raw'' citations in the format:
  \texttt{...refscite(ref-number)...}\footnote{only \emph{one} reference
  number can be entered as one \texttt{refscite()-argument}}
\item Save a copy of the manuscript as pure text file, this is most easily
  achieved by selecting the text in the text processor, copying it into the
  clipboard of the  operating system and saving it as text file
  (e.\,g. with the filename extension \texttt{.txt} in the text editor), as an
  example, save this text file under the name \texttt{ex.txt}.
\item Extract the reference numbers from this (\texttt{ex.txt}) file:
  \begin{itemize}
  \item select \mopt{main-t xr txt}
  \item select the number assigned to \texttt{ex.txt}
  \item enter the name of the bbt-file to be created for the reference
  numbers, as an example \texttt{cits} (this will create \texttt{cits.bbt})
  \item confirm the default search pattern (\texttt{refscite()}) with
   \mopt{Enter}
  \end{itemize}
\item extract duplicate records:
  \begin{itemize}
  \item Select \mopt{main b rd}
  \item enter the number assigned to \texttt{cits.bbt}
\end{itemize}
\item Create the generic macro with 
  \begin{itemize}
  \item \mopt{main-l m}
  \item confirm ``\texttt{macro}'' as default for output text file, if this
    file already exists, confirm overwriting with \mopt{y}
  \item select number assigned to bbt-file (\texttt{cits.bbt})
  \item find appropriate macro definition (\texttt{CITATION-NUM-1~MFD}): close 
   selection list with  \mopt{q}, enter number assigned to 
   \texttt{CITATION-NUM-1~MFD}
 \item confirm ``\texttt{1}'' for number assigned to the first reference with
   \mopt{Enter}, $\rightarrow$ \texttt{macro.txt} is written, it looks like
\begin{verbatim}
   ///A///refscite(i03544)///B///[1]///C///
   ///A///refscite(i04159)///B///[2]///C///
\end{verbatim}
\end{itemize}
  \item convert it to a Microsoft Word macro with 

  \begin{itemize}
  \item Enter \mopt{edit-main-p wdm}
  \item select the file \texttt{macro.txt}, this creates the part of the Word
    macro to be inserted into the \texttt{Sub}, named \texttt{msw-mak.txt}, it
    should look like\footnote{after inserting \texttt{msw-mak.txt} into the
      \texttt{Sub} in the Word macro editor:} figure
    \ref{fig:WordMacroCitations}\footnote{The code for the search-and-replace
      operations in figure \ref{fig:WordMacroCitations} was derived from code
      generated by the macro recorder of Word}

 \end{itemize}

\item Run the macro within Word.
\end{itemize}


\begin{figure}[t]
  \centering \footnotesize
\begin{boxedverbatim}
   Sub repl()
   '
   ' repl Makro
   ' Makro erstellt am 09.06.03 ...
   '
    Selection.HomeKey Unit:=wdStory
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "refscite(i03544)"
        .Replacement.Text = "[1]"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.HomeKey Unit:=wdStory
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "refscite(i04159)"
        .Replacement.Text = "[2]"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
   End Sub
\end{boxedverbatim}
\caption[Macro to process citations in Microsoft Word documents]{Macro to process
   citations in Microsoft Word documents, this fragment replaces \texttt{refscite(i03544)}
   by \texttt{[1]} and \texttt{refscite(i04159)} by \texttt{[2]}.}
  \label{fig:WordMacroCitations}  
\end{figure}

\subsubsection{How to process manuscripts with citations in author-date-format
  with a, b, c \dots{} appended to the year of publication}

\label{howdoiAuYearYearabc}

\index{author-date citations}%

If editors of scientific journals require manuscripts in author-date format it
is often necessary to add `a', `b' \dots to the year if manuscripts (cited in
the manuscript) of the same first author appeared in the same year. 


\paragraph{Manual method}

\begin{enumerate}
\item To make alphabetical sorting of the bbt-file possible add autor names
  and years of publication with \mopt{main-b ay}, sort with \mopt{main-b s2},
  convert bbt file into text format with \mopt{main-b bt}. Edit tbt-file with
  the text editor: change \texttt{year} to \texttt{yeara} \dots where
  necessary, convert this file back to a bbt file with \mopt{main-b tb}.
\item Generate the list if references.
  In order to change the list of references automatically, use a 
  search and replace
  script (section \ref{sec:SearchAndReplace}). Therefore enter the complete
  reference as text to be searched and the modified\footnote{year with a, b
    \dots{} appended} reference as text to be replaced.
\item Generate the macro text file in the format:
\begin{verbatim}
///A///refscite(i06875.ua)///B///(Petz and Garratty, 2004)///C///
///A///refscite(i06875.tr)///B///(Petz and Garratty, 2004)///C///
\end{verbatim}
  Change the macro appropriately, e.\,g.
\begin{verbatim}
///A///refscite(i06875.ua)///B///(Petz and Garratty, 2004a)///C///
///A///refscite(i06875.tr)///B///(Petz and Garratty, 2004b)///C///
\end{verbatim}

This can be done automatically with a search and replace script. The ``raw''
macro can then be converted to its final form (e.\,g. by one of the options of
the  \mopt{edit-main-p} menu).

\end{enumerate}

\paragraph{Automatic method}

Create format definitions which produce lists of references and macro text
files with year numbers written ``\verb+YYYY___reference-number___+'' instead
of ``\verb+YYYY+''. Using search and replace either remove
``\verb+___reference-number___+'' or replace it by ``\verb+a+'', ``\verb+b+''
and following characters if appropriate. 

In detail, the following steps must be taken:

\begin{enumerate}
\item Write or select a format definition for the
  \emph{list of references} which
  produces \verb+YYYY___reference-number___+ (instead of only issuing the year
  of publication)
\item Write or select a format definition for the \emph{macro which formats
  citations in the manuscript text} with
   \verb+YYYY___reference-number___+ (instead of the year
  of publication only)
\item Write a search and replace script to replace
  ``\verb+YYYY___reference-number___+'' by ``\verb+a+'', ``\verb+b+'' where
  necessary \label{ListReplYearabcToBeChanged} 
\item Remove the remaining \verb+YYYY___reference-number___+s. A search and
  replace script doing this can be found in the archive
  \texttt{remove-refno.zip}\footnote{available on the \texttt{References}
    project homepage \url{http://references.sourceforge.net}} 
    \label{ListReplYearabcRest} 
\item Process the \emph{list of references} and the \emph{macro which formats
  citations in the manuscript text} with scripts
  \ref{ListReplYearabcToBeChanged}. and \ref{ListReplYearabcRest}.
\end{enumerate}


\subsubsection{How to generate superscripted numerical references in a
manuscript}

\label{secProcRefSuperscriptNumR}
\index{superscripted numerical bibliographic references}
\index{numerical bibliographic references!superscripted}
\index{bibliographic references!superscripted}

Many journals require superscripted numerical references in their
manuscripts. The following procedure applies to OpenOffice.org/StarOffice
writer. The procedure for Microsoft Word is described in the last paragraph of
this section.
It is assumed that superscripted numerical citations 
follow full stop or comma:

\hspace{1em} \dots for a review see Miller.$^{1, 4}$

To generate such superscripted references you may enter the ``raw'' citations
as 

\hspace{1em}\dots for a review see Miller.///refscite(i03211), refscite(i03200)///

Then convert the \texttt{refscite()}s into numbers (without brackets using the
\texttt{CITATION-NUM-2 MFD} macro format definition):

\hspace{1em}\dots for a review see Miller.///1, 4///

and then change the format from normal to ``superscript'' using the
OpenOffice.org/StarOffice writer search and replace function. 
% Enter ``\verb*+///[0-9\,\ ]*///+'' into the ``search for'' field,
Enter ``\verb*+///[^/]*///+'' into the ``search for'' field,
and ``\verb+&+''%
  \footnote{the character ``\texttt{\&}'' inserts the text found by the
  regular expression}
into the ``replace by'' field, change the \emph{format} in
the ``replace by'' from normal to superscript (or ``high'' position), check
the box for regular expressions, and select ``replace all''%
  \footnote{the OpenOffice.org/StarOffice writer command names may be different
  in the English versions, the program author uses translations of
  commands of the German StarOffice version}.
This produces:

\hspace{1em}\dots for a review see Miller.$^{///1, 4///}$

You may then remove the \verb+///+-delimiters with a search and replace
operation (search ``\texttt{///}'' and replace it by an empty string):

\hspace{1em}\dots for a review see Miller.$^{1, 4}$

and obtain the desired result. Instead of ``\texttt{///}'' you may use any other
string with characters which have no special meaning in
OpenOffice.org/StarOffice's regular expressions and which do 
not appear in the normal text. The strings ``\texttt{///}''
only have the function to label those strings to be superscripted. 

A similar solution can be found for Microsoft Word, regular expressions are 
called ``Platzhalterzeichen'' (``wildcards'') in the German version used 
by the progam author%
\footnote{Into the search field please enter: \texttt{///(*)///}, 
into the replace field:
\texttt{\textbackslash 1}, again format the the replace field as
superscripted, here it is not necessary to remove the \texttt{///}s: 
\texttt{\textbackslash 1} inserts the list of citations without 
\texttt{///}s}.


\subsubsection{How to generate grouped numerical references in brackets 
in a manuscript}



\label{secProcRefSquareBrNumR}
\index{numerical bibliographic references in square brackets}
\index{bibliographic references!numerical!in square brackets}


Reference numbers in square brackets are quite common.  
The following procedure applies to OpenOffice.org/StarOffice
writer (You should have read section \ref{secProcRefSuperscriptNumR} before). 
It is assumed that numerical citations 
precede full stop or comma:

\hspace{1em} \dots for a review see Miller [1, 4].

To generate these references you may enter the ``raw'' citations
as 

\hspace{1em}\dots for a review see Miller ///refscite(i03211),
refscite(i03200)///.

Then convert the \texttt{refscite()}s into numbers (without brackets using the
\texttt{CITATION-NUM-2 MFD} macro format definition):


\hspace{1em}\dots for a review see Miller ///1, 4///.

and then change insert the brackets using the
OpenOffice.org/StarOffice writer search and replace function. 
Enter ``\verb*+///[^/]*///+'' into the ``search for'' field,
and ``\verb+[&]+'' into the ``replace by'' field, check
the box for regular expressions. This generates

\hspace{1em}\dots for a review see Miller [///1, 4///].

You may then sort and compress the lists of numerical citations as described
in section \ref{secProcRefSortCompressNumR} and remove the ``\texttt{///}''
strings.


\subsubsection{How to sort and compress lists of numerical citations in 
a manuscript}

\label{secProcRefSortCompressNumR}


\index{lists of numerical citations!sort and compress}
\index{sort and compress lists of numerical citations}
\index{citations!numerical!sorting}
If references are cited within the manuscript numerically, lists of citations
may occur like\hoch{\scriptsize 2, 5, 3, 1, 20, 6} or like [2, 5, 3, 1, 20,
6]. Here it is often required to sort the reference numbers in ascending order
and to compress consecutive numbers as in\hoch{\scriptsize 1-3, 5-6, 20} or
[1-3, 5-6, 20]\footnote{If you are using \LaTeX{} and Bib\TeX{} this cane be
done automatically with the \texttt{cite} package}. \texttt{References}
supports automatic conversions of unsorted lists of citations to sorted and
compressed lists with the text processor 
in the following way:

\begin{enumerate}
  \item Write the raw citations numbers between pairs of three slashes:

  [///refscite(001233), refscite(25666), refscite(23699) ... ///]
  
  or (for superscripted lists of references without square brackets:)

  ///refscite(001233), refscite(25666), refscite(23699) ... ///
  
  \item Format these raw references as described in section
   \ref{sec:OOOMacros}  or  \ref{sec:MSWordMacros} using the
   \texttt{CITATION-NUM-2 MFD} macro format definition: 
 
  [///2, 5, 3, 1, 20, 6///]

or

  ///2, 5, 3, 1, 20, 6///

the latter list may be converted to superscripted text as described in
section \ref{secProcRefSuperscriptNumR}:

% \hoch{\scriptsize ///1-3, 5-6, 20///}
\hoch{\scriptsize ///2, 5, 3, 1, 20, 6///}


  \item Copy the manuscript as pure text file into the text editor (using the
  clipboard of the operating system) and save it
  in the database text directory using a file name with extension
  ``\texttt{.txt}''. 
  \item Process this text file with 
  \mopt{edit-main-p snc}. This generates a raw macro (in a
  file named \texttt{numgr.txt} as default) containing lines like
  
  \texttt{///A///2, 5, 3, 1, 20, 6///B///1-3, 5-6, 20///C///} 
  
  which may be
  converted to a macro for OpenOffice.org/StarOffice with 
  \mopt{edit-main-p osw} or for Microsoft Word with
  \mopt{edit-main-p wdm}. Copy the macro code into the macro text editor in
  the text processor and run the macro. This will result in compressed lists
  of numeric citations:

 \hoch{\scriptsize ///1-3, 5-6, 20///}

 The slashes (\texttt{///}) can be removed with the appropriate text processor search and
 replace command. 
%   \item 
%   \item 
\end{enumerate}



\subsection{Process manuscripts with reference numbers missing in the database}
\label{secProcRefNosMissingInDB}

\index{manuscripts references numbers missing in database}
\index{missing reference numbers!deliberate use in manuscripts}

You may wish to include references in your manuscript, which are missing in
your database. If you include them with \texttt{refscite(MissingRefNo)} lists
of references will show them as \verb+--MissingRefNo--+, macro files as
\verb+==MissingRefNo==+. Before using the list of references or macro file
replace \verb+--MissingRefNo--+, \verb+==MissingRefNo==+ by the final content
using a sr-script (cf. section \ref{sec:SearchAndReplace}).
%% This explantation should be illustrated with an example.


\subsection{Make sorted lists of references}
\label{sec:SortedReferences}

\index{sorted lists of references}
\index{lists of references, sorted}
Instructions for authors often require that lists of references are sorted in
alphabetical order of authors' (or editors') names. This task is most easily
completed with the following sequence of actions. 

\begin{enumerate}
  \item Extract all reference numbers from the manuscript into a bbt-file
    (e.\,g. with \mopt{main-t xr}) 
  \item Delete all duplicate references (e.\,g. \mopt{main-b rs})
  \item Write authors' names (and date of publication) into the text field of
    records in the bbt-file with \mopt{main-b ay}
  \item Sort the bbt-file according to the text field (\mopt{main-b s2})
  \item Write the list of references (\mopt{main-l ...})
\end{enumerate}

A better (but a little more complicated) alternative uses the
sortrefs-script:

\begin{enumerate}
  \item Extract all reference numbers from the manuscript into a bbt-file
    (e.\,g. with \mopt{main-t xr}) 
  \item Delete all duplicate references (e.\,g. \mopt{main-b rs})
  \item Compile a macro text file through \mopt{main-l m} with the
    macro format definition (MFD) \texttt{MFD SORT-01}. For the name of the
    output text file confirm \texttt{macro.txt}\footnote{If you select 
    another filename, you will have to change the name of the file to be
    processed in the \texttt{sortrefs.bat} command file}.
     
  \item Make a tbt-file with sorted items with \mopt{edit-main-p srt}
  or call \texttt{sortrefs} at the command line, 
  this generates the tbt-file with sorted items
  (\texttt{sorted.tbt}).
  \item Convert the tbt-file into a bbt-file (\mopt{main-b tb}).
\end{enumerate}

Sorting order in this case (macro definition \texttt{MFD SORT-01}) 
is due to three keys:

\begin{enumerate}
  \item name of first author
  \item first name of first author
  \item year of publication
\end{enumerate}

%% Another macro definition for sorting (\texttt{a3ny}) sorts according to two
%% keys:

%% \begin{enumerate}
%%   \item names and first names of the first three authors
%%   \item year of publication
%% \end{enumerate}

By writing other macro definitions you may create macros for the sortrefs
script for any sorting order
conceivable with three fields. Fields must be separated by a ``\verb+*+'' as 
in\footnote{generated by the \texttt{} macro definition}: 

\begin{verbatim}
   i03784*Brunner-Bollinger*S*1997
   i03819*Santoso*S*1998
   i04082*Kroll*H*1998
   i04097*Kiefel*V*2000*
\end{verbatim}

First field (no preceding \verb+*+!) must contain the reference number, the
following fields the 1st, 2nd and 3rd key used for sorting.

\subsection{Replace references in a database}

\index{arr-file}
If you import data from an arr-file into a database, only those records are
imported, which are not already in the database, existing records are not
overwritten. If you wish to update a database with newer versions of
references, then you will have to delete the records in the database first.
All this is done in these steps:

\begin{enumerate}
  \item copy the arr-file into the database (text) directory, e.\,g.
    \verb+c:\refs42\data+, 
  \item extract the reference numbers from the arr-file with the
    \texttt{exarr}-script:
    the command at the OS-prompt
\begin{verbatim}
   exarr tutorial
\end{verbatim}
    writes the reference numbers into \verb+ex_arr.tbt+, alternatively you can
    use the command \mopt{edit-main-p exa},
  \item convert the tbt-file into a bbt-file,
  \item delete the records in this file with \mopt{main-f d},
  \item import the arr-file.
\end{enumerate}


\subsection{Backup of \texttt{References} databases}

\label{sec:BackupDb}
\index{backup of \texttt{References}-databases}

A backup of a \texttt{References} database may prepared with an archiving
program, such as \texttt{zip}. For example, to make a backup of a the
\texttt{tutorial} database of the standard installation, you should include
directory \verb+c:\refs42\tutorial+ and the \verb+c:\refs42\tutorial\rdb+
subdirectory into the archive. The archiving program should preserve
subdirectories. 

For the sake of safety, you should also write all your complete databases into
arr-files, details of this procedure are described in %
  \index{arr-file}%
(section \ref{sec:ExportImportDbtoArr}). Bibliographic format definitions and
macro format definitions should be exported into an fd-file.%
  \index{fd-file}
  \index{bibliographic format definitions!backup}
  \index{macro format definitions!backup}




\subsection{Eliminate duplicate or multiplicate records in a database}
\label{sec:ElimDuplicateRecs}

\index{duplicate records in a database}
With a growing database, the chance that references have been entered twice at
different positions in the database increase. In these cases it will be of
interest, to identify all records, which appear more than once in the
database.

\begin{enumerate}
\item Make a bbt-file with reference numbers of all database records with
  \mopt{menu-b ba} (enter a name for bbt-file, e.\,g. \texttt{all}).
\item Write \emph{unique record identifiers} into the text field of
  \texttt{all.bbt} with \mopt{menu-b ui i}
\item Convert bbt-file with \mopt{menu-b ed}: this makes a new file
  \texttt{all.bbt} which only contain the reference numbers of records, which
  appear more often than once in the database.
\item Make a list of references from this bbt-file \texttt{all.bbt} (which now
  does no more contain all records) with \mopt{main-l s} [enter name for text
  file] [select file \texttt{all.bbt}], \mopt{6} (this selects a special text
  file format, bibliographic references from this file can directly be copied
  into a bbt-file).


\end{enumerate}


\subsection{Convert bibliographic references from Medline-format}
\label{sec:ConvertMedline}

A good alternative to manual typing in of bibliographic references is
automatic conversion of data downloaded from publicly accessible databases,
e.\,g PubMed\footnote{\url{http://www.ncbi.nlm.nih.gov/entrez/query.fcgi}}.
The procedure is described in detail in section \ref{sec:ImportFromMedline}.


\clearpage


%%% Local Variables: ***
%%% mode:latex ***
%%% TeX-master: "refsdok.tex"  ***
%%% End: ***
