TeXEnvironment

TeXEnvironment["name", expr1, expr2, ...] or TeXEnvironment[{"name"}, expr1, expr2, ...]
represents TeX environment:
\begin{name}
expr1
expr2
...
\end{name}
with expri converted to TeXForm.
TeXEnvironment[{"name", {{opt1val1, opt2, opt3val3, ...}, arg1, arg2, ...}}, expr1, expr2, ...]
represents TeX environment:
\begin{name}[opt1=val1, opt2, opt3=val3, ...]{arg1}{arg2}...
expr1
expr2
...
\end{name}
with expri, argi, opti and vali converted to TeXForm.
  • The following options can be given:
"ArgumentConverter"ToString[#1,TeXForm]& function used to convert begin command arguments, optional argument names and values, to TAdjustmentBox[E, BoxBaselineShift -> 0.5, BoxMargins -> {{-0.3, 0}, {0, 0}}]X. This function should accept one argument and return a string
"BodyConverter"ToString[#1,TeXForm]& function used to convert expressions, given as body of environment, to TAdjustmentBox[E, BoxBaselineShift -> 0.5, BoxMargins -> {{-0.3, 0}, {0, 0}}]X. This function should accept one argument and return a string
"BodySeparator""\n"string inserted between expressions given as body of environment
"DelimSeparator""\n"string inserted between body of environment and "begin" and "end" commands
"Indentation"" "string added after each newline character inside body of environment
Environment without arguments:
Environment with optional arguments:
Environment without arguments:
In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
Out[2]//TeXForm=
 
Environment with optional arguments:
In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
Out[2]//TeXForm=
TeXEnvironment can be nested:
With "ArgumentConverter" set to ToString[#1, TeXForm]& (default value) arguments are converted to TAdjustmentBox[E, BoxBaselineShift -> 0.5, BoxMargins -> {{-0.3, 0}, {0, 0}}]X:
With "ArgumentConverter" set to any function, arguments are passed to this function before joining with other strings building TAdjustmentBox[E, BoxBaselineShift -> 0.5, BoxMargins -> {{-0.3, 0}, {0, 0}}]X form of expression:
With "BodyConverter" set to ToString[#1, TeXForm]& (default value) expressions given as body of environment are converted to TAdjustmentBox[E, BoxBaselineShift -> 0.5, BoxMargins -> {{-0.3, 0}, {0, 0}}]X:
With "BodyConverter" set to any function, expressions given as body of environment are passed to this function before joining with other strings building TAdjustmentBox[E, BoxBaselineShift -> 0.5, BoxMargins -> {{-0.3, 0}, {0, 0}}]X form of expression:
With "BodySeparator" set to "\n" (default value) expressions given as body of environment are separated by newline characters:
With "BodySeparator" set to any string, expressions given as body of environment are separated by this string:
With "DelimSeparator" set to "\n" (default value) "begin" and "end" commands are separated from body of environment by newline characters:
With "DelimSeparator" set to any string, "begin" and "end" commands are separated from body of environment by this string:
With "Indentation" set to " " (4 spaces - default value) all newline characters inside body of environment have added 4 spaces:
With "Indentation" set to any string, all newline characters inside body of environment have this string added behind them:
TeXEnvironment can be used to define formatting using Format:
Assign TAdjustmentBox[E, BoxBaselineShift -> 0.5, BoxMargins -> {{-0.3, 0}, {0, 0}}]X formatting for a function:
Formatting is used when function is converted to TAdjustmentBox[E, BoxBaselineShift -> 0.5, BoxMargins -> {{-0.3, 0}, {0, 0}}]X: