Skip to content

Flirting with TeX

February 21, 2011

I love the idea of TeX, I really do. However, when I try using it I am always met with frustration and obstacles.

My latest frustration has come with using Emacs to author my prospectus. I’ve been using org-mode (which, has been awesome through and through), but when trying some quick latex exports, my unicode characters are absent.

Exporting the raw tex and compiling it myself reveals the problem, tex/latex don’t handle unicode input well at all and complains about the characters. I did some searching and the only answers I could find were to a) Use pure ASCII tex files or b) use xelatex. However, while xelatex doesn’t complain about unicode input, it doesn’t output it well at all. The inputenc package does give me errors about “not a keyboard character”, but not using it gives me the wrong characters.

I ended up just going through and switching all my unicode characters to their proper TeX escape sequences, but I wanted to avoid this. Then again, the only way I could get sub/super scripts was to use the latex escape sequences, so perhaps this won’t be so bad, but only because org-mode can pretty print them…

On a side note: Document types. Switching to “achemso” seems to require the \title, \author, etc tags to be before the \begin statement, which at the moment requires me to edit them manually after export. There might be a way to make a custom latex export function or something in Emacs, but at the moment I’m burnt out on tex formatting (which is why I love org-mode at this moment, whatever I do I can worry about formatting later, all my writing is neatly packed in enough info that I can export it to whatever I need to if anything goes wrong)

Addendum: I’m mid-prospectus (just shy of a draft) and have learned a few things.

1) The newest version of org-mode (7.5) does not play as nice with the pretty-printed latex sequences. Trying to edit them or append text after them (mostly with sub/super script) puts the text into the superscript and litters my file with unseen “^{}” sequences. I have since turned the pretty printing off. I will probably file a bug after this is all over

2) I don’t know how/why/whatever, but after switching from the pdflatex to just plain latex command (I need it for auto-pst magic) stops any trouble I had with characters.  After the switch, I noticed I had a slew of unicode characters being inserted from my bibtex file, and latex with inputenc handled them fine.

3) As much as I tried to avoid it while writing the initial draft, I did need to use some raw LaTeX sequences in my documents, and I have found http://en.wikibooks.org/wiki/LaTeX to the be the greatest resource I have found for LaTeX. It definitely helps me make sense of it and get less frustrated with it.

Also, the chemstyle, chemscheme, and mhchem packages are really cool. I’ve also used chemscheme to make my labmates jealous about what their word processors can’t do (and to justify the headaches I’ve given myself with LaTeX…)

Advertisements

From → Anecdotes

2 Comments
  1. Hendy permalink

    I found your site via the Arch btrfs install post and saw this post in the recent section. As I read along I was thinking of suggesting since it removes most of the LaTeX headache… and then you mentioned it! Hilarious. I use org-mode for all my work notes and various other writings I’ve done. It’s fantastic. Only for crazily complicated things like a picture-filled directory for work which used a lot of TikZ and functions do I use raw LaTeX.

  2. Haha yeah, org-mode is pretty awesome :D After writing piles of papers before in a slew of different word processors, I have to say even with the LaTeX annoyances (which are probably mostly due to inexperience) this is still much more manageable.

    On the plus side, when I _do_ get LaTeX working, my output looks amazing (I’ve got my lab jealous of what I can do with it ;])

    I’ll have to update this post, but basically, between references/bibliography and a few awesome chemistry LaTeX packages I found, I need to edit the TeX ouput from org-mode and compile it by hand anyways, and while not as nice as a quick ‘C-c C-e d’ and seeing a nice pdf, it isn’t that bad. I’ll probably make a custom export function and custom org-mode document class to do all that when I have the time :P

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s