One of Tech’s faculty and a post-doctoral research associate are working on a book for Wiley, and they want to have a list of references after each chapter, rather than one set of references for the entire book. Wiley’s LaTeX guides don’t give particularly good information on how to do this, and I never got a response back from the Wiley documentclass author on how best to handle this. So, in the interests of anyone searching for this in the future, here’s what I came up with.
Procedure:
- Pick the appopriate script for your operating system. There’s one script for Windows users, and another for Unix and OS X users.
- Edit the script to match your main filename (without the .tex extension). In my example, my main file was w-bksamp-minimal.tex, so I used w-bksamp-minimal.
- Rename your chapter content so each filename starts with “chapter-” — if you don’t like that restriction, feel free to edit the script to your liking.
- Make sure you use \include instead of \input to add each chapter to your main .tex file. Using \input will put multiple chapters’ citations into one .aux file, and BibTeX won’t be able to tell which bibliography entries go with each chapter.
- Adjust the latex, dvips, and ps2pdf lines to match your build process. I normally don’t use dvi at all, but I didn’t want to disrupt the Wiley procedures by default.
Windows version (attached as wiley-build-windows.zip)
@echo off rem wiley-build.cmd -- Mike Renfro <renfro@tntech.edu>, 2011/11/06 rem rem Cleaner build procedure for Wiley's wileySix and wileySeven rem document classes that allows for per-chapter bibliographies rem generated with BibTeX. rem Instructions: rem 1. Replace w-bksamp-minimal with the filename of the main .tex file set mainfile=w-bksamp-minimal rem 2. Rename each chapter to start with chapter- (for example: rem chapter-1.tex, chapter-mimo.tex, etc.) rem 3. Make sure to use \include for each chapter in the main .tex file, rem not \input. rem Should be no need to edit anything below this line. latex %mainfile% echo ... for %%c in (chapter-*.tex) do bibtex %%~nc% echo ... latex %mainfile% latex %mainfile% dvips %mainfile%.dvi ps2pdf %mainfile%.ps rem Procedure adapted from rem http://tex.stackexchange.com/questions/17474/multiple-bibliographies
Unix and OS X version (attached as wiley-build-unix-osx.zip)
#!/bin/sh # wiley-build.sh -- Mike Renfro <renfro@tntech.edu>, 2011/11/06 # # Cleaner build procedure for Wiley's wileySix and wileySeven # document classes that allows for per-chapter bibliographies # generated with BibTeX. # Instructions: # 1. Replace w-bksamp-minimal with the filename of the main .tex file mainfile=w-bksamp-minimal # 2. Rename each chapter to start with chapter- (for example: # chapter-1.tex, chapter-mimo.tex, etc.) # 3. Make sure to use \include for each chapter in the main .tex file, # not \input. # Should be no need to edit anything below this line. latex ${mainfile} echo ... for c in chapter-*.tex; do bibtex `basename ${c}` done echo ... latex ${mainfile} latex ${mainfile} dvips ${mainfile}.dvi ps2pdf ${mainfile}.ps # Procedure adapted from # http://tex.stackexchange.com/questions/17474/multiple-bibliographies