2

I am using the amsrefs package for my citations, and I am very happy with it. A small problem that I am facing, however, is that arXiv (unlike MathSciNet) does not have an option for downloading references in the amsrefs format; arXiv only allows for downloading references in the BibTeX format. Is there something that I can do to have the arXiv BibTeX citation converted to a amsrefs citation? Please let me know. Thank you!

0

The BibTeX citation generated by arXiv.org is in the misc entry type with the following entries:

@misc{citekey,
      title={Title of the paper}, 
      author={First Author and Second Author and Third Author},
      year={2021},
      eprint={1506.12345},
      archivePrefix={arXiv},
      primaryClass={math.XX}
}

In AMSRefs, the misc entry type is an alias for the book entry type, but it makes more sense to either create a new bibliography entry type called arxiv, or to modify the article entry type to handle arxiv entries. I prefer the latter, since it allows one to also add the arxiv preprint links to papers that have been published in journals (this is especially useful if the journal version is behind a paywall).

Taking an answer by User Zach Teitler as a template, add the following to your preamble:

\makeatletter
\catcode`\'=11 % letter; it was originally 12
\def\PrintArxiv{%
    \resolve@inner{\bib@print@inner\setbib@arxiv}
}
\def\PrintArxivDetails#1{%
    \begingroup
        #1\relax
        \bib@resolve@xrefs
        \bib@field@patches
        \bib'setup
        \let\PrintPrimary\@empty
        {%
            \IfEmptyBibField{archivenumber}{\amsrefs@warning{Missing arXiv number}}{%
                \IfEmptyBibField{archiveprefix}{\amsrefs@warning{Missing arXiv prefix}}{%
                    \@ifundefined{href}{%
                        \texttt{\bib'archiveprefix:\bib'archivenumber}%
                        \IfEmptyBibField{primaryclass}{}{~\texttt{[\bib'primaryclass]}}%
                    }{%
                        \href{https://arxiv.org/abs/\bib'archivenumber}{\nolinkurl{\bib'archiveprefix:\bib'archivenumber}}%
                        \IfEmptyBibField{primaryclass}{}{~\nolinkurl{[\bib'primaryclass]}}%
                    }%
                }%
            }%
            \bib'transition
        }%
        \setbib@@
    \endgroup
}
\catcode`\'=12 % other
\makeatother

\BibSpec{arxiv}{%
    +{}  {\PrintArxivDetails}           {transition}
}


\BibSpec{article}{%
    +{}  {\PrintAuthors}                {author}
    +{,} { \textit}                     {title}
    +{.} { }                            {part}
    +{:} { \textit}                     {subtitle}
    +{,} { \PrintContributions}         {contribution}
    +{.} { \PrintPartials}              {partial}
    +{,} { }                            {journal}
    +{}  { \textbf}                     {volume}
    +{}  { \PrintDatePV}                {date}
    +{,} { \issuetext}                  {number}
    +{,} { \eprintpages}                {pages}
    +{,} { }                            {status}
    +{,} { \PrintDOI}                   {doi}
    +{,} { available at \eprint}        {eprint}
    +{,} { available at \PrintArxiv}    {arxiv}
    +{.} {}                             {transition}
    +{}  { \parenthesize}               {language}
    +{}  { \PrintTranslation}           {translation}
    +{;} { \PrintReprint}               {reprint}
    +{.} { }                            {note}
    +{.} {}                             {transition}
    +{}  { \PrintReviews}               {review}
}

Note the addition of the transition field to ensure that a full stop is placed at the relevant point whether or not the arxiv entry is used. (Also, the \SentenceSpace command has been removed from the review entry for separate reasons.)

The bibliography entry is then entered as:

\bib{citekey}{article}{
    author={Author, First},
    author={Author, Second},
    author={Author, Third},
    title={Title of the paper},
    date={2021},
    arxiv={
        archivenumber={1506.12345},
        archiveprefix={arXiv},
        primaryclass={math.XX},
    },
}

Screenshot of output for the above bib entry.

Since the eprint field is already used in AMSRefs for a different purpose, I've renamed that field generated in the BibTeX citation as archivenumber. Note that the names of the entries archiveprefix and primaryclass must be completely in lowercase here, whereas BibTeX is agnostic about the casing of the individual letters.

New contributor
The Amplitwist is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.