1

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")
        "\n\n"
        (p nil "Once upon a time... blab blab.")
        "\n\n"
        (p nil "large text of other things here... ")
        "\n\n"
        (p nil "more complex non Q and A HTML code here.\ntest\n")
        "\n\n"
        (h2 nil "Questions and Answers")
        "\n\n"
        (p
         ((class . "q"))
         "Q: How Why What is this and that ...?")
        "\n"
        (p
         ((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 Jun 5 '16 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> – Dan Boice Jun 5 '16 at 15:36
  • Not helpful at all. Please re-format or add to your question above. – Emacs User Jun 5 '16 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. – Dan Boice Jun 6 '16 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 Oct 19 '16 at 2:31
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 Aug 15 '17 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. – Dan Boice Sep 16 '17 at 1:32

Your Answer

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

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