my-bib-macros.texi 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. @c -*-texinfo-*-
  2. @c %% my-bib-macros.texi --- Texinfo macros providing a crude
  3. @c %% bibliography and citation capability.
  4. @c % Copyright (C) 2004 Aaron S. Hawley
  5. @c % Author: Aaron S. Hawley <ashawley@gnu.uvm.edu>
  6. @c % Keywords: docs, texinfo, extensions, bib
  7. @c % This file is free software; you can redistribute it and/or modify
  8. @c % it under the terms of the GNU General Public License as published by
  9. @c % the Free Software Foundation; either version 2, or (at your option)
  10. @c % any later version.
  11. @c % This file is distributed in the hope that it will be useful,
  12. @c % but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. @c % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. @c % GNU General Public License for more details.
  15. @c % You should have received a copy of the GNU General Public License
  16. @c % along with GNU Emacs; see the file COPYING. If not, write to
  17. @c % the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  18. @c % Boston, MA 02111-1307, USA.
  19. @c %% Commentary:
  20. @c %%% Introduction
  21. @c %% Creates references to a ``Bibliography'' or ``References''
  22. @c %% section of a Texinfo document, using Texinfo's
  23. @c %% macro system. Although not as terse a way to cite systems as is
  24. @c %% found in document systems like TeX, the format is simpler and
  25. @c %% the rendering is easier for non-academic readers.
  26. @c %
  27. @c %%% Usage
  28. @c %% References to cited works can be put in any section of a document.
  29. @c %% The cited works must be put in either a Texinfo table (for
  30. @c %% instance with ``@table @asis ... @end table'') or within a
  31. @c %% Texinfo list (something like ``@enumerate ... @end enumerate''
  32. @c %% or ``@itemize @bullet ... @end itemize''). They are created
  33. @c %% with the command ``@mybibitem{REF-NAME}''. To cite a reference
  34. @c %% with a @mybibitem use ``@mybibcite{REF-NAME}''.
  35. @c %% The beginning of a document must include (using the @include
  36. @c %% command) the file my-bib-macros.texi, which should be made
  37. @c %% available in the current directory of the parent file. A single
  38. @c %% call should be made to choose to use a list or a table. The
  39. @c %% command to chose is called @mybibuselist{NODE}, where NODE is
  40. @c %% the node containing the location where the references are listed.
  41. @c %
  42. @c %%% Example
  43. @c %% \input texinfo @c -*-texinfo-*-
  44. @c %% @comment %**start of header
  45. @c %% @setfilename my-file-with-bib.info
  46. @c %% @settitle Texinfo with a Bibliography and References
  47. @c %%
  48. @c %% @include my-bib-macros.texi
  49. @c %% @mybibuselist{References}
  50. @c %%
  51. @c %% @comment %**end of header
  52. @c %%
  53. @c %% @node Top
  54. @c %% @top Top
  55. @c %%
  56. @c %% @menu
  57. @c %% * Introduction::
  58. @c %% * @mybibnode{}::
  59. @c %%
  60. @c %% @end menu
  61. @c %%
  62. @c %% @node Introduction
  63. @c %% @chapter Introduction
  64. @c %%
  65. @c %% The ability of a documentation format to make cross references to a
  66. @c %% bibliography, a feature of LaTeX @mybibcite{LaTeX2e}, isn't
  67. @c %% currently supported in Texinfo.
  68. @c %%
  69. @c %% @node @mybibnode{}
  70. @c %% @chapter References
  71. @c %%
  72. @c %% @itemize @asis
  73. @c %%
  74. @c %% @mybibitem{LaTeX2e} Leslie Lamport, LaTeX User's Guide and
  75. @c %% Reference Manual, 2nd edition, Addison-Wesley, Reading,
  76. @c %% Massachusetts, 1994.
  77. @c %%
  78. @c %% @end itemize
  79. @c %%
  80. @c %% @bye
  81. @c %%
  82. @c %% This example produces (in Info):
  83. @c %% 1 Introduction
  84. @c %% **************
  85. @c %%
  86. @c %% The ability of a documentation format to make cross
  87. @c %% references to a bibliography, a feature of LaTeX (See item
  88. @c %% [LaTeX2e] in *Note LaTeX2e: References.), is not currently
  89. @c %% supported in Texinfo.
  90. @c %%
  91. @c %%
  92. @c %% 2 References
  93. @c %% ************
  94. @c %%
  95. @c %% [LaTeX2e] Leslie Lamport, LaTeX User's Guide and Reference
  96. @c %% Manual, 2nd edition, Addison-Wesley, Reading,
  97. @c %% Massachusetts, 1994.
  98. @c %% and (in printed output):
  99. @c %% 1 Introduction
  100. @c %% **************
  101. @c %%
  102. @c %% The ability of a documentation format to make cross
  103. @c %% references to a bibliography, a feature of LaTeX (See item
  104. @c %% [LaTeX2e] in Chapter 2 [References], page 3.), is not
  105. @c %% currently supported in Texinfo.
  106. @c %%
  107. @c %%
  108. @c %% 2 References
  109. @c %% ************
  110. @c %%
  111. @c %% [LaTeX2e] Leslie Lamport, LaTeX User's Guide and Reference
  112. @c %% Manual, 2nd edition, Addison-Wesley, Reading,
  113. @c %% Massachusetts, 1994.
  114. @c %
  115. @c %%% Notes
  116. @c %% The pointers to references will be functional in hypertext
  117. @c %% documentation (info, HTML, XML and others) and properly rendered
  118. @c %% in print documents, because they are implemented with Texinfo's
  119. @c %% cross referencing capabilities (using @anchor and @ref). Failures
  120. @c %% by an author to make proper references with ``my-bib-macros'' in
  121. @c %% their document will give cross referencing errors by Texinfo
  122. @c %% conversion tools.
  123. @c %% Only one ``Reference'' section is allowed per document.
  124. @c %% An improvement of this system would create cross references
  125. @c %% (with @xref) at each cited work to all the originating cross
  126. @c %% refererences.
  127. @c %
  128. @c %% Code:
  129. @c % Configuration Options
  130. @c %% @mybibsetrefnode : Defines the name of the node to contain
  131. @c %% references.
  132. @macro mybibsetrefnode{node}
  133. @set mybibrefnode \node\
  134. @end macro
  135. @c %% @mybibnode{} : Macro to be placed at node containing references
  136. @c %% and calls to @mybibcite{}
  137. @macro mybibnode{}
  138. @value{mybibrefnode}
  139. @end macro
  140. @c %% @mybibusetable : Whether each @mybibitem will be put in a
  141. @c %% table.
  142. @macro mybibusetable{node}
  143. @set mybibtable true
  144. @ifset mybiblist
  145. @clear mybiblist
  146. @end ifset
  147. @mybibsetrefnode{\node\}
  148. @end macro
  149. @c %% @mybibuselist : Whether each @mybibitem will be put in a
  150. @c %% list.
  151. @macro mybibuselist{node}
  152. @set mybiblist true
  153. @ifset mybibtable
  154. @clear mybibtable
  155. @end ifset
  156. @mybibsetrefnode{\node\}
  157. @end macro
  158. @c %% @mybibcite{REF} : Cites the cross reference REF.
  159. @macro mybibcite{ref}
  160. @ifclear mybibrefnode
  161. @mybibmakeref{mybibsetrefnode was not used, \ref\}
  162. @end ifclear
  163. @c %**else if
  164. @ifset mybibrefnode
  165. @mybibmakeref{@mybibnode{}, \ref\}
  166. @end ifset
  167. @end macro
  168. @c @macro mybibmakeref{node, ref}
  169. @c (See item [\ref\] in @ref{\node\, \ref\}.)
  170. @c @end macro
  171. @macro mybibmakeref{node, ref}
  172. [@ref{\node\, \ref\}]
  173. @end macro
  174. @c %% @mybibcite{REF} : Creates a cross referenced citation REF.
  175. @macro mybibitem{ref}
  176. @ifclear mybiblist
  177. @ifclear mybibtable
  178. @set mybiblist true
  179. @end ifclear
  180. @end ifclear
  181. @ifset mybiblist
  182. @item
  183. @anchor{\ref\}[\ref\]
  184. @end ifset
  185. @c %**else if
  186. @ifset mybibtable
  187. @item @anchor{\ref\}[\ref\]
  188. @end ifset
  189. @end macro
  190. @c %% my-bib-macros.texi ends here