From 5d02e478d0524cee52991740ffdf0ee87296b5d4 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Mon, 31 Oct 2016 22:04:22 +0100 Subject: LaTeX reader: allow for []s inside LaTeX optional args. Fixes cases like: \begin{center} \begin{tikzpicture}[baseline={([yshift=+-.5ex]current bounding box.center)}, level distance=24pt] \Tree [.{S} [.NP John\index{i} ] [.VP [.V likes ] [.NP himself\index{i,*j} ]]] \end{tikzpicture} \end{center} --- src/Text/Pandoc/Readers/LaTeX.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/Text') diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs index cb6b183f9..d35bf5182 100644 --- a/src/Text/Pandoc/Readers/LaTeX.hs +++ b/src/Text/Pandoc/Readers/LaTeX.hs @@ -861,7 +861,8 @@ opt = bracketed inline rawopt :: LP String rawopt = do - contents <- bracketed (many1 (noneOf "]") <|> try (string "\\]")) + contents <- bracketed (many1 (noneOf "[]") <|> try (string "\\]") <|> + try (string "\\[") <|> rawopt) optional sp return $ "[" ++ contents ++ "]" -- cgit v1.2.3