git.iko.soy/typeable/pandoc
on master help sign in
Added subscript and superscript support to LaTeX reader.
3ca9932fiddlosopher
src/Text/Pandoc/Readers/LaTeX.hs+14−1
@@ -378,7 +378,8 @@ comment = try (do
378-- inline
378-- inline
379--
379--
380
380
381+inline = choice [ strong, emph, strikeout, superscript, subscript,
381−inline = choice [ strong, emph, strikeout, ref, lab, code, linebreak, spacer,
382+ ref, lab, code, linebreak, spacer,
382 math, ellipses, emDash, enDash, hyphen, quoted, apostrophe,
383 math, ellipses, emDash, enDash, hyphen, quoted, apostrophe,
383 accentedChar, specialChar, specialInline, escapedChar,
384 accentedChar, specialChar, specialInline, escapedChar,
384 unescapedChar, str, endline, whitespace ] <?> "inline"
385 unescapedChar, str, endline, whitespace ] <?> "inline"
@@ -522,6 +523,18 @@ strikeout = try $ do
522 result <- manyTill inline (char '}')
523 result <- manyTill inline (char '}')
523 return (Strikeout result)
524 return (Strikeout result)
524
525
526+superscript = try $ do
527+ string "\\textsuperscript{"
528+ result <- manyTill inline (char '}')
529+ return (Superscript result)
530+
531+-- note: \textsubscript isn't a standard latex command, but we use
532+-- a defined version in pandoc.
533+subscript = try $ do
534+ string "\\textsubscript{"
535+ result <- manyTill inline (char '}')
536+ return (Subscript result)
537+
525apostrophe = do
538apostrophe = do
526 char '\''
539 char '\''
527 return Apostrophe
540 return Apostrophe