Home > Data Integration > Converting a Latex Thesis to Multiple WordPress Posts

Converting a Latex Thesis to Multiple WordPress Posts

A few months ago I finished my thesis, passed my viva and then submitted the hardbound copies to the library, and all was right with the world. However, after a few weeks I realised that I only had my thesis in either PDF form, which is very hard to read, and in Latex, which is unintelligible to people who don’t know how to use it. Therefore, with the kind permission of Phil Lord, I am trying out his latex to wordpress software which he and others have been developing for use with the various knowledgeblogs.

The output of this conversion work is now available here. The thesis was separated into chapters or sections (depending on size) and posted individually. You can get them all in one place via the “thesis” tag in each of the posts or via the list below. Alternatively, you can download the human friendly (but computer unfriendly) PDF version of the thesis.

Thesis Posts

Current limitations of the conversion

There are a few things that aren’t quite right with the conversion at the minute. These were fixed through manual changes to the resulting HTML.

  1. The URLs in the bibliography sections were not being displayed automatically.
  2. The footnotes were created in the main text but not displayed at the end of the text. This will not be fixed programmatically as it is too awkward – they are just in the text as “(Note: [...])” instead.

Technical Conversion Details

Please only read this section if you’re interested in a similar conversion process using the knowledgeblogs code.

This code is still in development, so it isn’t easy for someone not familiar with Make to understand. However, if you have a working knowledge of how makefiles work, then please read on.

  1. First, you need to check out the knowledgeblog codebase. You can use mercurial to check out the project at http://code.google.com/p/knowledgeblog/. The code can be found in the trunk/tooling/latextowordpress subdirectory.
  2. You need to install plastex. If you’re running Ubuntu or similar this can be done with the standard sudo apt-get install python-plastex command.
  3. Everything runs using the Makefile available in the latextowordpress directory. Test that things are OK by running the make simple_test command.
  4. Make a directory to store your .tex file input (and put your tex files in there) and another directory to store your HTML output.
  5. Comment out (e.g. use a “##” at the beginning of the line) the self['cite'] = self.do_cite line in knowledgeblog/wordpress/__init__.py within the latextowordpress directory.
  6. There are a few changes you may need to make to your tex file prior to compiling it and running the makefile. Ensure your tex file is a complete document (and not included in a parent document, for example). You need those \begin{document} [...] \end{document} tags in the file. I also add the following line at the very top to sort out the problem with footnotes: \newcommand{\footnot}[1]{ (Note: \textit{#1})}. Then I can do a global search and replace for “\footnote” and replace it with “\footnot”, ensuring that footnotes are present, even if not visually ideal. Finally, ensure you add your bibliography tags to the end of the file if you don’t already have them (e.g. if the are normally in a parent tex document). I also had to replace “compactitem” references with “itemize”, as I didn’t want to include the package. You may have similar replacements to make.
  7. You’ll need to run your normal latex/pdflatex command that you would run to compile your latex code. This will do things like create a .bbl file for latextowordpress to make use of when generating the HTML.
  8. Add a new command within your Makefile to ensure that your tex files are being converted, and run that command. As an example, here is my new rule within the makefile (make sure that your tabs are correct!):
    my_thesis :
    $(LTWP) -d ‘thesis-output’ tex-files/Abstract.tex
  9. Once you have your html file, you’ll notice that for internal hrefs (here, just for citations), a full url rather than a local url. You’ll have to do a global search-and-replace to make sure those appear correctly. For example, replace “Abstract.html#Smith2000″ with “#Smith2000″ by removing all references to “Abstract.html”.
  10. Create a new wordpress post, and put the HTML into the post. Upload images for any figures to wordpress.
  11. I manually added “Previous” and “Next” links to each post.
About these ads
You must be logged in to post a comment.
Follow

Get every new post delivered to your Inbox.

Join 493 other followers

%d bloggers like this: