![](https://secure.gravatar.com/avatar/af71bd2bc846771942f22a10cb72782a.jpg?s=120&d=mm&r=g)
Hello, I'm planning to write my Master's thesis in history using ConTeXt, and I've done some experimenting on it to see if it's actually suitable for my purposes. Everything seems to be quite simple except for one thing: the bibliography. The bibliography guidelines for our history department are rather complex in comparison to the formats that come packaged with ConTeXt, and I have no idea how to implement them. So far, I've run into two problems: 1. This one's probably very simple: there's the /insertauthors macro for inserting the whole name of the author. But how do you insert just the last name of the author? 2. This one, on the other hand, is likely to be rather non-trivial: the bibliography needs to be broken up into several categories of sources. For example, audiovisual sources, newspaper sources and books should be listed under separate headings, somewhat like this: BIBLIOGRAPHY I. AUDIOVISUAL SOURCES [some sources] II. NEWSPAPER SOURCES [...] III. BOOKS [...] I've tried to decipher the source code of the Bib module but as I'm not particularly fluent in TeX, I haven't been able to make much headway so far. I'd appreciate some hints on where to start with this. I don't suppose there's any existing code for something like this? Maybe I'd be better off writing the bibliography by hand? Thanks for reading, Mika
![](https://secure.gravatar.com/avatar/49e63acb01f2ca80efce7eed08310ce8.jpg?s=120&d=mm&r=g)
Mika Ritola wrote:
Hello,
I'm planning to write my Master's thesis in history using ConTeXt, and I've done some experimenting on it to see if it's actually suitable for my purposes. Everything seems to be quite simple except for one thing: the bibliography. The bibliography guidelines for our history department are rather complex in comparison to the formats that come packaged with ConTeXt, and I have no idea how to implement them. So far, I've run into two problems:
1. This one's probably very simple: there's the /insertauthors macro for inserting the whole name of the author. But how do you insert just the last name of the author?
2. This one, on the other hand, is likely to be rather non-trivial: the bibliography needs to be broken up into several categories of sources. For example, audiovisual sources, newspaper sources and books should be listed under separate headings, somewhat like this:
BIBLIOGRAPHY
I. AUDIOVISUAL SOURCES
[some sources]
II. NEWSPAPER SOURCES
[...]
III. BOOKS
[...]
I've tried to decipher the source code of the Bib module but as I'm not particularly fluent in TeX, I haven't been able to make much headway so far. I'd appreciate some hints on where to start with this. I don't suppose there's any existing code for something like this? Maybe I'd be better off writing the bibliography by hand?
currently the bibtex support is being integrated in the core so if some extension is needed, we can try to deal with it, but only in mkiv (btw, next year it so we will provide a new (extra) interface to bibliographies) - concerning 1: i'm sure users on this list can help you with that - concerning 2: it is not that complex to add an extra level of filtering (using the type key), but we need an example first; best coordinate this with Thomas Schmitz who does testing of the latest code Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
![](https://secure.gravatar.com/avatar/d0e94fb08d4620cfbd2f8f59a7868637.jpg?s=120&d=mm&r=g)
Hi, I'm not sure I can be of much help (hopefully Taco will have a look), but just a few thoughts: On Sep 20, 2009, at 1:30 PM, Mika Ritola wrote:
1. This one's probably very simple: there's the /insertauthors macro for inserting the whole name of the author. But how do you insert just the last name of the author?
If you just want the last name, you can use \cite[author][<citekey>], but I'm not sure if this what you're after, maybe you'll need to tell us more.
2. This one, on the other hand, is likely to be rather non-trivial: the bibliography needs to be broken up into several categories of sources. For example, audiovisual sources, newspaper sources and books should be listed under separate headings, somewhat like this:
BIBLIOGRAPHY
I. AUDIOVISUAL SOURCES
[some sources]
II. NEWSPAPER SOURCES
[...]
III. BOOKS
[...]
I've tried to decipher the source code of the Bib module but as I'm not particularly fluent in TeX, I haven't been able to make much headway so far. I'd appreciate some hints on where to start with this. I don't suppose there's any existing code for something like this? Maybe I'd be better off writing the bibliography by hand?
That sounds harder. You basically need three separate bibliographies, each of them sorted in some way. I'm not certain the current implementation of the bib module can do that (i.e. I'm almost certain it can't). How do you want to refer to these items in your text? Again, we'll probably need some more information about what you want to achieve. Best Thomas
![](https://secure.gravatar.com/avatar/49e63acb01f2ca80efce7eed08310ce8.jpg?s=120&d=mm&r=g)
Thomas A. Schmitz wrote:
That sounds harder. You basically need three separate bibliographies, each of them sorted in some way. I'm not certain the current implementation of the bib module can do that (i.e. I'm almost certain it can't). How do you want to refer to these items in your text? Again, we'll probably need some more information about what you want to achieve.
if we need an additional filtering on book|article etc, i.e. field 't' then this can probably be done without too much effort (in mkiv we can load the original bbl file for that purpose) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
![](https://secure.gravatar.com/avatar/af71bd2bc846771942f22a10cb72782a.jpg?s=120&d=mm&r=g)
2009/9/20 Thomas A. Schmitz
On Sep 20, 2009, at 1:30 PM, Mika Ritola wrote:
1. This one's probably very simple: there's the /insertauthors macro for inserting the whole name of the author. But how do you insert just the last name of the author?
If you just want the last name, you can use \cite[author][<citekey>], but I'm not sure if this what you're after, maybe you'll need to tell us more.
I'll try to give a clearer explanation. First of all, when I cite a source using e.g. \cite[Smith2000], this should appear in the text as "Smith 2000". I've already managed to do this. Now, each entry in the bibliography should begin with the same string that was used to identify it within the text. So, the above example should look something like this: Smith 2000<tab>John Smith. Generic Book Title. Whatever Publishing Company, New York 2000. I know I can get the "John Smith" by using \insertauthors in \setuppublicationlayout. But how do I get just the last name? The answer is probably so simple that I should be ashamed that I can't figure it out by myself but I haven't quite gotten the hang of ConTeXt and TeX yet...
2. This one, on the other hand, is likely to be rather non-trivial: the
bibliography needs to be broken up into several categories of sources. For example, audiovisual sources, newspaper sources and books should be listed under separate headings, somewhat like this:
BIBLIOGRAPHY
I. AUDIOVISUAL SOURCES
[some sources]
II. NEWSPAPER SOURCES
[...]
III. BOOKS
[...]
I've tried to decipher the source code of the Bib module but as I'm not particularly fluent in TeX, I haven't been able to make much headway so far. I'd appreciate some hints on where to start with this. I don't suppose there's any existing code for something like this? Maybe I'd be better off writing the bibliography by hand?
That sounds harder. You basically need three separate bibliographies, each of them sorted in some way. I'm not certain the current implementation of the bib module can do that (i.e. I'm almost certain it can't). How do you want to refer to these items in your text? Again, we'll probably need some more information about what you want to achieve.
I think it would be easiest if I could refer to them in the usual way,
using \cite[Smith2000]. Of course, each item in the .bib file should have some kind of a tag, so that ConTeXt could automagically insert it under the correct heading. Thanks, Mika
![](https://secure.gravatar.com/avatar/c5ae4f9aa0d3a9bd5376e92b322c3e50.jpg?s=120&d=mm&r=g)
On Mon, 21 Sep 2009, Mika Ritola wrote:
2009/9/20 Thomas A. Schmitz
On Sep 20, 2009, at 1:30 PM, Mika Ritola wrote:
1. This one's probably very simple: there's the /insertauthors macro for inserting the whole name of the author. But how do you insert just the last name of the author?
If you just want the last name, you can use \cite[author][<citekey>], but I'm not sure if this what you're after, maybe you'll need to tell us more.
I'll try to give a clearer explanation. First of all, when I cite a source using e.g. \cite[Smith2000], this should appear in the text as "Smith 2000". I've already managed to do this. Now, each entry in the bibliography should begin with the same string that was used to identify it within the text. So, the above example should look something like this:
Smith 2000<tab>John Smith. Generic Book Title. Whatever Publishing Company, New York 2000.
I know I can get the "John Smith" by using \insertauthors in \setuppublicationlayout. But how do I get just the last name?
I do not know an inbuilt way of doing this. You can probably use an ugly hacks like this: \usemodule[bib] \unprotect \def\authorlastname#1#2#3#4#5% {%\bibdoif{#1}{#1\bibalternative\c!firstnamesep}% \bibdoif{#2}{#2\bibalternative\c!vonsep}% #3% \bibdoif{#5}{\bibalternative\c!surnamesep#5\unskip}% % Set a macro for full name \def\fullauthorname{\invertedauthor{#1}{#2}{#3}{#4}{#5}}} \protect \setuppublicationlayout[article]% {\insertartauthors {} {\space\insertpubyear{}{}{}\quad\fullauthorname,} {}% % The above statement uses the full name set in authorlastname \insertarttitle {\space\quotation\bgroup} {,\egroup} {}% \insertjournal {\space\bgroup \it} {\unskip\/\egroup} {}% \insertvolume {,\space vol.~} {\insertissue {,\space no.~} {} {}} {}% \insertpages {,\space pp.\space} {} {}% \insertpubyear {,\space\insertmonth{}{\space}{}} {} {}% \insertnote {.\space} {.} {.}} \setuppublicationlist [artauthor=\authorlastname] \startpublication[k=smith:2000,t=article, a={{Smith}},y=2000, n=1,s=Smt00] \artauthor[]{John}[J.]{}{Smith} \pubyear{2000} \arttitle{The theory of everything} \journal{A fancy journal} \volume{22} \pages{379-423} \month{7} \stoppublication \starttext See~\cite[smith:2000] \placepublications \stoptext
The answer is probably so simple that I should be ashamed that I can't figure it out by myself but I haven't quite gotten the hang of ConTeXt and TeX yet...
With TeX, simple things are not always simple. Aditya
![](https://secure.gravatar.com/avatar/c5ae4f9aa0d3a9bd5376e92b322c3e50.jpg?s=120&d=mm&r=g)
On Sun, 20 Sep 2009, Aditya Mahajan wrote:
On Mon, 21 Sep 2009, Mika Ritola wrote:
2009/9/20 Thomas A. Schmitz
On Sep 20, 2009, at 1:30 PM, Mika Ritola wrote:
1. This one's probably very simple: there's the /insertauthors macro for inserting the whole name of the author. But how do you insert just the last name of the author?
If you just want the last name, you can use \cite[author][<citekey>], but I'm not sure if this what you're after, maybe you'll need to tell us more.
I'll try to give a clearer explanation. First of all, when I cite a source using e.g. \cite[Smith2000], this should appear in the text as "Smith 2000". I've already managed to do this. Now, each entry in the bibliography should begin with the same string that was used to identify it within the text. So, the above example should look something like this:
Smith 2000<tab>John Smith. Generic Book Title. Whatever Publishing Company, New York 2000.
I know I can get the "John Smith" by using \insertauthors in \setuppublicationlayout. But how do I get just the last name?
I do not know an inbuilt way of doing this. You can probably use an ugly hacks like this:
Slightly more clean solution. The current value of the citation is stored as \@@pbk, so you can use \cite to extract whatever data you want. So, \setuppublicationlayout[article]% {\insertartauthors {\cite[alternative=authoryear, left=,right={\quad}][\@@pbk]} {,} {}% \insertarttitle {\space\quotation\bgroup} {,\egroup} {}% \insertjournal {\space\bgroup \it} {\unskip\/\egroup} {}% \insertvolume {,\space vol.~} {\insertissue {,\space no.~} {} {}} {}% \insertpages {,\space pp.\space} {} {}% \insertpubyear {,\space\insertmonth{}{\space}{}} {} {}% \insertnote {.\space} {.} {.}} Aditya
![](https://secure.gravatar.com/avatar/d0e94fb08d4620cfbd2f8f59a7868637.jpg?s=120&d=mm&r=g)
On Sep 21, 2009, at 12:41 AM, Mika Ritola wrote:
I'll try to give a clearer explanation. First of all, when I cite a source using e.g. \cite[Smith2000], this should appear in the text as "Smith 2000". I've already managed to do this. Now, each entry in the bibliography should begin with the same string that was used to identify it within the text. So, the above example should look something like this:
Smith 2000<tab>John Smith. Generic Book Title. Whatever Publishing Company, New York 2000.
I know I can get the "John Smith" by using \insertauthors in \setuppublicationlayout. But how do I get just the last name? The answer is probably so simple that I should be ashamed that I can't figure it out by myself but I haven't quite gotten the hang of ConTeXt and TeX yet...
Ah, so it turns out you're looking for something else altogether. In your case, you want a special kind of label for your bibliographic list. See if Aditya's hack gives the result you want. But generally speaking, I think your setup is pretty common in the humanities, so it should be added as a key to the processactionlist in l. 308-316 of bibl-tra.mkiv. Hans, Taco, is there a proper syntax for getting the lastname and year of the current bib item?
2. This one, on the other hand, is likely to be rather non-trivial: the bibliography needs to be broken up into several categories of sources. For example, audiovisual sources, newspaper sources and books should be listed under separate headings, somewhat like this:
BIBLIOGRAPHY
I. AUDIOVISUAL SOURCES
[some sources]
II. NEWSPAPER SOURCES
[...]
III. BOOKS
[...]
I've tried to decipher the source code of the Bib module but as I'm not particularly fluent in TeX, I haven't been able to make much headway so far. I'd appreciate some hints on where to start with this. I don't suppose there's any existing code for something like this? Maybe I'd be better off writing the bibliography by hand?
That sounds harder. You basically need three separate bibliographies, each of them sorted in some way. I'm not certain the current implementation of the bib module can do that (i.e. I'm almost certain it can't). How do you want to refer to these items in your text? Again, we'll probably need some more information about what you want to achieve.
I think it would be easiest if I could refer to them in the usual way, using \cite[Smith2000]. Of course, each item in the .bib file should have some kind of a tag, so that ConTeXt could automagically insert it under the correct heading.
Well, Hans said it was possible. You'll need to define an additional field to filter your items and then have three lists typeset. Thomas
![](https://secure.gravatar.com/avatar/565476157eb3895a9c928ffce26d988d.jpg?s=120&d=mm&r=g)
Thomas A. Schmitz wrote:
On Sep 21, 2009, at 12:41 AM, Mika Ritola wrote:
I'll try to give a clearer explanation. First of all, when I cite a source using e.g. \cite[Smith2000], this should appear in the text as "Smith 2000". I've already managed to do this. Now, each entry in the bibliography should begin with the same string that was used to identify it within the text. So, the above example should look something like this:
Smith 2000<tab>John Smith. Generic Book Title. Whatever Publishing Company, New York 2000.
I know I can get the "John Smith" by using \insertauthors in \setuppublicationlayout. But how do I get just the last name? The answer is probably so simple that I should be ashamed that I can't figure it out by myself but I haven't quite gotten the hang of ConTeXt and TeX yet...
Ah, so it turns out you're looking for something else altogether. In your case, you want a special kind of label for your bibliographic list. See if Aditya's hack gives the result you want. But generally speaking, I think your setup is pretty common in the humanities, so it should be added as a key to the processactionlist in l. 308-316 of bibl-tra.mkiv. Hans, Taco, is there a proper syntax for getting the lastname and year of the current bib item?
The best approach may be to put the lastname+space+year in the 's' key, and use \setuppublications[refcommand=short, numbering=short] Best wishes, Taco
![](https://secure.gravatar.com/avatar/565476157eb3895a9c928ffce26d988d.jpg?s=120&d=mm&r=g)
Thomas A. Schmitz wrote:
On Sep 21, 2009, at 9:54 AM, Taco Hoekwater wrote:
The best approach may be to put the lastname+space+year in the 's' key, and use
\setuppublications[refcommand=short, numbering=short]
You been by massaging the bbl file with the help of a clever lua script?
Yes (and/or altering the bst file) Best wishes, Taco
participants (5)
-
Aditya Mahajan
-
Hans Hagen
-
Mika Ritola
-
Taco Hoekwater
-
Thomas A. Schmitz