The doi resolver doi.org can return json output using the Accept: application/json
header. You can parse this output for example with Python and extract the relevant fields. Then you can write this content to a file which you can include as part of your LaTeX document.
Part of the json output looks as follows for the paper in the question:
"resource": {
"primary": {
"URL": "https://www.ams.org/tran/2021-374-01/S0002-9947-2020-08044-1/"
}
},
"subtitle": [],
"short-title": [],
"issued": {
"date-parts": [
[
2020,
11,
3
]
]
},
"references-count": 62,
"journal-issue": {
"issue": "1",
"published-print": {
"date-parts": [
[
2021,
1
]
]
}
},
"alternative-id": [
"S0002-9947-2020-08044-1"
],
"URL": "http://dx.doi.org/10.1090/tran/8044",
"relation": {},
"ISSN": [
"0002-9947",
"1088-6850"
],
"subject": [
"Applied Mathematics",
"General Mathematics"
],
"container-title-short": "Trans. Amer. Math. Soc.",
"published": {
"date-parts": [
[
2020,
11,
3
]
]
}
This already contains most of the information that was mentioned in the question and the comments.
Small Python script using pycurl
to retrieve the data:
import pycurl
from io import BytesIO
import json
import calendar
doi = '10.1090/tran/8044'
# download json using pycurl
mybuffer = BytesIO()
c = pycurl.Curl()
c.setopt(c.URL, 'http://dx.doi.org/'+doi)
c.setopt(c.FOLLOWLOCATION, True)
c.setopt(c.HTTPHEADER, ["Accept: application/json"])
c.setopt(c.WRITEDATA, mybuffer)
c.perform()
c.close()
# parse with json library
contents = mybuffer.getvalue()
bib_dict = json.loads(contents)
# open file to be included by LaTeX
texout = open("paperinfo.tex", "w")
# start a verbatim environment to prevent problems with special characters
print("\\begin{verbatim}", file=texout)
# retrieve relevant fields from json output
print("doi:", doi, file=texout)
print("URL:", bib_dict['resource']['primary']['URL'], file=texout)
print("URL:", bib_dict['resource']['primary']['URL'], file=texout)
print("authors:", file=texout)
for person in bib_dict["author"]:
print(person['given'], person['family'], file=texout)
print("Published date:", calendar.month_name[bib_dict['published']['date-parts'][0][1]], str(bib_dict['published']['date-parts'][0][2])+",", bib_dict['published']['date-parts'][0][0], file=texout)
# end the verbatim environment and close the file
print("\\end{verbatim}", file=texout)
texout.close()
Resulting paperinfo.tex
:
\begin{verbatim}
doi: 10.1090/tran/8044
URL: https://www.ams.org/tran/2021-374-01/S0002-9947-2020-08044-1/
URL: https://www.ams.org/tran/2021-374-01/S0002-9947-2020-08044-1/
authors:
Anand Dessai
David González-Álvaro
Published date: November 3, 2020
\end{verbatim}
Show this file in a complete LaTeX document:
\documentclass{article}
\begin{document}
\input{paperinfo}
\end{document}
Resulting pdf:

Note: the workflow is a two-step process: first you manually run the Python script, this will create the file paperinfo.tex
, and then you run LaTeX manually on the file that needs to have the information included.
https://doi.org/
, such ashttps://doi.org/10.1090/tran/8044
, you will get the right url. As for how LaTeX handles network-related content, I don't know about it. Maybe you can try an external program or use Lua?