git.iko.soy/typeable/pandoc
on master help sign in
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}

commit5d02e478d0524cee52991740ffdf0ee87296b5d4 authorJohn MacFarlane <jgm@berkeley.edu> dateMon 31 Oct 2016, 22:04 (10 years ago) parent4f06e6c
1 file changed+2−1
src/Text/Pandoc/Readers/LaTeX.hs+2−1
src/Text/Pandoc/Readers/LaTeX.hs+2−1
@@ -861,7 +861,8 @@ opt = bracketed inline
861861
862862rawopt :: LP String
863863rawopt = do
864− contents <- bracketed (many1 (noneOf "]") <|> try (string "\\]"))
864+ contents <- bracketed (many1 (noneOf "[]") <|> try (string "\\]") <|>
865+ try (string "\\[") <|> rawopt)
865866 optional sp
866867 return $ "[" ++ contents ++ "]"
867868