ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Aditya Mahajan <adityam@umich.edu>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Need help with bibliography
Date: Sun, 20 Sep 2009 19:30:28 -0400 (EDT)	[thread overview]
Message-ID: <alpine.LNX.2.00.0909201847070.12396@ybpnyubfg.ybpnyqbznva> (raw)
In-Reply-To: <86d68cc30909201541s550ab8e0m728a92691d1a9ab3@mail.gmail.com>

On Mon, 21 Sep 2009, Mika Ritola wrote:

> 2009/9/20 Thomas A. Schmitz <thomas.schmitz@uni-bonn.de>
>
>>
>> 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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


  reply	other threads:[~2009-09-20 23:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-20 11:30 Mika Ritola
2009-09-20 16:47 ` Hans Hagen
2009-09-20 20:53 ` Thomas A. Schmitz
2009-09-20 21:13   ` Hans Hagen
2009-09-20 22:41   ` Mika Ritola
2009-09-20 23:30     ` Aditya Mahajan [this message]
2009-09-20 23:46       ` Aditya Mahajan
2009-09-21  5:55     ` Thomas A. Schmitz
2009-09-21  7:54       ` Taco Hoekwater
2009-09-21  9:02         ` Thomas A. Schmitz
2009-09-21  9:11           ` Taco Hoekwater

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LNX.2.00.0909201847070.12396@ybpnyubfg.ybpnyqbznva \
    --to=adityam@umich.edu \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).