ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* More on XML and citations
@ 2006-04-04 21:09 Johannes Graumann
  2006-04-04 21:43 ` Hans Hagen
  0 siblings, 1 reply; 9+ messages in thread
From: Johannes Graumann @ 2006-04-04 21:09 UTC (permalink / raw)


Hello again,

I have a matching rule for cite commands that look as follows:
<cite id="hunt:86" opt="authoryear"/>

The rule is this (kudoos to Taco):
\defineXMLargument
  [cite]
  {\expanded{\cite[\XMLpar{cite}{opt}{}][\XMLpar{cite}{id}{}]}}

Sometimes I would like to have the '(Hunt et. al., 1986)' produced by above
combination to look like '(see e.g. Hunt et. al., 1986)'. Taco pointed out
in response to a question to list that I could do that by handing
a 'left={(see e.g. }' to the cite command, however I fail to be able to do
that. A XML node like this 
<cite id="hunt:86" opt="authoryear,left={(see e.g.}"/>
results on compilation with above rule in the following error:
! Missing \endcsname inserted.
<to be read again>
                   \leftargument
\XML:ent:tex-leftbrace ...ace \else \leftargument
                                                  \fi
<argument> ...r,left=\getXMLentity {tex-leftbrace}
                                                  see e.g.\getXMLentity
{tex...

\expanded ...\long \xdef \@@expanded {\noexpand #1
                                                  }\@@expanded
\docite ...on [\csname @@pv#2compress\endcsname ]}
                                                   [ \v!yes
=>\bibcitecompre...

\XML:ele:cite/ ...}{opt}{}][\XMLpar {cite}{id}{}]}
                                                  {}
l.112 ...nt:86" opt="authoryear,left={see e.g.}"/>
                                                  ) changed the field
dramat...

Can anybody help me out with this?

Thanks, Joh

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

* Re: More on XML and citations
  2006-04-04 21:09 More on XML and citations Johannes Graumann
@ 2006-04-04 21:43 ` Hans Hagen
  0 siblings, 0 replies; 9+ messages in thread
From: Hans Hagen @ 2006-04-04 21:43 UTC (permalink / raw)


Johannes Graumann wrote:
> Hello again,
>
> I have a matching rule for cite commands that look as follows:
> <cite id="hunt:86" opt="authoryear"/>
>
> The rule is this (kudoos to Taco):
> \defineXMLargument
>   [cite]
>   {\expanded{\cite[\XMLpar{cite}{opt}{}][\XMLpar{cite}{id}{}]}}
>   
- reset opt, otherwise the previous one will be used when no opt is given
- \XMLop (own parameter) saves a few bytes and can be used here

\defineXMLargument
  [cite]
  [opt=]
  {\expanded{\cite[\XMLop{opt}][\XMLop{id}]}}


> Sometimes I would like to have the '(Hunt et. al., 1986)' produced by above
> combination to look like '(see e.g. Hunt et. al., 1986)'. Taco pointed out
> in response to a question to list that I could do that by handing
> a 'left={(see e.g. }' to the cite command, however I fail to be able to do
> that. A XML node like this 
> <cite id="hunt:86" opt="authoryear,left={(see e.g.}"/>
> results on compilation with above rule in the following error:
>   

hm, the problem is that the { } are  no longer tex's braces (grouping)

\starttext

\defineXMLcommand
  [whatever]
  [test=unknown]
  {\XMLop{test}}

\startXMLdata
<whatever test="{\bf test}"/>
\stopXMLdata

\def\defXMLtex#1#2% the appended space will go away when
  {\begingroup    % \scantokens is fixed
   \disableXML
   \everyeof{\noexpand}% br's hack
   \edef\ascii{#2}%
   \edef\ascii{\scantokens\expandafter{\ascii}}% space appended
   \expandafter\endgroup\expandafter\def\expandafter#1\expandafter{\ascii}}
  
\defineXMLcommand
  [whatever]
  [test=unknown]
  {\defXMLtex\SomethingTex{\XMLop{test}}%
   \SomethingTex}

\startXMLdata
<whatever test="{\bf test}"/>
\stopXMLdata

\stoptext

so, then you can for instance feed \SomethingTex into the scite macros

however, best is not to mix tex this way with xml

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

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

* Re: More on XML and citations
  2006-04-06 19:30         ` Taco Hoekwater
@ 2006-04-06 21:23           ` Hans Hagen
  0 siblings, 0 replies; 9+ messages in thread
From: Hans Hagen @ 2006-04-06 21:23 UTC (permalink / raw)


Taco Hoekwater wrote:
> Hi Johannes,
>
> Johannes Graumann wrote:
>   
>> What am I doing wrong? Outdated ContTeXt/bib module?
>>     
>
> Yes. Get the new one from http://modules.contextgarden.net/bib
> or wait 'till the new context release (tomorrow, i believe).
>   
just uploaded 

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

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

* Re: More on XML and citations
  2006-04-06 17:36       ` Johannes Graumann
@ 2006-04-06 19:30         ` Taco Hoekwater
  2006-04-06 21:23           ` Hans Hagen
  0 siblings, 1 reply; 9+ messages in thread
From: Taco Hoekwater @ 2006-04-06 19:30 UTC (permalink / raw)


Hi Johannes,

Johannes Graumann wrote:
> 
> What am I doing wrong? Outdated ContTeXt/bib module?

Yes. Get the new one from http://modules.contextgarden.net/bib
or wait 'till the new context release (tomorrow, i believe).

Cheers, taco

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

* Re: More on XML and citations
  2006-04-06  9:21     ` Taco Hoekwater
@ 2006-04-06 17:36       ` Johannes Graumann
  2006-04-06 19:30         ` Taco Hoekwater
  0 siblings, 1 reply; 9+ messages in thread
From: Johannes Graumann @ 2006-04-06 17:36 UTC (permalink / raw)


Taco Hoekwater wrote:

> 
> 
> Johannes Graumann wrote:
>> Could you - maybe - point me towards the more cumbersome 'official'
>> solution?
> 
> See attached example.
> 
> Cheers, taco

Taco,

With this preamble code 
\unprotect

\def\bibauthoryearxref[#1]%
 {\ixbibauthoryear{#1}%
   {{\currentbibauthor}\bibalternative\c!inbetween
    \bibalternative\v!left{\currentbibyear}\bibalternative\v!right}
   {\bibalternative\c!pubsep{\currentbibauthor}\bibalternative\c!inbetween
    \bibalternative\v!left  {\currentbibyear}\bibalternative\v!right}
  
{\bibalternative\c!lastpubsep{\currentbibauthor}\bibalternative\c!inbetween
    \bibalternative\v!left      {\currentbibyear}\bibalternative\v!right}}

\setupcite
       [authoryearx]
       [\c!andtext={ and },
        \c!otherstext={ et al.},
        \c!pubsep={, },
        \c!lastpubsep={ and },
        \c!compress=\v!yes,
        \c!inbetween={, },
        \c!left={},
        \c!right={}]


\protect

I get the following error at compile time:
! Undefined control sequence.
<argument> \c!andtext
                      ={ and }
\xprocesscommaitem #1,#2->\if ,#1
                                 ,\@EA \xprocesscommaitem \else
\if ]#1\@EAE...
<argument> \c!andtext ={ and }, \c!otherstext
                                              ={ et al.}, \c!pubsep ={, },
\...

\xdogetparameters #1]->\xprocesscommaitem #1
                                            ,],\@relax@
\next1 #1,->\dosetupcite {#1}
                             \doprocesscommaitem
\doprocesscommalist ...item \gobbleoneargument #1,
                                                  ]\relax \global \advance
\...
l.224         \c!right={}]

What am I doing wrong? Outdated ContTeXt/bib module?

Joh

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

* Re: More on XML and citations
  2006-04-05 16:50   ` Johannes Graumann
@ 2006-04-06  9:21     ` Taco Hoekwater
  2006-04-06 17:36       ` Johannes Graumann
  0 siblings, 1 reply; 9+ messages in thread
From: Taco Hoekwater @ 2006-04-06  9:21 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 146 bytes --]



Johannes Graumann wrote:
> Could you - maybe - point me towards the more cumbersome 'official'
> solution?

See attached example.

Cheers, taco

[-- Attachment #2: ixbib.tex --]
[-- Type: application/x-tex, Size: 926 bytes --]

[-- Attachment #3: Type: text/plain, Size: 139 bytes --]

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

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

* Re: More on XML and citations
  2006-04-05  6:55 ` Taco Hoekwater
@ 2006-04-05 16:50   ` Johannes Graumann
  2006-04-06  9:21     ` Taco Hoekwater
  0 siblings, 1 reply; 9+ messages in thread
From: Johannes Graumann @ 2006-04-05 16:50 UTC (permalink / raw)


Taco Hoekwater wrote:

>> Taco, how would I
>> define a new 'cite' alternative along the lines
>> of 'authoryear'/'authoryears' that would result in 'Author et. al.,
>> 2004'?
> 
> Easiest is by using a special macro breaking it up in two bits, like so:
> 
>    \def\mycite#1{\cite[author][#1], \cite[year][#1]}
> 
> there is a way to create 'official' alternatives, but it is quite a
> bit more cumbersome.
Thanks for that. The problem here is that I use XML as the text source and
would like to be able to use 'authoryear', 'authoryears' as well
as 'mycite' occasionally, which I switch to and from by the 'opt' option in
e.g.  '<cite id="hunt:86" opt="authoryear"/>'. If I understand your above
proposal correctly, I would have to literally call '\mycite[hunt:86]' on
the TeX level, and would have to abandon XML ... and thus the reason to
switch from LaTeX to ConTeXt to begin with - and nobody would want that ;0)
Could you - maybe - point me towards the more cumbersome 'official'
solution?

Thanks for your help,

Joh

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

* Re: More on XML and citations
  2006-04-05  2:08 Johannes Graumann
@ 2006-04-05  6:55 ` Taco Hoekwater
  2006-04-05 16:50   ` Johannes Graumann
  0 siblings, 1 reply; 9+ messages in thread
From: Taco Hoekwater @ 2006-04-05  6:55 UTC (permalink / raw)


Johannes Graumann wrote:
> Hans Hagen wrote:
> 
> 
>>however, best is not to mix tex this way with xml
> 
> Hmmmm ... will heed that advice then ... as a remedy: Taco, how would I
> define a new 'cite' alternative along the lines
> of 'authoryear'/'authoryears' that would result in 'Author et. al., 2004'?

Easiest is by using a special macro breaking it up in two bits, like so:

   \def\mycite#1{\cite[author][#1], \cite[year][#1]}

there is a way to create 'official' alternatives, but it is quite a
bit more cumbersome.

Cheers, taco

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

* Re: More on XML and citations
@ 2006-04-05  2:08 Johannes Graumann
  2006-04-05  6:55 ` Taco Hoekwater
  0 siblings, 1 reply; 9+ messages in thread
From: Johannes Graumann @ 2006-04-05  2:08 UTC (permalink / raw)



[-- Attachment #1.1: Type: text/plain, Size: 292 bytes --]

Hans Hagen wrote:

> however, best is not to mix tex this way with xml
Hmmmm ... will heed that advice then ... as a remedy: Taco, how would I
define a new 'cite' alternative along the lines
of 'authoryear'/'authoryears' that would result in 'Author et. al., 2004'?

Thanks for any hint, Joh

[-- Attachment #1.2: Type: application/pgp-signature, Size: 829 bytes --]

[-- Attachment #2: Type: text/plain, Size: 139 bytes --]

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

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

end of thread, other threads:[~2006-04-06 21:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-04 21:09 More on XML and citations Johannes Graumann
2006-04-04 21:43 ` Hans Hagen
2006-04-05  2:08 Johannes Graumann
2006-04-05  6:55 ` Taco Hoekwater
2006-04-05 16:50   ` Johannes Graumann
2006-04-06  9:21     ` Taco Hoekwater
2006-04-06 17:36       ` Johannes Graumann
2006-04-06 19:30         ` Taco Hoekwater
2006-04-06 21:23           ` Hans Hagen

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