Поля BibTeX для DOI, MR, Zbl и arxiv?

Поля BibTeX для DOI, MR, Zbl и arxiv?

Я несколько раз видел в некоторых текстах красиво отформатированные библиографии, которые включали гиперссылки на MR, Zbl и arxiv, иногда doi, например, что-то, что выглядело примерно так (скопировано сЭта бумага):

  • Борис Албар и Даниэль Гонсалвеш. О треугольниках в свободных графах Kr-minor. 2013. arXiv:1304.5468.
  • Кен-ити Каварабаяси и Цзы-Ся Сун. Независимое число и кликовые миноры. J. Graph Theory, 56(3):219–226, 2007. doi:10.1002/jgt.20268. МИСТЕР:2355127.
  • Александр В. Косточка. Минимальное число Хадвигера для графов с заданной средней степенью вершин. Методы дискретного анализа, 38:37–58, 1982. МР:0713722, Збл:0544.05037.

Какой стиль BibTeX можно использовать для получения такого? Какие поля используются и как они форматируются?

Как это сделать вручную (без BibTeX)?

решение1

biblatexочень хорош в таких вещах.

biblatexДля каждой записи можно eprintуказать только одно место назначения, поэтому мы создадим новое поле для каждого из различных типов электронной печати.

Нам придется попросить biblatexпредоставить дословное поле для этого и включить его для всех типов записей. * Это делается через .dbxфайл модели данных ( ). Этот файл создается filecontentsв примере ниже, на практике вы, вероятно, этого не сделаете и просто скопируете файл .dbxв место, где TeX сможет его найти.

Мы назовем файлext-eprint.dbx

\ProvidesFile{ext-eprint.dbx}[2016/09/11 extended stand-alone eprint fields]
\DeclareDatamodelFields[type=field,datatype=verbatim]{arxiv,mr,zbl,jstor,hdl,pubmed,googlebooks,pmcid}
\DeclareDatamodelEntryfields{arxiv,mr,zbl,jstor,hdl,pubmed,googlebooks,pmcid}
\DeclareDatamodelFields[type=field,datatype=literal]{arxivclass}
\DeclareDatamodelEntryfields{arxivclass}

Затем вам нужно загрузить файл модели данных. Предполагая, что он называется ext-eprint.dbx, вы передаете опцию datamodel=ext-eprintво biblatexвремя загрузки.

Можно добавлять произвольные псевдонимы через

\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map{
      \step[fieldsource=pmid, fieldtarget=pubmed]
    }
  }
}

Тогда, конечно, эти электронные отпечатки нуждаются в форматах, общая схема довольно похожа.

\makeatletter
\DeclareFieldFormat{arxiv}{%
  arXiv\addcolon\space
  \ifhyperref
    {\href{http://arxiv.org/\abx@arxivpath/#1}{%
       \nolinkurl{#1}%
       \iffieldundef{arxivclass}
         {}
         {\addspace\texttt{\mkbibbrackets{\thefield{arxivclass}}}}}}
    {\nolinkurl{#1}
     \iffieldundef{arxivclass}
       {}
       {\addspace\texttt{\mkbibbrackets{\thefield{arxivclass}}}}}}
\makeatother
\DeclareFieldFormat{pmcid}{%
  PMCID\addcolon\space
  \ifhyperref
    {\href{http://www.ncbi.nlm.nih.gov/pmc/articles/#1}{\nolinkurl{#1}}}
    {\nolinkurl{#1}}}
\DeclareFieldFormat{mr}{%
  MR\addcolon\space
  \ifhyperref
    {\href{http://www.ams.org/mathscinet-getitem?mr=MR#1}{\nolinkurl{#1}}}
    {\nolinkurl{#1}}}
\DeclareFieldFormat{zbl}{%
  Zbl\addcolon\space
  \ifhyperref
    {\href{http://zbmath.org/?q=an:#1}{\nolinkurl{#1}}}
    {\nolinkurl{#1}}}
\DeclareFieldAlias{jstor}{eprint:jstor}
\DeclareFieldAlias{hdl}{eprint:hdl}
\DeclareFieldAlias{pubmed}{eprint:pubmed}
\DeclareFieldAlias{googlebooks}{eprint:googlebooks}

biblatexиспользует eprintbibmacro для печати информации eprint, поэтому мы просто добавляем туда наши новые типы

\renewbibmacro*{eprint}{%
  \printfield{arxiv}%
  \newunit\newblock
  \printfield{jstor}%
  \newunit\newblock
  \printfield{mr}%
  \newunit\newblock
  \printfield{zbl}%
  \newunit\newblock
  \printfield{hdl}%
  \newunit\newblock
  \printfield{pubmed}%
  \newunit\newblock
  \printfield{pmcid}%
  \newunit\newblock
  \printfield{googlebooks}%
  \newunit\newblock
  \iffieldundef{eprinttype}
    {\printfield{eprint}}
    {\printfield[eprint:\strfield{eprinttype}]{eprint}}}

МВЭ

\documentclass[a4paper,12pt]{article}%
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{filecontents}

\begin{filecontents*}{ext-eprint.dbx}
\ProvidesFile{ext-eprint.dbx}[2016/09/11 extended stand-alone eprint fields]
\DeclareDatamodelFields[type=field,datatype=verbatim]{arxiv,mr,zbl,jstor,hdl,pubmed,googlebooks,pmcid}
\DeclareDatamodelEntryfields{arxiv,mr,zbl,jstor,hdl,pubmed,googlebooks,pmcid}
\DeclareDatamodelFields[type=field,datatype=literal]{arxivclass}
\DeclareDatamodelEntryfields{arxivclass}
\end{filecontents*}

\begin{filecontents*}{\jobname.bib}
@article{ContEp,
  author        = {Mark G. Frei and Hitten P. Zaveri and Susan Arthurs and Gregory K. Bergey and Christophe Jouny and Klaus Lehnertz and Jean Gotman and Ivan Osorio and Theoden I. Netoff and Walter J. Freeman and John Jefferys and Gregory Worrell and Michel Le Van Quyen and Steven J. Schiff and Florian Mormannn},
  title         = {Controversies in epilepsy},
  subtitle      = {Debates held during the Fourth International Workshop on Seizure Prediction},
  journaltitle  = {Epilepsy \& Behavior},
  volume        = {19},
  number        = {1},
  pages         = {4-16},
  date          = {2010-09},
  doi           = {10.1016/j.yebeh.2010.06.009},
  pmcid         = {PMC2943379},
  pmid          = {20708976},
}
@article{frege,
  author        = {Gottlob Frege},
  title         = {The Thought},
  subtitle      = {A Logical Inquiry},
  journaltitle  = {Mind},
  series        = {newseries},
  volume        = {65},
  number        = {259},
  jstor         = {2251513},
  date          = {1956-07},
  pages         = {289-311},
}
@online{hawking,
  author      = {S. W. Hawking},
  title       = {Information Preservation and Weather Forecasting for Black Holes},
  arxiv       = {1401.5761},
  arxivclass  = {hep-th},
  date        = {2014-01-22},
}
@online{albar,
  author  = {B. Albar and D. Gon{\c c}alves},
  title   = {On triangles in $K_r$-minor free graphs},
  arxiv   = {1304.5468},
  year    = 2013,
}
@article{kawa,
  author    = {Ken-ichi Kawarabayashi and Zi-Xia Song},
  title     = {Independence number and clique minors},
  journal   = {J. Graph Theory},
  volume    = 56,
  number    = 3,
  pages     = {219-226},
  year      = 2007,
  doi       = {10.1002/jgt.20268},
  mr        = {2355127},
}

@article{kostochka,
  author    = {A. V. Kostochka},
  title     = {On the minimum of the Hadwiger number for graphs with given mean degree of vertices},
  journal   = {Metody Diskretn. Anal.},
  volume    = {38},
  pages     = {37--58},
  year      = {1982},
  mr        = {0713722},
  zbl       = {0544.05037},
}
\end{filecontents*}

\usepackage[backend=biber, style=authoryear-icomp, dashed=true, datamodel=ext-eprint]{biblatex}
\usepackage{hyperref}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}


\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map{
      \step[fieldsource=pmid, fieldtarget=pubmed]
    }
  }
}

\makeatletter
\DeclareFieldFormat{arxiv}{%
  arXiv\addcolon\space
  \ifhyperref
    {\href{http://arxiv.org/\abx@arxivpath/#1}{%
       \nolinkurl{#1}%
       \iffieldundef{arxivclass}
         {}
         {\addspace\texttt{\mkbibbrackets{\thefield{arxivclass}}}}}}
    {\nolinkurl{#1}
     \iffieldundef{arxivclass}
       {}
       {\addspace\texttt{\mkbibbrackets{\thefield{arxivclass}}}}}}
\makeatother
\DeclareFieldFormat{pmcid}{%
  PMCID\addcolon\space
  \ifhyperref
    {\href{http://www.ncbi.nlm.nih.gov/pmc/articles/#1}{\nolinkurl{#1}}}
    {\nolinkurl{#1}}}
\DeclareFieldFormat{mr}{%
  MR\addcolon\space
  \ifhyperref
    {\href{http://www.ams.org/mathscinet-getitem?mr=MR#1}{\nolinkurl{#1}}}
    {\nolinkurl{#1}}}
\DeclareFieldFormat{zbl}{%
  Zbl\addcolon\space
  \ifhyperref
    {\href{http://zbmath.org/?q=an:#1}{\nolinkurl{#1}}}
    {\nolinkurl{#1}}}
\DeclareFieldAlias{jstor}{eprint:jstor}
\DeclareFieldAlias{hdl}{eprint:hdl}
\DeclareFieldAlias{pubmed}{eprint:pubmed}
\DeclareFieldAlias{googlebooks}{eprint:googlebooks}

\renewbibmacro*{eprint}{%
  \printfield{arxiv}%
  \newunit\newblock
  \printfield{jstor}%
  \newunit\newblock
  \printfield{mr}%
  \newunit\newblock
  \printfield{zbl}%
  \newunit\newblock
  \printfield{hdl}%
  \newunit\newblock
  \printfield{pubmed}%
  \newunit\newblock
  \printfield{pmcid}%
  \newunit\newblock
  \printfield{googlebooks}%
  \newunit\newblock
  \iffieldundef{eprinttype}
    {\printfield{eprint}}
    {\printfield[eprint:\strfield{eprinttype}]{eprint}}}


\begin{document}
  \nocite{baez/online,wassenberg,hawking,albar,kawa,kostochka,frege,ContEp}
  \printbibliography
\end{document}

введите описание изображения здесь

* В biblatexдокументации рекомендуется загружать \DeclareDatamodelFieldsи \DeclareDatamodelEntryfieldsво внешний файл модели данных, но это работает и в самом документе. См. §4.5.3Спецификация модели данныхпринадлежащийbiblatexдокументация. Начиная с версии 2.9, \DeclareDatamodel...команды должны быть вынесены в .dbxфайл. См.Макрос модели данных нельзя использовать в преамбуле.

решение2

Такого рода пользовательские изменения форматирования легко осуществимы с помощью недавно разработанного проекта Bibulous (http://nzhagen.github.io/bibulous/). Для примера ОП у нас есть файл базы данных

@arxiv{one,
  author = {B. Albar and D. Gon{\c c}alves},
  title = "{On triangles in K\_r-minor free graphs}",
  eprint = {1304.5468},
  year = 2013
}

@article{two,
  author = {Ken-ichi Kawarabayashi and Zi-Xia Song},
  title = {Independence number and clique minors},
  journal = {J. Graph Theory},
  volume = 56,
  number = 3,
  pages = {219-226},
  year = 2007,
  doi = {10.1002/jgt.20268},
  mr = {2355127}
}

@article{three,
  author = {A. V. Kostochka},
  title = {On the minimum of the Hadwiger number for graphs with given mean degree of vertices},
  journal = {Metody Diskretn. Anal.},
  volume = {38},
  pages = {37--58},
  year = {1982},
  mr = {0713722},
  zbl = {0544.05037}
}

Для этих записей базы данных мы можем создать настраиваемый шаблон, который использует поля zbl, mr, doiи eprintследующим образом:

TEMPLATES:
arxiv = <au>. <title>. <year>. arXiv: \href{http://arxiv.org/abs/<eprint>}{<eprint>}.
article = <au>. <title>. <journal>, <volume>[(<number>)]:[<startpage>--<endpage>|<startpage>|<eid>|], <year>.[ doi: \href{http://dx.doi.org/<doi>}{<doi>}.][ MR: \href{http://www.ams.org/mathscinet-getitem?mr=MR<mr>}{<mr>}.][ Zbl: \href{http://zbmath.org/?q=an:<zbl>}{<zbl>}.]

Обратите внимание, что приведенный выше фрагмент на самом деле является полным файлом шаблона стиля. Используя следующий основной файл LaTeX

\documentclass{article}
\usepackage[colorlinks=True,urlcolor=blue,citecolor=blue,breaklinks=true]{hyperref}

\begin{document}
\nocite{one,two,three}
\bibliographystyle{mybst}
\bibliography{mybib}
\end{document}

мы получаем отформатированный список литературы, запрошенный ОП:

введите описание изображения здесь

Связанный контент