I am having difficulty with bibliography citations in HTML export. I am able to generate two html files with citations, one from the standard html export from an org file, and another from exporting the org file to latex then compiling it with bibtex, again with latex, then with latex2html. However the latex converted html file is not how I would like so now I am doing some post-processing to combine the two files. I just want to replace the citations in the standard org html export with the citations in the latex2html export file.

What I have been trying to do now is swap out the content inside all of the

tags from the latex exported html file to the other using emacs.

I have played with using (libxml-parse-html-region (point-min) (point-max)), which creates an output like this:

 (body nil "\n\n"
        (h1 nil "Sample HTML")
        (p nil "Once upon a time... blab blab.")
        (p nil "large text of other things here... ")
        (p nil "more complex non Q and A HTML code here.\ntest\n")
        (h2 nil "Questions and Answers")
         ((class . "q"))
         "Q: How Why What is this and that ...?")
         ((class . "a"))

However I am not sure how to access, change, and swap the values between the two files. I'm not finding anything on the internet how to do that.

I want to swap these citations. org html export makes incorrect formatted citations

<p> ...pri  [<a href="#article">Adams</a>].</p>

latex2html output correctly makes the citation

<p class="noindent" >ntegre inermis (<a href="#Xarticle">Adams</a>,&#x00A0;<a href="#Xarticle">1993</a>) V...ri stet omnes</p>

Notice how the latex2html citation is the correct format. The org-export citation has a "[Author]" around all of them. There is other stuff in the org latex export file that I want though and the latex2html puts in a lot of other stuff I don't want. Thanks in advance.

  • "However the latex converted html file is not how I would like..." Can you show a before and after example. Finding answers becomes easier with specifics.
    – Emacs User
    Commented Jun 5, 2016 at 12:54
  • org to html export: <p>, et nam eirmod aeterno Sea ea possim aperiam dissentias, est ei unum minim. Ullum iudico officiis id pri [<a href="#article">Adams</a>] . </p> This is the latex2html output: <p class="noindent" > per. Has natum tritani ad, eu liber patrioque est, mea eros idque omittam at. Option placerat senserit et sed. Pri saepe placerat ad, vel lorem albucius id, nec eu simul integre inermis (<a href="#Xarticle">Adams</a>,&#x00A0;<a href="#Xarticle">1993</a>) </p> Commented Jun 5, 2016 at 15:36
  • Not helpful at all. Please re-format or add to your question above.
    – Emacs User
    Commented Jun 5, 2016 at 16:10
  • Sorry about that. I edited the post to show the tags I want to swap from one html file to another. I am trying to copy all the tags wth <p> ...content..</p> from the latex2html html output to the org-html output. I'm not sure how I would access and loop through the parsed files and swap them out. Thanks, sorry for posting the code in the comment. If there anything else I can add to clarify, please let me know. Commented Jun 6, 2016 at 8:32
  • 1
    I agree with the previous commenters, we need better examples. Do I take it that you want to search in your org2html file for the #article reference, get the Adams name, switch to the latext2html file, find the Adams citation, then copy the citation to the org2html file, then find the next #article and repeat? If so, and if the files are sufficiently structured, then you should be able to do this with a keyboard macro.
    – icarus
    Commented Oct 19, 2016 at 2:31

1 Answer 1


It looks like I will have to export my org file as an HTML buffer, then export my org file to latex, then run bibtex, latex, and latex2html, then open the html file and copy the paragraphs with in text citations over to the html buffer. I was trying to automate that process.

It looks like I will just need to export to html then go through and edit the HTML by hand and remove the [author] citations and replace them with the correct in-text citations, each time I export the file to HTML.

Unless there is an upgrade to ox-bibtex that allows for it to export the \citet and \citep \citeauthor \citeyear, etc. citations.

I'm not sure how to make this any more clear. ox-bibtex reads only \cite{key} citations and exports them all as "[author]"

latex2html generates the correct in-text citations but I lose some html content I put in the org file when I export it to latex.

I wanted to extract the in-text citations from the latex2html html file and put them in the html file exported from my org file.

  • Sounds like you fell into the XY Problem trap. I'd recommend you ask instead something like: "Is there a way to export \citet, \citep, \citeyear, etc., citations to nicely formatted HTML? ox-bibtex only seems to handle plain \cite."
    – Omar
    Commented Aug 15, 2017 at 18:47
  • Good point. Thank you. I must have been caught up in it and went too far into a work around that it didn't make sense. It looks like there was a way through to do it with latex2html but it required an extra processing step I wanted to automate. Perhaps I could communicate with the developer of ox-bibtex about it. Commented Sep 16, 2017 at 1:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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