ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
Subject: Re: More on XML and citations
Date: Tue, 04 Apr 2006 23:43:51 +0200	[thread overview]
Message-ID: <4432E897.6000509@wxs.nl> (raw)
In-Reply-To: <e0unek$4ds$1@sea.gmane.org>

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

  reply	other threads:[~2006-04-04 21:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-04 21:09 Johannes Graumann
2006-04-04 21:43 ` Hans Hagen [this message]
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

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=4432E897.6000509@wxs.nl \
    --to=pragma@wxs.nl \
    --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).