20.1 LaTeX


Chicago
For XML
Fussy and Sloppy
Head and Foot Lines

ltbibl.dtx

\Link’ must follow ‘\o:bibitem:’; otherwise it will insert stuff before an ‘\item’.

<..latex ltbibl..>
 \:CheckOption{no-bib} \if:Option\else
    <.cite in doc to bib.>
    <.listing of bib.>
 \fi
 -_-_-

<..cite in doc to bib..>
 \ifx \o:@citex:\:UnDef \let\o:@citex:=\@citex\fi
 \catcode‘\:=12
 \def\@citex[#1]#2{%
   \let\@citea\@empty
   <.a cite.>\@cite{\@for\@citeb:=#2\do
     {\@citea\def\@citea{,\penalty\@m\ }%
      {<.sub sup cite.>\xdef\@citeb{\expandafter\@firstofone\@citeb}}%
      \if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi
      \@ifundefined{b@\@citeb}{\mbox{\reset@font\bfseries ?}%
        \G@refundefinedtrue
        \@latex@warning
          {Citation ‘\@citeb’ on page \thepage \space undefined}}%
        {{<.link cite.>\csname b@\@citeb\endcsname
          <.end link cite.>}}}}{#1}<.b cite.>}
 \catcode‘\:=11
 -_-_-

<..a cite..>
 \csname a:cite\endcsname
 -_-_-

<..b cite..>
 \csname b:cite\endcsname
 -_-_-

<..link cite..>
 \cIteLink {X\@citeb}{}%
 -_-_-

<..end link cite..>
 \EndcIteLink
 -_-_-

<..sub sup cite..>
 \SUBOff \SUPOff
 -_-_-

Was \x:SUBOff \x:SUPOff–any problems?

Had to remove \hbox from ‘{\cIteLink {X\@citeb}{}\csname b@\@citeb\endcsname\EndcIteLink}’ because it created

The following is treated in a similar manner to ref.

<..latex ltbibl..>+
 \NewConfigure{cite}[4]{\c:def\a:cite{#1}\c:def\b:cite{#2}%
    \d:def\cIteLink{#3}\ifx \cIteLink\empty
       \let\cIteLink=\:gobbleII\fi \c:def\EndcIteLink{#4}}
 \Configure{cite}{}{}{}{}
 -_-_-

<..latex ltbibl..>+
 \:CheckOption{bibtex2} \if:Option
    \expandafter\def\csname bibliography2\endcsname{\csname
          a:bibliography2\endcsname
       \Link{YX\b:blabel}{}\csname b:bibliography2\endcsname
       \EndLink \csname c:bibliography2\endcsname}%
    \let\bibitem:ii\@bibitem
    \def\@bibitem#1{\bibitem:ii{#1}\def\b:blabel{#1}}
    \let\lbibitem:ii=\@lbibitem
    \def\@lbibitem[#1]#2{\lbibitem:ii[#1]{#2}\def\b:blabel{#2}}
    \let\bibliography:ii=\bibliography
    \def\bibliography#1{%
       \let\bibliography=\bibliography:ii
       {\bibliography{#1}}
       \bgroup
          \ConfigureEnv{thebibliography}{}{}{}{}
          \ConfigureList{thebibliography}
             {\let\en:bib=\empty}
             {\en:bib}
             {\en:bib
              \def\en:bib{\csname b:bibitem2\endcsname\EndHPage{}}%
              \HPage{}\csname a:bibitem2\endcsname
             }
             {\csname c:bibitem2\endcsname}
          \def\section##1##2{}
          \Configure{bibanchor}{YX}
          \@fileswfalse
          \@input@{\jobname j.bbl}%
       \egroup
    }
    \NewConfigure{bibliography2}{3}
    \NewConfigure{bibitem2}{3}
    <.bib2 warning.>
    <.create aux j.>
 \fi
 -_-_-

The ‘\bibliography{#1}’ may have \newcommand instructions. Hnce, to avoid complaints about redefined commands, we put ‘\bibliography{#1}’ within a group.

<..create aux j..>
 \bgroup
   \catcode‘\/=0
   \catcode‘\\=12
   /gdef/bib:style{\bibstyle}
   /catcode‘/\=0
   /catcode‘//=12
 \egroup
 -_-_-

<..create aux j..>+
 \bgroup
   \catcode‘\&=12
   \gdef\get:aux{%
     \immediate\read15 to \line
     \ifeof15 \else
        \expandafter\scan:aux\line @@@@@@@@@&&&&
        \expandafter\get:aux
     \fi
   }
   \gdef\put:aux#1&&&&{%
      \immediate\write15{\ifx \first\bib:style
         \expandafter\ifx \csname a:bibliographystyle2\endcsname\empty
              \line \else
              \bib:style{\csname a:bibliographystyle2\endcsname}\fi
        \else  \line\fi}}
 \egroup
 \def\scan:aux#1#2#3#4#5#6#7#8#9{\def\first{#1#2#3#4#5#6#7#8#9}\put:aux}
 \NewConfigure{bibliographystyle2}{1}
 \Configure{bibliographystyle2}{}
 -_-_-

<..create aux j..>+
 \def\j:aux{%
   \bgroup
     \immediate\openin15=\jobname .aux
     \ifeof15 \else
       \no:catcodes{0}{255}{12}%
       \no:catcodes{65}{90}{11}%
       \no:catcodes{97}{122}{11}%
       \catcode‘\^^M=5
       \immediate\openout15=\jobname j.aux
       \get:aux
       \immediate\write15{}
       \immediate\closeout15
       \immediate\closein15
     \fi
   \egroup
 }
 \append:def\@enddocumenthook{%
   \let\:dofilelist=\@dofilelist
   \def\@dofilelist{%
      \let\@dofilelist=\:dofilelist
      \j:aux \@dofilelist}}
 -_-_-

<..bib2 warning..>
 \:CheckOption{bibtex2} \if:Option
    \Log:Note{Option ‘bibtex2’ requires
       compilation of ‘\jobname j.aux’ with bibtex.}
    \immediate\write-1{ Employ \string\Configure{bibliographystyle2}{...}
      to change the bibliography style.}
 \else
    \Log:Note{for 2 levels bibtex bibliography,
         use the command line option ‘bibtex2’}
 \fi
 -_-_-

<..listing of bib..>
 \ifx \o:@lbibitem:\:UnDef \let\o:@lbibitem:=\@lbibitem\fi
 \def\@lbibitem[#1]#2{{\:SUBOff\:SUPOff\edef\:tempb{{#2}}%
    \pend:def\:tempb{\o:@lbibitem:[#1]}%
    \global\let\:temp=\:tempb}%
    \setb:anc{#2}\:temp\bib:anc \let\AnchorLabel=\sv:anc\ignorespaces}
 -_-_-

<..listing of bib..>+
 \ifx \o:@bibitem:\:UnDef \let\o:@bibitem:=\@bibitem \fi
 \def\@bibitem#1{{\:SUBOff\:SUPOff\edef\:temp{\noexpand\o:@bibitem:{#1}}%
    \global\let\:temp=\:temp}\:temp}
 \pend:defI\@bibitem{\setb:anc{##1}}
 \append:defI\@bibitem{\bib:anc
    \let\AnchorLabel=\sv:anc \ignorespaces}
 -_-_-

<..book / report / article..>+
 \ifx \@openbib@code\:UnDef \else
  \pend:def\@openbib@code{\labelsep=\z@}
 \fi
 -_-_-

Old versions of latex don’t have ‘\@openbib@code’ (article 1995/06/26 v1.3g).

<..listing of bib..>+
 \def\setb:anc#1{\let\sv:anc=\AnchorLabel
    \def\bib:anc{\def\bib:anc{#1}\ifx \bib:anc\empty \else
       \a:bibitem{}{\a:bibanchor#1}\b:bibitem\fi \gdef\bib:anc{}}%
    \def\AnchorLabel{\bib:anc}<.config write bibcite.>}
 \NewConfigure{bibitem}{2}
 \NewConfigure{bibanchor}{1}
 \Configure{bibanchor}{X}
 -_-_-

The option /bib puts the (normally long) keys in a separate lines.

<..config write bibcite..>
 \let\cite:item=\item
 \def\item##1\if@filesw##2\fi{\let\item\cite:item
    \item##1\if@filesw {\a:bibcite ##2}\fi}
 -_-_-

<..listing of bib..>+
 \NewConfigure{bibcite}[1]{\concat:config\a:bibcite{#1}}
 \let\a:bibcite\relax
 -_-_-