GeneralLaTeX for Encyclopedia Entries?

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
choward
Posts: 6
Joined: Sat Sep 05, 2009 10:18 pm

LaTeX for Encyclopedia Entries?

Post by choward »

Hi. I'm compiling materials for a small, subject-specific encyclopedia/dictionary. I have about a month's worth of experience with LaTeX + BibTeX under Linux (with Texmaker,) and I was wondering if I could do the encyclopedia with LaTeX somehow. These are the two things I am wondering about right now, which are related:

1. What would be the most sensible way to separate the entries? Each encyclopedia entry is not really a separate chapter, nor a section of a chapter, and obviously each entry doesn't need its own separate page.

2. In view of whatever the answer to (1) is, what tags should I use so that reference information from the citations appears at the end of each entry, instead of in one bibliography at one place in the document?

Remember, be nice to the n00b. :geek:

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
nlct
Posts: 276
Joined: Thu Nov 06, 2008 11:15 am

LaTeX for Encyclopedia Entries?

Post by nlct »

choward wrote: 1. What would be the most sensible way to separate the entries? Each encyclopedia entry is not really a separate chapter, nor a section of a chapter, and obviously each entry doesn't need its own separate page.
You could use unnumbered sections with a running title. The counter secnumdepth can be changed to suppress the numbering. I don't know if there's a package or class that allows you to easily change the format of sections. I usually redefine \section, but this involves using the internal command \@startsection, so the code should either be put in a class or style file or it needs to be enclosed by \makeatletter ... \makeatother.
choward wrote: 2. In view of whatever the answer to (1) is, what tags should I use so that reference information from the citations appears at the end of each entry, instead of in one bibliography at one place in the document?
You could use bibunits. If you make each entry a section, this makes it easier.

Example (say, test.tex):

Code: Select all

\documentclass{book}

% Put the bibliography in a subsection
\usepackage[subsectionbib]{bibunits}

\makeatletter % about to use an internal command

% Redefine section to have a running title
\renewcommand{\section}{%
  \@startsection
  {section}%
  {1}%
  {0em}%
  {\baselineskip}%
  {-\fontdimen2\font
    plus -\fontdimen3\font
    minus -\fontdimen4\font}%
  {\normalfont\large\bfseries}% change as required
}

% \subsection may need redefining so that it's less
% prominant than the section title
\renewcommand{\subsection}{%
  \@startsection
  {subsection}%
  {2}%
  {0em}%
  {-3.25ex plus 1ex minus -0.2ex}%
  {1.5ex plus 0.2ex}%
  {\normalfont\scshape}% change as required
}

\makeatother % finished using internal commands

% don't number anything less than a part:
\setcounter{secnumdepth}{-1}

\begin{document}
\bibliographyunit[\section]

\defaultbibliography{test} % name of .bib file
\defaultbibliographystyle{plain} % bib style

\chapter{A}

\section{Aardvark}
Nocturnal mammal native to Africa~\cite{aardvark}.

\putbib

\section{Antelope}
Deer-like animal~\cite{antelope}.

\putbib
\end{document}
and bibliography data (say, test.bib):

Code: Select all

@book{aardvark,
  title     = "Caring for Aardvarks",
  author    = "A.N. Other",
  publisher = "Aarvark Press",
  year      = 2009
}

@book{antelope,
  title     = "Caring for Antelopes",
  author    = "A.N. Other",
  publisher = "Antelope Press",
  year      = 2009
}
This creates a separate aux file for each bibunit (bu1.aux, bu2.aux, etc) so you'll need to run bibtex on each of them:

Code: Select all

pdflatex test
bibtex bu1
bibtex bu2
pdflatex test
pdflatex test
Hope this helps.

Regards
Nicola Talbot
choward
Posts: 6
Joined: Sat Sep 05, 2009 10:18 pm

Re: LaTeX for Encyclopedia Entries?

Post by choward »

Thank you for your help. This seems to be working wonderfully so far.
Post Reply