Re: Re: jurabib/bibtex
Peter Flynn <[email protected]>
| Newsgroups | gmane.comp.tex.bibtex.jurabib.user |
|---|---|
| Organization | Silmaril Consultants |
| Message-ID | <[email protected]> |
jdbillett wrote:
> Dear Peter,
>
> Excellent! I'm grateful (being a simple historian, and not yet a
> TeXpert). Just one query: will this work for a page range that's not
> really a range? For example, a very long article spread out over
> several issues of a journal, all of whose pages must be given in the
> first citation. I frequently cite one that has:
>
> 14--36, 143--70, 264--89
The macro as given simply tests for the presence of a hyphen, so
anything that does not contain a hyphen is assumed to be a single
page. This would fail, for example, if the pages were numbered in
chapter-sequence format like A-25. In your example, it would work,
and output pp.14--36, 143--70, 264--89, which is probably right.
> Forgive my TeX illiteracy: would your macro simply test for the first
> range? If so, what about the possible scenario of citing several
> single pages (e.g. diagrams in article)? For example, suppose I
> wanted "pp. 3, 17, 28".
It's relatively simple to add further tests:
\documentclass{article}
\usepackage{ifthen}
\def\testhyphen#1-#2\sentinel#3{\ifthenelse
{\equal{#1}{#3}}{\testcomma#1,x\sentinel{#1}}{pp.\thinspace#3}}
\def\testcomma#1,#2\sentinel#3{\ifthenelse
{\equal{#1}{#3}}{p.\thinspace#3}{pp.\thinspace#3}}
\newcommand{\p}[1]{\testhyphen#1-x\sentinel{#1}}
\begin{document}
This is simple: \p{1224}
This is a range: \p{12--24}
This is comma-separated: \p{12, 24}
\end{document}
> I'm all ears, because this would be a great simplification.
Glad it's useful. It should be possible to make something the same for
other single vs. multiple decisions. Better still to do away with the
\p altogether, if the application uses a macro for a whole citation,
with a separate argument for "page[s]", by embedding these macros in
the overall macro, eg an extended \cite with optional argument before
for page[s] only, and other commentary in an optional argument after:
\cite[22-45]{foo}[comments]
It's not something I'd considered because I use XML for authoring, and
convert to LaTeX via XSLT for typesetting, so I can use the programming
features of XSLT to test for all these things up-front and adjust the
LaTeX output accordingly. One interesting test would be to check that
the page[-range] given fits within the page count or page range given
for the whole work in the \bibentry, so that citing p.345 of a book that
has only 220 pages would cause a warning message :-)
///Peter
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/jurabib/
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/