OpenersNotesSection(Spacer1)Details

OpenersPrimaryExamplesSection(Spacer1)Examples  (6)

OpenersExampleSection0(Spacer1)Basic Examples  (6)

Interpret TeX inputs:

Interpreter["TeXExpression"]["2+2"]

Interpreter["TeXExpression"]["\\text{el ni\\~no}"]

Restrict to a list of choices:

Interpreter[Restricted["TeXExpression",{{True, False}}]]["x=2"]

Interpreter[Restricted["TeXExpression",{{True, False}}]]["1=2"]

By default, all symbols are allowed. Restrict to a list of allowed symbols:

Interpreter[Restricted["TeXExpression",{Greater}]]["x>2"]

Interpreter[Restricted["TeXExpression",{Greater}]]["\\sin(x)>2"]

By default, new symbols are created in (RefLink[$Context, paclet:ref/$Context]), but a custom context can be specified:

var=Interpreter[Restricted["TeXExpression",Automatic,Automatic,Automatic]]["x"]
Context[Evaluate[var]]

var=Interpreter[Restricted["TeXExpression",Automatic,Automatic,"mycontext`"]]["x"]
Context[Evaluate[var]]

Specify contexts for the allowed and output symbols:

Global`x = 10;
Interpreter[Restricted["TeXExpression",Automatic,{"Global`","System`"},"Global`"]]["\\sin(x)"]

Prevent the creation of any new symbol:

Interpreter[Restricted["TeXExpression",Automatic,Automatic,None]]["\\sin(0)>0"]

Interpreter[Restricted["TeXExpression",Automatic,Automatic,None]]["\\sin(z)>0"]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[TeXForm, paclet:ref/TeXForm])  ▪  (RefLink[Interpreter, paclet:ref/Interpreter])  ▪  (RefLink[Restricted, paclet:ref/Restricted])  ▪  (RefLink[Failure, paclet:ref/Failure])}, {Related Interpreter Types:  (RefLink[HeldTeXExpression, paclet:ref/interpreter/HeldTeXExpression])  ▪  (RefLink[InactiveTeXExpression, paclet:ref/interpreter/InactiveTeXExpression])  ▪  (RefLink[MathMLExpression, paclet:ref/interpreter/MathMLExpression])  ▪  (RefLink[HeldMathMLExpression, paclet:ref/interpreter/HeldMathMLExpression])  ▪  (RefLink[InactiveMathMLExpression, paclet:ref/interpreter/InactiveMathMLExpression])}, {Related Formats:  (RefLink[LaTeX, paclet:ref/format/LaTeX])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Setting Up Input Interpreters, paclet:guide/InterpretingStrings])}})}})