Bibtex strikes terror into my heart.
July 3, 2011 4:10 PM   Subscribe

I'm trying to figure out if using bibtex is right for me, been burned once before -- social sciences with complicated citation formatting plans ahead. Help getting started?

I'm a phd candidate in political science. I've been writing my dissertation in Word, I've come to realize that I have enough math-ey stuff in a couple of chapters that I'd benefit from switching to LaTeX.

A couple years ago, I tried to write in LaTeX and had some struggles that generated a previous askme. I think I've solved them here by using Latexian... except, I'm a little skeptical about bibtex. Last time I tried to use it, I couldn't get it to work right, and I ended up with in-text citations that couldn't process all the fields in the bibtex file right, led to lots of glitches.

I'm trying to figure out if it'll be worthwhile using bibtex for the dissertation (as opposed to just typing citations, refs lists, etc. in by hand). Here's what I want to be able to do:

- automatically generate reference lists for individual chapters (limited to those sources cited in that chapter) as well as for the dissertation as a whole.

- use some standard author-date in-text citation format, with the option to add page numbers to individual citations, i.e., sometimes have (Smith 2008) and sometimes have (Smith 2008, pg. 295).

- Ideally, there would be a way to sometimes tell it to put "Blah blah blah (Smith 2008)" and sometimes understand that I want to say "Smith (2008) said blah blah blah." But I realize this may be a pipe dream.

- generate versions of individual chapters (or, if needed, the whole thing) in different citation styles for different audiences (i.e., get a chapter to come out in bluebook format for law journals), ideally just by switching some global variable, or, at least, by making some relatively minimal changes. (In my dreams, it would be smart enough, when switching from an in-text citation style to a footnote citation style, to automatically move in-text citations to footnotes and merge the numbering with ordinary footnotes, but this may be even more unrealistic than the previous.)

Can bibtex do (some of?) these things for me? If so, where does a newbie start to figure out how to make it do it? Documentation-wise, I have the Not So Short Introduction to LaTeX, but nothing else.

thanks!
posted by paultopia to Computers & Internet (11 answers total) 8 users marked this as a favorite
 
Yes yes it can totally do most or all of these things! Those are not pipe dreams.

There is an extension called natbib that you have to apply (simply \usepackage{natbib} at the start of the document to implement it). On that page you can see all of the various citation styles it supports.

The way I would structure this is to have seperate .tex files for each chapter and a top-level .tex file that includes each chapter file and also a global bibliography. This is how I did my master's thesis. Like this:
\begin{document}
\input{chap1.tex}
\input{chap2.tex}
...
\bibliographystyle{chicago}
\bibliography{mybibtexfile}
\end{document}

To generate chapter-specific bibliographies, just comment out all but one chapter and re-run latex, though there may be other ways to do this. Alternatively make several different top-level files, each of which generates a different combination of chapters and bibliographies. Referencing style is controlled by bibliographystyle and can be tweaked in many ways. Just google these LaTeX commands and you will find lots of documentation.
posted by PercussivePaul at 4:29 PM on July 3, 2011 [1 favorite]


The chapterbib package will also give you chapter-by-chapter bibliographies. This stack overflow thread gives a template for a multi-chapter thesis using chapterbib. It's a little fiddly — it involves keeping each chapter in a separate .tex file, and running bibtex separately on each chapter — but it looks like it will do what you want.

Also, yes, as PercussivePaul says, you want natbib. It provides different commands that will produce e.g. "Smith (2008)", "(Smith 2008)" and "Smith 2008," as well as lots of other presumably helpful commands that I never actually use. :)
posted by nebulawindphone at 4:39 PM on July 3, 2011


automatically generate reference lists for individual chapters (limited to those sources cited in that chapter) as well as for the dissertation as a whole

Not to be That Guy, but the only good reason to do this is because your university requires you to. And unless they require it, they probably forbid it.

use some standard author-date in-text citation format, with the option to add page numbers to individual citations, i.e., sometimes have (Smith 2008) and sometimes have (Smith 2008, pg. 295).

I do political science and write in LaTeX unless I'm with unTeXy coauthors. Far and away, your life in political science will be easiest if you just do your actual citations manually and follow it up with a \nocite{}. Like this -- "Smith (2005) \nocite{smith2005} says that..."

The reason is that many journals want (final) submissions as Word documents. They don't generally care through the editorial process, where pdfs from LaTeX are great, but by the time you get your article accepted most journals will want you to send them a Word file for final editing and production. This isn't a big deal -- latex2rtf is good enough, and it's already been accepted so it doesn't matter that this version will look like poop.

But latex2rtf, unless they've upgraded it substantially lately, tends to barf on complicated citations. I find it easier to just work with a bunch of \nocite{} commands, which work fine, instead of \cite{} and \citeasnoun{} and \citeyear{} and so on, which work sometimes.
posted by ROU_Xenophobe at 5:18 PM on July 3, 2011


Response by poster: Rou -- the main reason for individual chapter bibs is to make it easier (I imagine) to break out individual chapters for service (with mods), e.g. as job market papers. Which, incidentally, is also the reason for wanting flexible citation styles (I'm going on the market in political science and law, which have different citation formatting norms).

Which, come to think of it, also means I meant to add "not choking on citations to original legal sources, like cases and codes" to my list of desiderata.
posted by paultopia at 5:38 PM on July 3, 2011


ROU, that is a good point. I have yet to find a good workflow for LaTeX authoring (my preference) and the dreaded final .doc proof. The nocite tip is good advice. Thanks.
posted by PercussivePaul at 5:41 PM on July 3, 2011


Response by poster: One more stupid question... I downloaded the basictex distribution for osx (because 1.6 gigs? Really?), but it doesn't seem to have extensions like natbib (or, for that matter, a couple others like the one for double-spacing)... How do I get those?
posted by paultopia at 6:17 PM on July 3, 2011


Don't use \input, use the Subfiles package. You'll need to do a tiny bit of workaround to make sure each chapter gets a bibliography when compiled separately, but not multiple bibliographies when compiled together, see the bottom of this page. Once you've got it set up it's so much nicer, though. No need to comment and uncomment.

To get more packages, use tlmgr, the TeX Live Manager. It should be fairly straightforward (there might also be a setting to auto-download packages if it comes across one you don't have).
posted by anaelith at 7:24 PM on July 3, 2011


If you are on a Mac, I strongly recommend using BibDesk which is a front end for bibtex. It also can organize and manage the pdfs you're citing.
posted by tractorfeed at 7:37 AM on July 4, 2011


Also, use TeXShop and the MacTeX distribution. (in addition to BibDesk).

If you google around, there's quite a lot of information available about using natbib to do quite complicated citation stuff. There are commands that will give you both (smith, 2008) and smith (2008).

And (smith, 2008, p. 21) you get by \cite[p. 21]{citekey}
posted by leahwrenn at 10:32 AM on July 4, 2011


I use JabRef which is a GUI for bibtex reference files. It's really to use with LyX, which is how I write all my professional papers.
posted by achmorrison at 7:17 PM on July 5, 2011


One more stupid question... I downloaded the basictex distribution for osx (because 1.6 gigs? Really?), but it doesn't seem to have extensions like natbib (or, for that matter, a couple others like the one for double-spacing)... How do I get those?

Try this: in the terminal, type sudo tlmgr install natbib, hit Enter, and type in your password when prompted. The natbib package and any other packages it depends on should be installed automatically. (Here's the documentation for tlmgr. It's way useful.*)

I'm not a Mac user, and I started with a full texlive distribution rather than basictex, so I can't guarantee from personal experience that the above will work. But it should work, unless there's something deeply weird about the Mac version or about basictex that I'm not aware of.

*Another useful command is tlmgr search, which will find you all the packages whose descriptions have a certain string. So if in the future you want, I dunno, somethng for multicolumn layout, tlmgr search columns will show you what the options are. There's no need to put sudo before it — you only need sudo if you're actually installing, updating or uninstalling something.
posted by nebulawindphone at 7:21 AM on July 8, 2011


« Older Quick look at an old .pst file?   |   Japanese studio photograhy in LA? Newer »
This thread is closed to new comments.