![](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