ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Mojca Miklavec <mojca.miklavec.lists@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: creating own hyperlinks in bibliography
Date: Sun, 29 Aug 2010 14:24:03 +0200	[thread overview]
Message-ID: <AANLkTinAZo3KP9x+QKyAY4YvOJOFu260kZq5+KxTfy3U@mail.gmail.com> (raw)
In-Reply-To: <331BCCD3-A2E8-4479-A550-979B997F0124@gmail.com>

On Sat, Aug 28, 2010 at 09:02, Otared Kavian wrote:
> Hi Mojca,
> Could you please post a full example where your newly defined biblio field
> works?

Sure.

In reality it's just two things that you need to do:
- \newbibfield[nameofyourkey]
- you need to change \setuppublicationlayout for all the
books/articles/etc. where you want to use that field

First a simple example of a new entity (webpage), not a new biblio
field. All the fields are already known though.

\setuppublicationlayout[webpage]{%
	\inserttitle{\bgroup\it }{\egroup. }{}%
	\inserturl{}{}{}%
}
\startpublication
	[k=ESFRI,t=webpage,u=http://cordis.europa.eu/esfri/]
	\biburl{http://cordis.europa.eu/esfri/}
	\title{CORDIS: European Strategy Forum on Research Infrastructures}
\stoppublication

Here's an example of a new entity with a new field. I defined a new
entity "conference" with two new fields "conference" for conference
name and "cobissid" for unique slovenian identification of
publications:

\newbibfield[conference]
\newbibfield[cobissid]

% the date is formatted in Slovenian way (I just cloned one of my old examples):
\setuppublicationlayout[conference]{%
	\insertartauthors{}{\unskip. }{}%
	\insertarttitle{\bgroup }{\egroup. }{}%
	\insertconference{\bgroup \it}{\egroup\insertday{, }{.
}{}\insertmonth{}{\ }{}\insertpubyear{}{}{}. }{}%
	\insertcobissid{[\sc cobiss.si-id\ }{]}{}%
}

\startpublication
	[k=biblioexample,
	 t=conference,
	 y=2010,
	 s=,
	 u=,
	]
	\artauthor[]{Otared}[O.]{}{Kavian}
	\arttitle{Something about bibliography}
	\conference{4th \ConTeXt\ meeting}
	\pubyear{2010}\month{September}\day{13-19}
	\cobissid{333}
\stoppublication

Now that I know how to do it, I would also add the following lines
which redefine the way how \insertcobissid works, but this is fully
optional and you would normally not need to do it:

\unprotect
\def\bibinsertcobissid#1#2#3%
 {{\bibdoifelse{\@@pb@cobissid}%
     {\edef\ascii{\@EA\detokenize\@EA{\@@pb@cobissid}}%
      #1\expanded{\gotoCOBISS{\@@pb@thekey}{\ascii}}#2}{#3}}}
\protect

\def\gotoCOBISS#1#2%
 {\ifbibinteractionelse
   {\useURL[bibfoo#1][http://www.cobiss.si/scripts/cobiss?command=DISPLAY&base=cobib&rid=#2]%
    \goto{#2}[url(bibfoo#1)]}%
   {#2}}

Note that if you want to add a field to book, you need to completely
rewrite the part with
    \setuppublicationlayout[book]{%
but that depends a lot on the style you want to use. You would
normally check one of tex files that comes with bib module and
copy-paste from that one. This is my example where I wanted to add
cobissid and isbn (and maybe other modifications that I don't
remember), but your example would probably differ considerably, so do
not blindly copy-paste from this example.

\newif\ifeditedbook
\setuppublicationlayout[book]{%
   \insertauthors{}{\unskip. }{\inserteditors{}{\unskip, editor%
                         \ifnum\getvalue{editor@num}> 1 s\fi.%
                             \ \global\editedbooktrue
                     }{\insertthekey{}{\unskip. }{}}}%
   \inserttitle
        {\bgroup\it }%
        {\/\egroup
         \ifeditedbook.%
           \global\editedbookfalse
           \insertvolume
                { Number~}%
                {\insertseries
                    { in~\bgroup}%
                    {\egroup. }%
                    {\insertcrossref{ in~}{}{. }}}%
                {\insertseries{ }{.}{} }%
        \else
       \insertcrossref
        {\insertchap{, }{}{}%
         \insertpages{, pages }{. }{. }%
         \insertvolume{Volume~}{ of~}{}%
         }%
        {}%
        {\insertvolume
                   {, volume~}%
                   {\insertseries
                      { of~\bgroup\it}%
                      {\egroup}
                      {}}
                   {}%
                   \insertchap{, }{}{}%
                   \insertpages{, pages }{.}{.}%
                }%
        \fi}%
        {}%
   \insertpublisher
    { }%
    {\insertedition{, }{ edition}{}%
     \insertpubyear{, }{.}{.}}%
    {\insertedition{, }{ edition}{}%
     \insertpubyear{, }{.}{.}}%
   \insertpages{ }{p.}{}%
   \insertisbn{ {\sc isbn}: \bgroup\os}{\egroup.}{}%
   \insertcobissid{ {\sc cobiss.si-id}: \bgroup\os}{\egroup.}{}%
   \insertdoi{ {\sc doi}: }{.}{}%
   \insertnote{ }{.}{}%
}


> In some occasions I have had analogous needs (references to papers on
> arxive.org for instance, or other repositories. It would be handy to know
> how one can add such bibliography fields.

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


      reply	other threads:[~2010-08-29 12:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-27 11:00 Mojca Miklavec
2010-08-27 13:40 ` Taco Hoekwater
2010-08-27 16:02   ` Mojca Miklavec
2010-08-28  7:02     ` Otared Kavian
2010-08-29 12:24       ` Mojca Miklavec [this message]

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=AANLkTinAZo3KP9x+QKyAY4YvOJOFu260kZq5+KxTfy3U@mail.gmail.com \
    --to=mojca.miklavec.lists@gmail.com \
    --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).