ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* How to extend btx rendering?
@ 2016-07-18  8:54 Henri Menke
  2016-07-18 13:06 ` Henri Menke
  0 siblings, 1 reply; 6+ messages in thread
From: Henri Menke @ 2016-07-18  8:54 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Dear list,

It is common in physics (and probably mathematics) that papers are
uploaded to an electronic archive prior to publishing them in the
peer-review literature.  In physical sciences this is https://arxiv.org.

To cite such articles one usually uses the following format, here on the
example of the most recent contribution to the Condensed Matter section:

N.A. Kudryashov, A.A. Kutukov, and E.A. Mazur, Normal State of the
Metallic Hydrogen Sulfide, arXiv:1607.04624 (2016).

To reproduce this kind of format I tried to extend the APS rendering
(see the long example below, sorry).  Unfortunately, this does not work,
because apparently the `eprint` and `archivePrefix` fields are not read
in.  The combination `eprint` and `archivePrefix` is used, because this
is what the LaTeX package `biblatex` expects.

How do I extend the btx rendering by these additional fields?

Cheers,
Henri

---

\startbuffer [references]
  @article{Kudryashov2016,
    title = {Normal State of the Metallic Hydrogen Sulfide},
    author = {Kudryashov, Nikolay A. and Kutukov, Alexander A. and
Mazur, Evgeny A.},
    year = {2016},
    eprint = {1607.04624},
    archivePrefix = {arxiv}
  }
\stopbuffer

\usebtxdataset[references.buffer]
\usebtxdefinitions[aps]

\definebtx[aps:list:eprint][aps:list][style=\tt]

\starttexdefinition unexpanded btx:aps:eprints
    \btxdoif {eprint} {
        \btxstartstyleandcolor [aps:list:eprint]
            \btxdoif {archivePrefix} {
                \btxflush{archivePrefix}:
            }
            \btxflush{eprint}
        \btxstopstyleandcolor
    }
\stoptexdefinition

\startsetups btx:aps:list:article
    \texdefinition{btx:aps:author}
    \texdefinition{btx:aps:optional-title}
    \texdefinition{btx:aps:doi-url}
{\texdefinition{btx:aps:journal-volume-year}}
    \texdefinition{btx:aps:eprint}% extension to APS style
    \texdefinition{btx:aps:note}
\stopsetups

\starttext

\cite{Kudryashov2016}
\placelistofpublications

\stoptext
___________________________________________________________________________________
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] 6+ messages in thread

* Re: How to extend btx rendering?
  2016-07-18  8:54 How to extend btx rendering? Henri Menke
@ 2016-07-18 13:06 ` Henri Menke
  2016-07-18 15:40   ` Alan BRASLAU
  0 siblings, 1 reply; 6+ messages in thread
From: Henri Menke @ 2016-07-18 13:06 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Okay, I have partly found out myself.  One has to add the field `eprint`
and `archivePrefix` to `categories.article.optional` in the file
base/mkiv/publ-imp-aps.lua.

But I don't want to edit any system files, because this is not portable.
 Also I don't want to have a copy of this file in my project directory,
because this is just redundant.

How can I add the two fields `eprint` and `archivePrefix` to
`categories.article.optional` from the document level?

Cheers,
Henri

N.B.:  In my original post there was a typo.  It should read

\starttexdefinition unexpanded btx:aps:eprint

(It was btx:aps:eprints in the original post)


On 07/18/2016 10:54 AM, Henri Menke wrote:
> Dear list,
> 
> It is common in physics (and probably mathematics) that papers are
> uploaded to an electronic archive prior to publishing them in the
> peer-review literature.  In physical sciences this is https://arxiv.org.
> 
> To cite such articles one usually uses the following format, here on the
> example of the most recent contribution to the Condensed Matter section:
> 
> N.A. Kudryashov, A.A. Kutukov, and E.A. Mazur, Normal State of the
> Metallic Hydrogen Sulfide, arXiv:1607.04624 (2016).
> 
> To reproduce this kind of format I tried to extend the APS rendering
> (see the long example below, sorry).  Unfortunately, this does not work,
> because apparently the `eprint` and `archivePrefix` fields are not read
> in.  The combination `eprint` and `archivePrefix` is used, because this
> is what the LaTeX package `biblatex` expects.
> 
> How do I extend the btx rendering by these additional fields?
> 
> Cheers,
> Henri
> 
> ---
> 
> \startbuffer [references]
>   @article{Kudryashov2016,
>     title = {Normal State of the Metallic Hydrogen Sulfide},
>     author = {Kudryashov, Nikolay A. and Kutukov, Alexander A. and
> Mazur, Evgeny A.},
>     year = {2016},
>     eprint = {1607.04624},
>     archivePrefix = {arxiv}
>   }
> \stopbuffer
> 
> \usebtxdataset[references.buffer]
> \usebtxdefinitions[aps]
> 
> \definebtx[aps:list:eprint][aps:list][style=\tt]
> 
> \starttexdefinition unexpanded btx:aps:eprints
>     \btxdoif {eprint} {
>         \btxstartstyleandcolor [aps:list:eprint]
>             \btxdoif {archivePrefix} {
>                 \btxflush{archivePrefix}:
>             }
>             \btxflush{eprint}
>         \btxstopstyleandcolor
>     }
> \stoptexdefinition
> 
> \startsetups btx:aps:list:article
>     \texdefinition{btx:aps:author}
>     \texdefinition{btx:aps:optional-title}
>     \texdefinition{btx:aps:doi-url}
> {\texdefinition{btx:aps:journal-volume-year}}
>     \texdefinition{btx:aps:eprint}% extension to APS style
>     \texdefinition{btx:aps:note}
> \stopsetups
> 
> \starttext
> 
> \cite{Kudryashov2016}
> \placelistofpublications
> 
> \stoptext
> 

___________________________________________________________________________________
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] 6+ messages in thread

* Re: How to extend btx rendering?
  2016-07-18 13:06 ` Henri Menke
@ 2016-07-18 15:40   ` Alan BRASLAU
  2016-07-18 18:05     ` Henri Menke
  0 siblings, 1 reply; 6+ messages in thread
From: Alan BRASLAU @ 2016-07-18 15:40 UTC (permalink / raw)
  To: Henri Menke; +Cc: mailing list for ConTeXt users

On Mon, 18 Jul 2016 15:06:06 +0200
Henri Menke <henrimenke@gmail.com> wrote:

> But I don't want to edit any system files, because this is not
> portable. Also I don't want to have a copy of this file in my project
> directory, because this is just redundant.
> 
> How can I add the two fields `eprint` and `archivePrefix` to
> `categories.article.optional` from the document level?

Hi Henri,

eprint and archivePrefix are in no ways standard to bibtex.

But really, an eprint is NOT an *article* until it gets published, and
then it should be cited as an article and not as a preprint.


What you are looking for is a way to attach a label "arXiv:1607.04624"
to the url = {http://arxiv.org/abs/1607.04624}, similarly to how a doi
is handled.

I can easily add the field arxiv to the "aps" rendering as it is
well-defined.

I can also add the field eprint (to be combined with the url field) as
in
  eprint = {arxiv:1607.04624},
  url = {http://arxiv.org/abs/1607.04624},
as this use can be pretty general. But I do *not* like the
archivePrefix use of biblatex as it is a good example of bloat and
feature creep.

So I will modify the aps specifications to be used as

@unpublished{Kudryashov2016,
    title = {Normal State of the Metallic Hydrogen Sulfide},
    author = {Kudryashov, Nikolay A. and Kutukov, Alexander A. and
    Mazur, Evgeny A.},
    year = {2016},
    eprint = {arxiv:1607.04624},
    url = {http://arxiv.org/abs/1607.04624},
}




Alan
___________________________________________________________________________________
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] 6+ messages in thread

* Re: How to extend btx rendering?
  2016-07-18 15:40   ` Alan BRASLAU
@ 2016-07-18 18:05     ` Henri Menke
  2016-07-18 18:30       ` Henri Menke
  2016-07-18 19:39       ` Alan BRASLAU
  0 siblings, 2 replies; 6+ messages in thread
From: Henri Menke @ 2016-07-18 18:05 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Alan,

thanks for your speedy reply.  Actually, I also dislike the scattered
specification of `eprint` and `archivePrefix`, but thought that it might
be better to keep it for interoperability between ConTeXt and biblatex.

The solution you sent to me works nicely and looks very clean.  I will
repeat it here, because you only sent it to me personally instead of the
list and it might be helpful to other people, so here it is:

@electronic{Kudryashov2016,
    title = {Normal State of the Metallic Hydrogen Sulfide},
    author = {Kudryashov, Nikolay A. and Kutukov, Alexander A. and
    Mazur, Evgeny A.},
    year = {2016},
    howpublished = {arxiv:1607.04624},
    url = {http://arxiv.org/abs/1607.04624},
}

I think it would be advantageous to also have the eprint/howpublished
field available for @article such that I can link the arXiv even though
an article has been published.  This way people without subscription to
a specific journal can readily access the preprint (open-access
philosophy).  Do you consider this a viable option?

Cheers,
Henri

On 07/18/2016 05:40 PM, Alan BRASLAU wrote:
> On Mon, 18 Jul 2016 15:06:06 +0200
> Henri Menke <henrimenke@gmail.com> wrote:
> 
>> But I don't want to edit any system files, because this is not
>> portable. Also I don't want to have a copy of this file in my project
>> directory, because this is just redundant.
>>
>> How can I add the two fields `eprint` and `archivePrefix` to
>> `categories.article.optional` from the document level?
> 
> Hi Henri,
> 
> eprint and archivePrefix are in no ways standard to bibtex.
> 
> But really, an eprint is NOT an *article* until it gets published, and
> then it should be cited as an article and not as a preprint.
> 
> 
> What you are looking for is a way to attach a label "arXiv:1607.04624"
> to the url = {http://arxiv.org/abs/1607.04624}, similarly to how a doi
> is handled.
> 
> I can easily add the field arxiv to the "aps" rendering as it is
> well-defined.
> 
> I can also add the field eprint (to be combined with the url field) as
> in
>   eprint = {arxiv:1607.04624},
>   url = {http://arxiv.org/abs/1607.04624},
> as this use can be pretty general. But I do *not* like the
> archivePrefix use of biblatex as it is a good example of bloat and
> feature creep.
> 
> So I will modify the aps specifications to be used as
> 
> @unpublished{Kudryashov2016,
>     title = {Normal State of the Metallic Hydrogen Sulfide},
>     author = {Kudryashov, Nikolay A. and Kutukov, Alexander A. and
>     Mazur, Evgeny A.},
>     year = {2016},
>     eprint = {arxiv:1607.04624},
>     url = {http://arxiv.org/abs/1607.04624},
> }
> 
> 
> 
> 
> Alan
> 

___________________________________________________________________________________
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] 6+ messages in thread

* Re: How to extend btx rendering?
  2016-07-18 18:05     ` Henri Menke
@ 2016-07-18 18:30       ` Henri Menke
  2016-07-18 19:39       ` Alan BRASLAU
  1 sibling, 0 replies; 6+ messages in thread
From: Henri Menke @ 2016-07-18 18:30 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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

Alan,

I noticed that there are some difficulties.  The patched version of
`publ-imp-aps.mkvi` behaves unexpected.  The year in the @electronic
citation is now missing a space and an opening parenthesis.
Furthermore, when I place hyperlinks the color »spills over«, see
attached.  The link is only on the string `arXiv:1607.04624` but the
whole line is coloured.  Below is some minimal code to reproduce using
ConTeXt in TL2016.

Cheers,
Henri

---

\startbuffer [references]
  @electronic{Kudryashov2016,
    title = {Normal State of the Metallic Hydrogen Sulfide},
    author = {Kudryashov, Nikolay A. and Kutukov, Alexander A. and
Mazur, Evgeny A.},
    year = {2016},
    howpublished = {arXiv:1607.04624},
    url = {https://arxiv.org/abs/1607.04624}
  }
\stopbuffer

\setupinteraction[state=start]

\usebtxdataset[references.buffer]
\usebtxdefinitions[aps]

\starttext

\cite{Kudryashov2016}
\placelistofpublications

\stoptext

On 07/18/2016 08:05 PM, Henri Menke wrote:
> Alan,
> 
> thanks for your speedy reply.  Actually, I also dislike the scattered
> specification of `eprint` and `archivePrefix`, but thought that it might
> be better to keep it for interoperability between ConTeXt and biblatex.
> 
> The solution you sent to me works nicely and looks very clean.  I will
> repeat it here, because you only sent it to me personally instead of the
> list and it might be helpful to other people, so here it is:
> 
> @electronic{Kudryashov2016,
>     title = {Normal State of the Metallic Hydrogen Sulfide},
>     author = {Kudryashov, Nikolay A. and Kutukov, Alexander A. and
>     Mazur, Evgeny A.},
>     year = {2016},
>     howpublished = {arxiv:1607.04624},
>     url = {http://arxiv.org/abs/1607.04624},
> }
> 
> I think it would be advantageous to also have the eprint/howpublished
> field available for @article such that I can link the arXiv even though
> an article has been published.  This way people without subscription to
> a specific journal can readily access the preprint (open-access
> philosophy).  Do you consider this a viable option?
> 
> Cheers,
> Henri
> 
> On 07/18/2016 05:40 PM, Alan BRASLAU wrote:
>> On Mon, 18 Jul 2016 15:06:06 +0200
>> Henri Menke <henrimenke@gmail.com> wrote:
>>
>>> But I don't want to edit any system files, because this is not
>>> portable. Also I don't want to have a copy of this file in my project
>>> directory, because this is just redundant.
>>>
>>> How can I add the two fields `eprint` and `archivePrefix` to
>>> `categories.article.optional` from the document level?
>>
>> Hi Henri,
>>
>> eprint and archivePrefix are in no ways standard to bibtex.
>>
>> But really, an eprint is NOT an *article* until it gets published, and
>> then it should be cited as an article and not as a preprint.
>>
>>
>> What you are looking for is a way to attach a label "arXiv:1607.04624"
>> to the url = {http://arxiv.org/abs/1607.04624}, similarly to how a doi
>> is handled.
>>
>> I can easily add the field arxiv to the "aps" rendering as it is
>> well-defined.
>>
>> I can also add the field eprint (to be combined with the url field) as
>> in
>>   eprint = {arxiv:1607.04624},
>>   url = {http://arxiv.org/abs/1607.04624},
>> as this use can be pretty general. But I do *not* like the
>> archivePrefix use of biblatex as it is a good example of bloat and
>> feature creep.
>>
>> So I will modify the aps specifications to be used as
>>
>> @unpublished{Kudryashov2016,
>>     title = {Normal State of the Metallic Hydrogen Sulfide},
>>     author = {Kudryashov, Nikolay A. and Kutukov, Alexander A. and
>>     Mazur, Evgeny A.},
>>     year = {2016},
>>     eprint = {arxiv:1607.04624},
>>     url = {http://arxiv.org/abs/1607.04624},
>> }
>>
>>
>>
>>
>> Alan
>>
> 


[-- Attachment #2: test.pdf --]
[-- Type: application/pdf, Size: 11976 bytes --]

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

___________________________________________________________________________________
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] 6+ messages in thread

* Re: How to extend btx rendering?
  2016-07-18 18:05     ` Henri Menke
  2016-07-18 18:30       ` Henri Menke
@ 2016-07-18 19:39       ` Alan BRASLAU
  1 sibling, 0 replies; 6+ messages in thread
From: Alan BRASLAU @ 2016-07-18 19:39 UTC (permalink / raw)
  To: Henri Menke; +Cc: mailing list for ConTeXt users

On Mon, 18 Jul 2016 20:05:52 +0200
Henri Menke <henrimenke@gmail.com> wrote:

> I think it would be advantageous to also have the eprint/howpublished
> field available for @article such that I can link the arXiv even
> though an article has been published.  This way people without
> subscription to a specific journal can readily access the preprint
> (open-access philosophy).  Do you consider this a viable option?

Actually, correct usage *requires* you to give the published reference
and doi. The APS, for example, will accept manuscripts that have been
put on a preprint database, but the author *must* subsequently modify
the entry on the preprint database to give the published reference.

The howpublished field would be inappropriate for a published
@article{}.

An author can always choose to add a note, as in
  note={preprint available as arxiv:1607.04624},
but this will not get hyperlinked to the url using the aps
bibliography specifications.

My suggestion would be to keep your (@electronic) entry in the .bib
file and to add the published version as a new @article entry. Then one
has two choices:
  \cite[article,electronic]
that will generate two references, or
  \cite[article+electronic] 
that will generate a single reference. Note that (often?) the year
might differ (depending on when in the year and how long it took to get
published)!

Alan
___________________________________________________________________________________
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] 6+ messages in thread

end of thread, other threads:[~2016-07-18 19:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-18  8:54 How to extend btx rendering? Henri Menke
2016-07-18 13:06 ` Henri Menke
2016-07-18 15:40   ` Alan BRASLAU
2016-07-18 18:05     ` Henri Menke
2016-07-18 18:30       ` Henri Menke
2016-07-18 19:39       ` Alan BRASLAU

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