summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/chemcono/chemcono.sty
blob: 7586a428f3adfac955f8cca2d69139306a4f3556 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
 %% chemcono.sty
   %% Copyright 1996,1999 Stefan Schulz

   % This program can redistributed and/or modified under the terms
   % of the LaTeX Project Public License Distributed from CTAN
   % archives in directory macros/latex/base/lppl.txt; either
   % version 1 of the License, or any later version.
%%%
%%% Acknowledgement: Definitions extracted from latex.ltx and article.cls
%%% ====================================================================
%%%  @LaTeX-style-file{
%%%     author          = "Stefan Schulz",
%%%     version         = "1.3",
%%%     date            = "9 SEP 1999",
%%%     filename        = "chemcono.sty",
%%%     address         = "Institut fuer Organische Chemie, Technische Universitaet
%%%                        Braunschweig, Hagenring 30, D-38106
%%%                        Hamburg, Germany"
%%%     email           = "stefan.schulz@tu-bs.de
%%%     codetable       = "ISO/ASCII",
%%%     keywords        = "chemical compound numbering",
%%%     supported       = "maybe",
%%%     abstract        = "LaTeX style file for using compound numbers
%%%            in chemistry documents. It works like
%%%            \cite and the \thebibliography, using \fcite
%%%            and \theffbibliography instead. It allows compound
%%%            names in documents to be numbered and does not
%%%            affect the normal citation routines.
%%%            Very helpful for writing chemistry papers.
%%%                        This style does:
%%%                        - Compound-numbering. Any compound gets a number
%%%                          using \fcite, bold face as default. This number
%%%              is printed every time you type \fcite.
%%%                        - The compounds are numbered according to the
%%%              entries in the \theffbibliography.
%%%                        - The \ffbibliography generates an chapter with
%%%                          the heading 'Compound numbers'.
%%%                        See comments and examples below.",
%%%  }
%%% ====================================================================
%
% HISTORY:
%
% Writing chemistry papers, very often a consecutive numbering for compounds
% according to their appearance in the text is required. First, I have no
% knowledge of any basic Tex. I extracted the definitions for \cite and
% \thebibliography from latex.ltx and article.cls and replaced every
% occurrence of the string cit by ffcit
% and bib by ffbib. In addition, I also performed some small formatting
% changes. Thus, this package  worked nicely
% in a document with 300 compound numbers and 700 citations in latex209 and latex2e.
%
% Version 1.0
% Latex209.
%
% Version 1.1
% Same thing for Latex2e.
%
% Version 1.2
% Now works with Latex2e of 1996/06/01
%
% Version 1.3
% Added option [tight]. Saves space in the compound number list. Default is [normal].
%
% USAGE:
% Load package chemcono. For every compound, use \fcite like \cite for citations.
% After a \clearpage at the end of your document use theffbibliography like
% the normal thebibliography, with \ffbibitem instead of \bibitem:
%     \begin{theffbibliography}{99}
%     \ffbibitem{f1} danaidone
%     \ffbibitem{f2} thio ether
%     \end{theffbibliography}
% After compilation and printout, discard the last page.
% If you want other formatting than bold face numbers, use
% \renewcommand{\fcite}[1]{\underline{\ffcite{#1}}}
% which gives in this case  an underlined number.
% Look at example.tex.
% The formatting of the ffbibliography can be made tight to save space by the option [tight].
%
% I have added the file drftcono.sty, which bases on the drftcite.sty file from D. Arseneau.
% When using drftcono.sty, you get the tags of the compound numbers instead the real numbers in the text.
% In the compound number section, small superscripts show which label has been used first, second,
% and so on. You have to load drftcono.sty after chemcono.sty. For the final version, just comment
% out drftcono.sty as in example.tex.
% I also added a file showkeysff.sty, which shows labels in the margin as in showkeys, but the \fcite tags
% are also added. I was not able to include counting of occurrence present in drftcono
% in the showkeysff package, which would be highly desirable.
%
%
% COMPLICATIONS:
% You must not use identical labels for \fcite and \cite. Otherwise Latex gets
% confused. As a hint, I identify every compound label by a preceding f as in
% \fcite{f1}, and every citation label with a c, like \cite{c1}.
%
% FUTURE:
% I would like to have the option for removing the printout of
% theffbibliography. Than one would not need to discard the last page.
% Because I have no knowledge of any programming, I do not know how to do
% this. I also do not know whether the  goal of this style could be achieved
% much more easily. Any hints are welcome.
% Inclusion of order of occurrence counting in showkeysff.
%%
%%%
%%%
%%%
\NeedsTeXFormat{LaTeX2e}[1995/06/01]
 \ProvidesPackage{chemcono}
        [1999/09/10 1.3 (SS)]
\DeclareOption{normal}{\let\@openffbib@code\@empty}
\DeclareOption{tight}{\renewcommand{\@openffbib@code}{%
  \setlength{\parsep}{0pt}%
  \setlength{\itemsep}{0pt}%
  \setlength{\topsep}{0pt}%
}}
\ExecuteOptions{normal}
\ProcessOptions
\message{ffbibliography,}
\def\ffbibitem{\@ifnextchar[\@lffbibitem\@ffbibitem}
\def\@lffbibitem[#1]#2{\item[\@ffbiblabel{#1}\hfill]\if@filesw
      {\let\protect\noexpand
       \immediate
       \write\@auxout{\string\ffbibcite{#2}{#1}}}\fi\ignorespaces}
\def\@ffbibitem#1{\item\if@filesw \immediate\write\@auxout
       {\string\ffbibcite{#1}{\the\value{\@listctr}}}\fi\ignorespaces}
\def\ffbibcite{\@newl@bel b}
\let\ffcitation\@gobble
\DeclareRobustCommand\ffcite{%
  \@ifnextchar [{\@tempswatrue\@ffcitex}{\@tempswafalse\@ffcitex[]}}
\def\@ffcitex[#1]#2{%
  \let\@ffcitea\@empty
  \@ffcite{\@for\@ffciteb:=#2\do
    {\@ffcitea\def\@ffcitea{,\penalty\@m\ }%
     \edef\@ffciteb{\expandafter\@firstofone\@ffciteb}%
     \if@filesw\immediate\write\@auxout{\string\ffcitation{\@ffciteb}}\fi
     \@ifundefined{b@\@ffciteb}{\mbox{\reset@font\bfseries ?}%
       \G@refundefinedtrue
       \@latex@warning
         {ffcitation `\@ffciteb' on page \thepage \space undefined}}%
       {\hbox{\csname b@\@ffciteb\endcsname}}}}{#1}}
\let\ffbibdata=\@gobble
\let\ffbibstyle=\@gobble
\def\ffbibliography#1{%
  \if@filesw
    \immediate\write\@auxout{\string\ffbibdata{#1}}%
  \fi
  \@input@{\jobname.bbl}}
\def\ffbibliographystyle#1{%
  \ifx\@begindocumenthook\@undefined\else
    \expandafter\AtBeginDocument
  \fi
    {\if@filesw
       \immediate\write\@auxout{\string\ffbibstyle{#1}}%
     \fi}}
\def\noffcite#1{\@bsphack
  \@for\@ffciteb:=#1\do{%
    \edef\@ffciteb{\expandafter\@firstofone\@ffciteb}%
    \if@filesw\immediate\write\@auxout{\string\ffcitation{\@ffciteb}}\fi
    \@ifundefined{b@\@ffciteb}{\G@refundefinedtrue
        \@latex@warning{ffcitation `\@ffciteb' undefined}}{}}%
  \@esphack}
\expandafter\let\csname b@*\endcsname\@empty
\def\@ffcite#1#2{{#1\if@tempswa , #2\fi}}
\def\@ffbiblabel#1{\textbf{#1}} %ver„ndert von [#1]

\let\l@table\l@figure
\newdimen\ffbibindent
\setlength\ffbibindent{1.5em}
\newenvironment{theffbibliography}[1]
     {\section*{Compound numbers
        \@mkboth{\MakeUppercase Compound numbers}{\MakeUppercase Compound numbers}}%
      \list{\@ffbiblabel{\@arabic\c@enumiv}}%
           {\settowidth\labelwidth{\@ffbiblabel{#1}}%
            \leftmargin\labelwidth
            \advance\leftmargin\labelsep
            \@openffbib@code
            \usecounter{enumiv}%
            \let\p@enumiv\@empty
            \renewcommand\theenumiv{\@arabic\c@enumiv}}%
      \sloppy\clubpenalty4000\widowpenalty4000%
      \sfcode`\.\@m}
     {\def\@noitemerr
       {\@latex@warning{Empty `theffbibliography' environment}}%
      \endlist}
\newcommand{\fcite}[1]{\textbf{\ffcite{#1}}}