How to embed Altimetric (or Researcher ID) badges in a TeX document?

In other words, how to make use of the following html code to generate the badges in a TeX document?:

<div data-badge-popover="right" data-badge-type="medium-donut" data-doi="10.1038/nature.2014.14583" data-hide-no-mentions="true" class="altmetric-embed"></div>

  • that html in itself doesn't have any output, presumably you have some javascript that looks for the custom data-badge-type attribute and inserts an image. If those images are freely available you could include them into tex. – David Carlisle Sep 17 '18 at 13:40
  • @David Thanks! As you pointed out the embedding in a html page follows two steps (api.altmetric.com/embeds.html), using a java script and the above div element. I can always generate the images and insert them in TeX. But since the contents of the badge are not static, the images would have to be generated each time the TeX is compiled. Is it possible to do this automatically in TeX, so that the hassle of manual image generation is done away with? – Devaraj-G Sep 17 '18 at 18:11
  • the code you posted literally does nothing, it could just be <div zz="wibble"></div> the html has no text and has some non standard attributes with some values that by default do nothing, so any image that is produced is the result of some code (that doesn't appear to be freely available) that looks for those fixed strings and generates an image. you can use wget or curl or any other http program and fetch images such as badges.altmetric.com/?size=128&score=300&types=mbttttfg then include the result in tex, some external scripting before calling tex should be all you need – David Carlisle Sep 17 '18 at 18:30

Your Answer

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

Browse other questions tagged or ask your own question.