[OS X TeX] Texshop & chapterbib

Claus Gerhardt gerhardt at math.uni-heidelberg.de
Mon Jun 6 21:31:15 CEST 2005

 From chapterbib.sty


%====================== BEGIN INSTRUCTIONS ===========================

chapterbib.sty   Version 1.11 (29-FEB-2004) DA (allow \nocite check)
~~~~~~~~~~~~~~           1.10 (23-JUN-2003) DA (\bibsection  
                           1.9  (19-SEP-2001) DA (sectionbib change;  
                           1.8  (29-APR-1999) DA (gather, duplicate,  
                           1.7  (21-JUL-1997) DA (sectionbib, \nocite)
                           1.6  (08-FEB-1997) Donald Arseneau (more  
                           1.5  (09-OCT-1995) Donald Arseneau (rootbib)
                           1.4  (11-MAR-1995) Donald Arseneau  
                           1.3  (04-JUL-1994) Donald Arseneau (2e,  
                           1.2  (21-MAY-1993) Donald Arseneau (bug fix)
                           1.1  (24-MAR-1993) Donald Arseneau
                           1.0  (23-NOV-1988) Niel Kempson

Allow multiple bibliographies in a LaTeX document, including items
\cite'd in more than one bibliography.  Despite the name "chapterbib",
chapter.  The main point is to allow you to use BibTeX: Each included
file should have its own \bibliographystyle and \bibliography commands,
and you should run BibTeX on each included file separately rather than
on the root file.

There are also the commands \begin{cbunit}, \end{cbunit}, and \cbinput
to allow multiple bibliographies without using \include (see item 4).
There are two added hooks, \citeform and \citepunct, to customise the
formatting of each entry in a citation list.

Usage, Restrictions, and Options

1. Normal use: Put \bibliographystyle and \bibliography commands in
     each \include'd file. Run LaTeX; run BibTeX on each included file;
     run LaTeX; run LaTeX.

2. If you get errors like "! LaTeX Error: Command \xxx already defined."
     then bibtex is foolishly putting "\newcommand" in each bbl  
file.  The
     fix is to put the \bibliography command in braces: {\bibliography 

3. The \bibliography and \bibliographystyle commands are not normally  
     in the root file, only in files that have been \include'd. To  
have a
     whole-document bibliography, see items 7-10, depending on which  
style of
     whole-document bib.

4. If you can't use \include because a new section must start below the
     preceding bibliography on the same page [odd format!], then you can
     use \begin{cbunit}...\end{cbunit} or \cbinput, with a  
     environment in each unit or input file.  To use BibTeX: input  
     files using \cbinput; at first use the package or global option  
     run LaTeX on the document, then BibTeX on each file that was  
     finally, remove the [draft] option and run LaTeX again (maybe  
twice to
     get page references right).  The [draft] option only affects the  
     of \cbinput, not \include or \begin{cbunit}.
         With old LaTeX, do the preliminary run using \include  
commands, and
     change these to \cbinput for the final run(s).

5. Your preferred citation style (xxx.sty) may not work with  
chapterbib at
     first, but it is easy to make it compatible:  In `xxx.sty'  
change every
     "@\@citeb" to "@\@citeb\@extra at b@citeb", and insert the line
         \@ifundefined{@extra at b@citeb}{\def\@extra at b@citeb{}}{}
     somewhere (but not as a comment or as part of another definition!).
     If the package also redefines \bibcite then you should change that
     definition, replacing "@#1" with "@#1\@extra at binfo", and insert
         \gdef\@extra at binfo{}
     somewhere in the file.
     Some citation packages deviate quite far from LaTeX's own method of
     organizing cite tags using "b@\@citeb".  The instructions above  
     such extensions as "Y@\@citeb", but not more radical differences.
     In such cases, try contacting the author of the citation package.
     If a citation style does not define "\nocite", then that command
     would not be converted when you make the patches to "@\@citeb".
     Chapterbib will try to detect the hook in "\nocite", but if this  
     you may need to redefine "\nocite" (with any "@\@citeb" changed to
     "@\@citeb\@extra at b@citeb") in that sty file.

6. The report and book document classes usually treat the  
bibliography as
     an unnumbered chapter (\chapter*), which is not so good for  
     IN a chapter.  You can specify
     to convert your bibliographies from \chapter* to \section*, with an
     entry in the table of contents and the page-header.  A  
bibliography in
     the root file remains as a \chapter*.  The [sectionbib] option  
     the existing thebibliography environment (or the \bibsection  
command, if
     present already), so the other formatting in the  bibliography  
     remain unchanged.  On the other hand, if you already have a non- 
     bibliography defined, or if you want them numbered, it may be  
easier to
     redefine \thebibliography directly, without any trickery.
         Alternatively, you can use the \sectionbib command directly  
in the
     document preamble.  It takes two parameters: the sectioning  
command, and
     the name of the sectioning level.  For instance, the  
[sectionbib] option
     does \sectionbib{\section*}{section}. Again, for the most  
control, it is
     better to redefine \thebibliography entirely.

7. If you want a completely unrelated bibliography in the root file,  
     for a general reading list, you can provide your own  
bibliography there
     using the thebibliography environment.  I don't suppose this  
will appeal
     to BibTeX users!

8. To have a cohesive bibliography for the whole document, plus  
     bibs in the chapters, put \bibliography commands in the included  
     plus in the root file; use \usepackage[rootbib]{chapterbib}; run  
     run BibTeX on the root file; change to \usepackage{chapterbib}; run
     LaTeX; run BibTeX on each included file; run LaTeX; run LaTeX.
     This produces an independent `overall' bibliography which only  
     sense for various `named' bibliography styles; a style with  
     will give unrelated numbers in each bibliography.
         Actually, you probably don't *need* to ever run with [rootbib]
     because, although bibTeX should complain about multiple \bibdata
     commands, it should produce all the right bbl files -- but the root
     \bibliographystyle must come first in the document.

9. To have a bibliography-by-chapter at the end instead of separate bibs
     in the chapters, use \usepackage[gather]{chapterbib}, put  
     commands in each file, and at the end of the main file. Run  
LaTeX as
     in item 1. You can control the titling of the final bibliography by
     defining \StartFinalBibs.  The default definition is (like)

         \renewcommand{\bibname}{Bibliography for Chapter \thechapter}}

     normally, but when using the [sectionbib] option it becomes

         \renewcommand{\bibname}{Chapter \thechapter}}

     You should really provide your own definition.  If you are using  
     article document class and \section, then you MUST do so.

     If your document class has neither section nor chapter, then you  
     define \StartFinalBibs (of course) and also indicate the  
     if the main sectioning command is \motif, for example.

10. To have bibliographies in each chapter PLUS a bibliography-by- 
chapter at
     the end, follow item 9, but declare \usepackage[duplicate] 
     (or \usepackage[duplicate,sectionbib]{chapterbib}).

11. If you use Babel, load chapterbib before babel.

\citeform and \citepunct:
Normally, the citations are formatted as given, but you can define  
(with one parameter) to reformat every citation.  Some possibilities:
   \renewcommand\citeform[1]{\romannumeral 0#1}% roman numerals:  [iv,x]
   \renewcommand\citeform[1]{(#1)}             % parentheses:  [(3), 
   \renewcommand\citeform[1]{\thechapter.#1}   % number by chapter:   
If you change \citeform, you should define \@biblabel to match.
\citepunct gives the punctuation (comma-penalty-space) between items.

%====================== END INSTRUCTIONS =====================

On Jun 6, 2005, at 15:02, Ingo Reich wrote:

> Hi,
> I work on a larger project with several files included in a root  
> file, each of which starts with the line "%!TEX root = ../root.tex"  
> so that only the root file gets latexed. To put a short  
> bibliography at the end of each included file, I furthermore make  
> use of chapterbib.sty. Now my problem: To build the bibliography at  
> the end of an included file, I need to bibtex the aux-file of the  
> included file, but running bibtex on this file results in bibtexing  
> the aux-file of the root-file. So it's a kind of  paradoxical  
> situation: as for latex, I want texshop to go to the root file; as  
> for bibtex, I don't want it to. Is there some elegant workaround  
> (maybe via an applescript and/or a %!TEX-insensitive bibtex command)?
> Thanks, Ingo
> BTW: real scrolling doesn't seem to work anymore with texshop 2.03.  
> Is this due to Tiger?
> --------------------- Info ---------------------
> Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
>            & FAQ: http://latex.yauh.de/faq/
> TeX FAQ: http://www.tex.ac.uk/faq
> List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>

--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>

More information about the macostex-archives mailing list