Helping someone get started with Emacs and Org Mode through Org2Blog and LaTeX; troubleshooting steps

Update 2013-08-30: By the way, here’s the link to Christopher Olah’s first post using org2blog. Neato!

The LaTeX logo, typeset with LaTeX

The LaTeX logo, typeset with LaTeX (Photo credit: Wikipedia)

Org2Blog is an awesome geek-friendly way of writing posts and publishing them to a WordPress-based blog. When Christopher Olah told me that he’d gotten convinced to try Org Mode thanks to the enthusiastic recommendations from Michael Nielsen and me, we figured that getting him sorted out with taking notes in Org and publishing them through Org2Blog to his WordPress.com-hosted blog would be an excellent way to start – especially with inline images and LaTeX.

Chris has promised to write a blog post about what he’s learned, but he’ll probably find these notes useful. Here’s what we ran into when getting org2blog working on Ubuntu.

Need to install the files and set up the load paths

We downloaded the following and added them to an ~/.elisp directory

We also set up his ~/.init.d/emacs.el to load the libraries, set the blog list, and load ido-mode and icomplete-mode.

Emacs / Org too old

Metaweblog and Org2blog didn’t work well with Emacs 23 and Org 6. We upgraded to Emacs 24 with apt-get install emacs24 in order to get Org 7.

Can’t find library org

It turns out that you also need to apt-get install emacs24-el in order to include those libraries.

Org still too old for org2blog

We were having some problems with the version detection of org2blog, so we replaced the org2blog he downloaded with the version I forked at https://github.com/sachac/org2blog , which I’ve been using with Org 7.

Then we tested it with org2blog/wp-post-subtree, and that worked. Inline images with org-toggle-inline-images worked too, yay!

Next step: viewing LaTeX fragments, since Chris does a lot of math.

dvipng required

org-preview-latex-fragment wanted dvipng to be installed, so we apt-get install dvipng.

LaTeX fragment preview showed blank images

We looked at the *Messages* buffer and found that the .tex files in /tmp could not be rendered by dvipng because marvosym.sty could not be found. We fixed that with apt-get install texlive-fonts-recommended.

(Doing this on my own, I found that I also needed apt-get install texlive-latex-extra .)

… and then we could see and publish LaTeX fragments, which was awesome. =D

WordPress.com double-interpreted LaTeX fragments

Chris was having problems with LaTeX fragments when org-export-with-LaTeX-fragments was set to dvipng. It turns out that WordPress.com also interprets LaTeX, so it was getting confused by the alt tags. To solve this, use M-x customize org-export-with-LaTeX-fragmentsand choose Leave math verbatim. Then the LaTeX fragments are passed to WordPress, which renders them as PNGs.

Hope that helps!
  • PhilM

    emacs24 with org8 (which need for reveal.js), doesn’t work with org2blog. Why does org2blog require org7.7 so badly?

    Any ideas?

    • http://sachachua.com Sacha Chua

      Could you try the latest org2blog from punchagan’s github? I think that one works with Org 8.

    • greg nwosu

      dude this was painful it is nearly 6am and i just cracked it, sometimes elpa gets out of whack and you gotta let elpa build it from the ground up

      i backed up my .emacs file and list-packages , removed xml-rpc org2blog org metablog

      i cleared out everything in a new .emacs other than the lines to set up and intialise melpa

      then i installed org2blog only

      elpa ripped through the dependencies getting the right version and reinstalled org automagically

      then i restored my .emacs file to bring everything back to normal

      not sure what versions ive installed or whether its too much anyway i managed my first blog post which funnily enough is a reminder how to recreate my emacs blogging environment

      http://gregnwosu.wordpress.com/2014/01/03/setting-up-my-blogging-environment/

      • http://sachachua.com sachac

        Ooh, packages would make it much better, of course. Thanks for sharing!

  • Pingback: org2blog | food(8) for thought

  • Pingback: Setting up my blogging environment | real time neural networks in haskell

  • textish

    Sorry this is slightly off-topic, but being an emacs-neophyte, this looks like a very safe place to ask (something that has the potential to be) ridiculous questions.

    I’m using org2blog, and I have a section of code that I’m including, using #+BEGIN_SRC / #+END_SRC. While technically working, the exporter is including the #+BEGIN_SRC & #+END_SRC, which leads me to my battle (and baffles).

    After scouring the entirety of the Internet, the only thing useful I found is here: http://stackoverflow.com/questions/20194347/org-mode-with-code-example-as-html

    But first, I only understand bits and pieces of how/why that should help (if I put the example alone in an empty buffer, then export to HTML, it does work) and unlike the example, I’m using a block of “org”-styled code.

    I’ve been told that this shouldn’t be happening, and that C-c C-e t should insert a default options template (this command appears to be export to ASCII?!) that might help enlighten me.

    I’m so terribly confused. Digging through the manual and staring at the many, many options for the exporter has only troubled matters further, I’m afraid. I’ve successfully hidden the #+BEGIN_SRC through the use of :noexport: only to have #+END_SRC show up anyway.

    Any ideas? I’d really like to thoroughly understand how to control the output of these tags in a concise way, other than hacking together some absolutely crazy solution.

    • http://sachachua.com sachac

      Hmm, that’s weird. Would you mind pasting your Org code (or a suitably sanitized version thereof) into gist.github.com or pastebin or a similar service? You can pick a spot on my calendar (sach.ac/meet) for a real-time chat, too.