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}
This commit is contained in:
John MacFarlane 2016-10-31 22:04:22 +01:00
parent 4f06e6c445
commit 5d02e478d0

View file

@ -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 ++ "]"