ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Custom cite commands
@ 2011-05-02 14:05 Oliver Buerschaper
  2011-05-05 10:59 ` Taco Hoekwater
  0 siblings, 1 reply; 4+ messages in thread
From: Oliver Buerschaper @ 2011-05-02 14:05 UTC (permalink / raw)
  To: mailing ConTeXt users list for

Dear all,

I'm in need for a few custom cite commands like these:

1. \cite[alternative=authortitle, extras={, p.\,13}][citekey] should yield

{\sc AuthorLastName}, AuthorFirstName, {\it title}, p.\,13

2. \cite[alternative=title][citekey]

{\it title}

How would I code these commands?

Oliver
___________________________________________________________________________________
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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Custom cite commands
  2011-05-02 14:05 Custom cite commands Oliver Buerschaper
@ 2011-05-05 10:59 ` Taco Hoekwater
  2011-05-05 11:55   ` Oliver Buerschaper
  0 siblings, 1 reply; 4+ messages in thread
From: Taco Hoekwater @ 2011-05-05 10:59 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 05/02/2011 04:05 PM, Oliver Buerschaper wrote:
> Dear all,
>
> I'm in need for a few custom cite commands like these:
>
> 1. \cite[alternative=authortitle, extras={, p.\,13}][citekey] should yield
>
> {\sc AuthorLastName}, AuthorFirstName, {\it title}, p.\,13
>
> 2. \cite[alternative=title][citekey]
>
> {\it title}
>
> How would I code these commands?

There is no quick answer to this. The easiest way is to use the 
\getcitedata command to create a dedicated macro for the class
you need, and that is explained in the bib module manual.

Otherwise, you will have to dive into the sources to see how e.g. 
'\bibauthoryearref' and '\bibshortref' are implemented. If you create 
the \bibtitleref and \bibauthortitleref macros, these will be executed
automatically.

Best wishes,
Taco
___________________________________________________________________________________
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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Custom cite commands
  2011-05-05 10:59 ` Taco Hoekwater
@ 2011-05-05 11:55   ` Oliver Buerschaper
  2011-05-05 12:06     ` Taco Hoekwater
  0 siblings, 1 reply; 4+ messages in thread
From: Oliver Buerschaper @ 2011-05-05 11:55 UTC (permalink / raw)
  To: mailing ConTeXt users list for

>> I'm in need for a few custom cite commands like these:
>> 
>> 1. \cite[alternative=authortitle, extras={, p.\,13}][citekey] should yield
>> 
>> {\sc AuthorLastName}, AuthorFirstName, {\it title}, p.\,13
>> 
>> 2. \cite[alternative=title][citekey]
>> 
>> {\it title}
>> 
>> How would I code these commands?
> 
> There is no quick answer to this. The easiest way is to use the \getcitedata command to create a dedicated macro for the class
> you need, and that is explained in the bib module manual.
> 
> Otherwise, you will have to dive into the sources to see how e.g. '\bibauthoryearref' and '\bibshortref' are implemented. If you create the \bibtitleref and \bibauthortitleref macros, these will be executed
> automatically.

Many thanks, Taco!

I'm realizing I asked you the same kind of question three years before… apologies for forgetting. In any case I've just tried the solution you gave me back then (based on \getcitedata) but unfortunately it doesn't work any longer: the \specialcite command below doesn't output anything for me.

---
\startpublication
	[a=Kitaev,
	 k=Kitaev:2003,
	 t=article,
	 y=2003]
	 \artauthor{Alexei~Y.}[A.\,Y.]{}{Kitaev}
	 \arttitle{Fault-tolerant quantum computation by anyons}
	 \journal{Annals of Physics}
	 \pages{2--30}
	 \pubyear{2003}
	 \volume{303}
\stoppublication


\def\MYauthor#1#2#3#4#5{#4\,{\sc #3}}
\def\specialcite#1[#2]%
	{\bgroup
	 \getcitedata[author1][#2] to \mauthors
	 \getcitedata[title][#2] to \mtitle
	 \expandafter\MYauthor\mauthors: {\it\mtitle}%
	 \egroup}



\starttext

\specialcite[Kitaev:2003]

\cite[authoryear][Kitaev:2003]

\completepublications
    [criterium=all]

\stoptext
---


Can you think of another workaround?

Many thanks,
Oliver
___________________________________________________________________________________
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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Custom cite commands
  2011-05-05 11:55   ` Oliver Buerschaper
@ 2011-05-05 12:06     ` Taco Hoekwater
  0 siblings, 0 replies; 4+ messages in thread
From: Taco Hoekwater @ 2011-05-05 12:06 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 05/05/2011 01:55 PM, Oliver Buerschaper wrote:
>>> I'm in need for a few custom cite commands like these:
>>>
>>> 1. \cite[alternative=authortitle, extras={, p.\,13}][citekey] should yield
>>>
>>> {\sc AuthorLastName}, AuthorFirstName, {\it title}, p.\,13
>>>
>>> 2. \cite[alternative=title][citekey]
>>>
>>> {\it title}
>>>
>>> How would I code these commands?
>>
>> There is no quick answer to this. The easiest way is to use the \getcitedata command to create a dedicated macro for the class
>> you need, and that is explained in the bib module manual.
>>
>> Otherwise, you will have to dive into the sources to see how e.g. '\bibauthoryearref' and '\bibshortref' are implemented. If you create the \bibtitleref and \bibauthortitleref macros, these will be executed
>> automatically.
>
> Many thanks, Taco!
>
> I'm realizing I asked you the same kind of question three years before… apologies for forgetting. In any case I've just tried the solution you gave me back then (based on \getcitedata) but unfortunately it doesn't work any longer: the \specialcite command below doesn't output anything for me.

Subtle incompatibility here: you need

   \def\specialcite#1[#2]%
	{\bgroup
	 \getcitedata[artauthor1][#2] to \mauthors
	 \getcitedata[arttitle][#2] to \mtitle
	 \expandafter\MYauthor\mauthors: {\it\mtitle}%
	 \egroup}

for current mkiv.

Best wishes,
Taco
___________________________________________________________________________________
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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-05-05 12:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-02 14:05 Custom cite commands Oliver Buerschaper
2011-05-05 10:59 ` Taco Hoekwater
2011-05-05 11:55   ` Oliver Buerschaper
2011-05-05 12:06     ` Taco Hoekwater

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).