jgm/pandoc — pull request #1148 by wilx (2014-02-10 08:23:19+00:00)
Title: src/Text/Pandoc/Writers/LaTeX.hs: Use \texorpdfstring for section captions.

This patch makes use of `\texorpdfstring{TeX string}{PDF string}` to avoid artifacts like these in PDF TOC:

![artifact](http://i.imgur.com/KpcinU1.png?1)

The `!` comes from `\subsection{\lstinline!--enable-debugging!}` which is generated for Markdown's

~~~~
# `--enable-debugging`
~~~~

There is a room for improvement. I have tried to avoid using `\texorpdfstring` when the undecorated and decorated strings were the same but I apparently do not know enough Haskell to make it work.

I have tried compiling the resulting LaTeX source both using plain `latex` and with `lualatex` with success.