Changes

Jump to navigation Jump to search
3,366 bytes added ,  14:55, 25 April 2007
active hyperlinks section
author=\UCauthor]
</texcode>
 
== Active URLs ==
 
If you want active (clickable) URLs in the references, you need to do a few steps. [Thanks to Tobias Burnus for the working minimal example, which I've modified only slightly.]
 
* Use a patched <code>t-bib.tex</code> (until the next ConTeXt release sometime in May 2007 that will contain the patch).
 
* Use the <code>url</code> field in the <code>bibtex</code> entries.
 
* Setup a publication layout (for those types of <code>bibtex</code> entries) that knows how to include a URL.
 
The minimal example is in [[Image:Biburls.zip]], which includes the patched <code>t-bib.tex</code>. But here are the details of steps 2 and 3. A <code>bibtex</code> <code>book</code> entry using the <code>url</code> field looks like:
 
<texcode>
@Book{HPL2000,
editor = {John D. Barnsford and Ann L. Brown and Rodney R. Cocking},
title = {{How people learn: Brain, mind, experience, and school}},
publisher = {National Academy Press},
year = 2000,
address = {Washington, DC},
edition = {expanded},
url = {http://www.nap.edu/}
}
</texcode>
 
The modified <code>\setuppublicationlayout</code>, which goes into an environment file or in the preamble of the <code>.tex</code> file, includes lines to use the <code>url</code> field. Since I use the <code>num</code> style for the publication list, with <code>\setuppublications[alternative=num]</code>, I take the <code>book</code> layout from the <code>bibl-num.tex</code> source file and modify it by adding two lines:
 
<texcode>
\unprotect
% copied from bibl-num.tex and added
% \inserturl and \insertdoi
\setuppublicationlayout[book]{%
\insertauthors{}{\unskip. }{\inserteditors{}{\unskip, editor%
\ifnum\getvalue{editor@num}> 1 s\fi.%
\ \global\editedbooktrue
}{\insertthekey{}{\unskip. }{}}}%
\inserttitle
{\bgroup\it }%
{\/\egroup
\ifeditedbook.%
\global\editedbookfalse
\insertvolume
{ Number~}%
{\insertseries
{ in~\bgroup}%
{\egroup. }%
{\insertcrossref{ in~}{}{. }}}%
{\insertseries{ }{.}{} }%
\else
\insertcrossref
{\insertchap{, }{}{}%
\insertpages{, pages }{. }{. }%
\insertvolume{Volume~}{ of~}{}%
}%
{}%
{\insertvolume
{, volume~}%
{\insertseries
{ of~\bgroup\it}%
{\egroup}
{}}
{}%
\insertchap{, }{}{}%
\insertpages{, pages }{.}{.}%
}%
\fi}%
{}%
\insertpublisher
{ }%
{\insertedition{, }{ edition}{}%
\insertpubyear{, }{.}{.}}%
{\insertedition{, }{ edition}{}%
\insertpubyear{, }{.}{.}}%
\insertpages{ }{p.}{}%
\insertdoi{ }{.}{}%added
\insertbiburl{ }{.}{}%added
\insertnote{ }{.}{}%
}
\protect
</texcode>
 
When running 'texexec', check the terminal output (or logfile) to ensure that texexec finds the modified t-bib.tex (which I have been keeping in the current directory) rather than the system-supplied t-bib.tex. Once the patched t-bib.tex becomes the official release (Taco says sometime in May 2007), that step won't be necessary.
== Other tips ==
127

edits

Navigation menu