Wolfram Language Paclet Repository

Community-contributed installable additions to the Wolfram Language

Primary Navigation

    • Cloud & Deployment
    • Core Language & Structure
    • Data Manipulation & Analysis
    • Engineering Data & Computation
    • External Interfaces & Connections
    • Financial Data & Computation
    • Geographic Data & Computation
    • Geometry
    • Graphs & Networks
    • Higher Mathematical Computation
    • Images
    • Knowledge Representation & Natural Language
    • Machine Learning
    • Notebook Documents & Presentation
    • Scientific and Medical Data & Computation
    • Social, Cultural & Linguistic Data
    • Strings & Text
    • Symbolic & Numeric Computation
    • System Operation & Setup
    • Time-Related Computation
    • User Interface Construction
    • Visualization & Graphics
    • Random Paclet
    • Alphabetical List
  • Using Paclets
    • Get Started
    • Download Definition Notebook
  • Learn More about Wolfram Language

Parser

Tutorials

  • Building Language Front-Ends
  • Inside CodeAnalysis - How CodeStructure Parses C
  • Design and Compilation Strategy
  • Implementing the LaTeX Math Parser
  • MaTeX Comparison Showcase
  • The Parser Landscape - a Survey of What Exists Today
  • The Parser Zoo - language front-ends over a shared algebra
  • Parsing BNF Grammars (and bootstrapping a TPTP parser)
  • Parsing GrammarRules Locally
  • A Markdown Inline Parser in Parser Combinators
  • ParsingOpenQASM
  • Parsing TPTP, Auto-Generated from the Published BNF
  • PrattVsPEG
  • The Wolfram Box Typesetting Reference

Guides

  • Parsing in the Wolfram Language

Symbols

  • ASTAddSource
  • ASTAlgebra
  • ASTContainer
  • ASTLeafQ
  • ASTNodeQ
  • ASTStripSource
  • BinaryNode
  • BrainfuckAST
  • BrainfuckGrammar
  • BrainfuckRun
  • BrainfuckSemantic
  • CalculatorAST
  • CalculatorEval
  • CalculatorGrammar
  • CalculatorSemantic
  • CallNode
  • ContainerNode
  • EBNFParse
  • EBNFRules
  • ErrorNode
  • ExportLaTeX
  • GroupNode
  • InfixNode
  • JSONAST
  • JSONGrammar
  • JSONImport
  • JSONSemantic
  • LambdaAST
  • LambdaEval
  • LambdaGrammar
  • LambdaSemantic
  • LaTeXMathParse
  • LaTeXMathParser
  • LaTeXMathStyle
  • LeafNode
  • LispAST
  • LispGrammar
  • LispRead
  • LispSemantic
  • LispSymbol
  • MarkdownInlineParse
  • MarkdownInlineParser
  • MarkdownParse
  • MarkdownParser
  • ParseAction
  • ParseBetween
  • ParseChainLeft
  • ParseChainRight
  • ParseCharacter
  • ParseChoiceLongest
  • ParseChoice
  • ParseFail
  • ParseLiteral
  • ParseLookahead
  • ParseMany
  • Parse
  • ParseNotFollowedBy
  • ParseOperatorTable
  • ParseOptional
  • ParsePartial
  • ParsePosition
  • ParserCombinator
  • ParserCombinatorQ
  • ParserCompile
  • ParseRecursive
  • ParseRegex
  • ParseSepBy1
  • ParseSepBy
  • ParseSequence
  • ParseSome
  • ParseSucceed
  • ParseTry
  • PostfixNode
  • PrefixNode
  • RecCell
  • RecRef
  • SetRec
  • SpannedToken
  • TernaryNode
  • ToCodeParser
  • TPTPExport
  • TPTPImport

Overviews

  • WolframParser
Wolfram`Parser`
LaTeXMathParse
​
LaTeXMathParse
[s]
parses a LaTeX math-mode source string
s
into a tree of Wolfram boxes (
FractionBox
,
SubsuperscriptBox
,
RadicalBox
,
GridBox
,
RowBox
,
StyleBox
). Returns a
Failure
(tagged
"ParseError"
) if the input is not parseable.
​
Details and Options
▪
The parser handles the inline-math subset of LaTeX commonly written inside
$...$
or
\(...\)
(no preamble, no
\documentclass
).
▪
Output is a tree of Wolfram boxes, ready to drop into a notebook cell or wrap in
DisplayForm
/
RawBoxes
for rendering.
▪
126 / 126 cases from
KaTeX's screenshotter test corpus
parse cleanly. See
Implementing the LaTeX Math Parser
for the design and the corpus.
▪
The parser is tolerant: macros it doesn't know are emitted as their literal
\name
followed by their
{arg}
payload, so an unknown command doesn't abort the whole expression.
​
Examples  
(5)
Basic Examples  
(1)
A simple fraction:
In[1]:=
LaTeXMathParse
["\\frac{a}{b}"]
Out[1]=
FractionBox[StyleBox[a,TI],StyleBox[b,TI]]
Subscript / superscript / both:
In[2]:=
​​
LaTeXMathParse
["x^2"],​​
LaTeXMathParse
["a_i"],​​
LaTeXMathParse
["x_i^2"]​​
Out[2]=
{SuperscriptBox[StyleBox[x,TI],2],SubscriptBox[StyleBox[a,TI],StyleBox[i,TI]],SubsuperscriptBox[StyleBox[x,TI],StyleBox[i,TI],2]}
A named function:
In[3]:=
LaTeXMathParse
["\\sin x + \\cos y"]
Out[3]=
RowBox[{StyleBox[sin,FontSlantPlain],,StyleBox[x,TI],+,StyleBox[cos,FontSlantPlain],,StyleBox[y,TI]}]
A matrix environment:
In[4]:=
LaTeXMathParse
["\\begin{pmatrix} a & b \\\\ c & d \\end{pmatrix}"]
Out[4]=
RowBox[{(,GridBox[{{StyleBox[a,TI],StyleBox[b,TI]},{StyleBox[c,TI],StyleBox[d,TI]}}],)}]
A square root with an order:
In[5]:=
LaTeXMathParse
["\\sqrt[3]{x}"]
Out[5]=
RadicalBox[StyleBox[x,TI],3]
Scope  
(1)

Properties & Relations  
(1)

Possible Issues  
(1)

Neat Examples  
(1)

SeeAlso
Parse
 
▪
ParserCombinator
 
▪
FractionBox
 
▪
SubsuperscriptBox
 
▪
RadicalBox
 
▪
GridBox
 
▪
RowBox
 
▪
StyleBox
RelatedGuides
▪
WolframParser
""

© 2026 Wolfram. All rights reserved.

  • Legal & Privacy Policy
  • Contact Us
  • WolframAlpha.com
  • WolframCloud.com