0

Assume a text file including simple bibtex entries like

@incollection{einstein2013einstein,
  title={Einstein on politics},
  author={Einstein, Albert},
  booktitle={Einstein on Politics},
  year={2013},
  publisher={Princeton University Press}
}

@book{barnett2005universe,
  title={The Universe and Dr. Einstein},
  author={Barnett, Lincoln and Einstein, Albert},
  year={2005},
  publisher={Courier Corporation}
}

In an HTML file, I have a word "Reference" as a link. Once it is clicked, the content of entry associated with a key, e.g., einstein2013einstein, has to be shown in a box.

1- How can I access the entry corresponding to a key in the target HTML file?

2- I know how to make a box hovering, but as the user may want copy the bibtex entry of the "Reference" Link, the box should remain where it is after clicking on "Reference", until the user clicks anywhere on the page except the box after which the box needs to disappear. How can I achieve that?

Thanks

Mister Jojo
  • 20,093
  • 6
  • 21
  • 40
User
  • 952
  • 2
  • 21
  • 43
  • I don't get your question - how is html supposed to understand/use BibTeX? If you use some add-on or library like `bibtex.js`, please specify that, it's highly relevant. – kikon Sep 17 '22 at 08:12
  • @kikon: I don't have any add-on. My simple idea was to put each bibtex entry into a div tag and try to fetch the content of the div I want based on its ID in the target HTML file. But I thought there might be a more clever way to do it. – User Sep 17 '22 at 08:14
  • @kikon: Please note that I don't expect HTML to parse bibtex entries, but just printing them as they are. – User Sep 17 '22 at 08:18
  • you can't use BibTeX directly in html - you need some tool or code to transform to html format so it can be shown in browsers. – kikon Sep 17 '22 at 08:19
  • then, you should treat it as a text file (still, even separating entries amounts to some parsing). See [this post](https://stackoverflow.com/questions/6348207/making-a-paragraph-in-html-contain-a-text-from-a-file) – kikon Sep 17 '22 at 08:21
  • @kikon: "separating the entries" is exactly what I have asked in this question. – User Sep 17 '22 at 08:24
  • The maximum you can do with pure html is to rename your file as .txt (say bibtex.txt) and include it in the manner described in the post I mentioned ``. For even separating BibTeX entries you'll need to chose some technology that bridges the gap between the two worlds (TeX and web) and start from there. – kikon Sep 17 '22 at 08:53
  • Your solution prints the whole file which is not what I need. Obviously there are possible technologies to do so, yet I am not that much experienced in web development to pursue them, thus asking this question. Anyway, thanks for your comments. – User Sep 17 '22 at 08:57
  • 1
    [bibtex.js](https://github.com/pcooksey/bibtex-js/wiki) is pretty simple and adding it to your website seems straightforward - I never used it myself though. – kikon Sep 17 '22 at 09:01
  • have a look to https://tex.stackexchange.com/questions/268294/convert-existing-bibtex-to-bibjson – Mister Jojo Sep 17 '22 at 10:19

0 Answers0