Previously, I used the following LaTeX preamble for my TexMaths extension in LibreOffice:
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[usenames]{color}
\usepackage{amsbsy,amscd,amstext,amsxtra}
\usepackage{mhchem}
\usepackage[amssymb]{SIunits}
% Uncomment these lines for colored equations
% \definecolor{myColor}{RGB}{0,0,255}
% \pagecolor{white}\color{myColor}
% Four kinds of emph style, \alert style and integration symbol `d‘
\newcommand{\empha}[1]{\textcolor{red}{#1}}
\newcommand{\emphb}[1]{\textcolor{green}{#1}}
\newcommand{\emphc}[1]{\textcolor{orange}{#1}}
\newcommand{\emphd}[1]{\textcolor{blue}{#1}}
\newcommand{\alert}[1]{\textcolor{red}{\textbf{#1}}}
\newcommand{\intd}{\,{\rm d}}
\newcommand{\rme}{{\rm e}}
\newcommand{\rmd}{{\rm d}}
\newcommand{\rmi}{{\rm i}}
\newcommand{\diff}{{\rm d}}
\newcommand{\vect}[1]{\boldsymbol{#1}}
\newcommand{\abs}[1]{\lvert#1\rvert}
\newcommand{\norm}[1]{\lVert#1\rVert}
\newcommand{\curl}{\bf{curl}\,}
\newcommand{\grad}{\bf{grad}\,}
\DeclareMathOperator{\sgn}{sgn}
\DeclareMathOperator{\erf}{erf}
\newcommand{\suchthat}{\textit{s.t\;}}
\newcommand{\etal}{{\it et al}}
\newcommand{\alertboxm}[1]{{%
\setlength{\fboxrule}{.4mm}
\color{red}\boxed{{\color{black}#1}}}}
\newcommand{\emboxm}[1]{{\setlength{\fboxrule}{.4mm}\boxed{#1}}}
\newcommand{\alertbox}[1]{{%
\setlength{\fboxrule}{.4mm}
\color{red}\fbox{{\color{black}#1}}}}
\newcommand{\embox}[1]{{\setlength{\fboxrule}{.4mm}\fbox{#1}}}
Since TexMaths 0.38, the preamble has been stored into each document, while the default preamble is hard coded into the macro DefaultPreamble. Its contents should be replaced with my previous preamble which looks like following:
‘ Set default preamble
Sub DefaultPreamble()
‘ Set the preamble to default value
glb_sPreamble = "\usepackage{amsmath}" & chr(10) &_
"\usepackage{amssymb}" & chr(10) &_
"\usepackage[usenames]{color}" & chr(10) &_
"\usepackage{amsbsy,amscd,amstext,amsxtra}" & chr(10) &_
"\usepackage{mhchem}" & chr(10) &_
"\usepackage[amssymb]{SIunits}" & chr(10) &_
"% Uncomment these lines for colored equations" & chr(10) &_
"% \definecolor{myColor}{RGB}{0,0,255}" & chr(10) &_
"% \pagecolor{white}\color{myColor}" & chr(10) &_
"% Four kinds of emph style, \alert style and integration symbol `d‘" & chr(10) &_
"\newcommand{\empha}[1]{\textcolor{red}{#1}}" & chr(10) &_
"\newcommand{\emphb}[1]{\textcolor{green}{#1}}" & chr(10) &_
"\newcommand{\emphc}[1]{\textcolor{orange}{#1}}" & chr(10) &_
"\newcommand{\emphd}[1]{\textcolor{blue}{#1}}" & chr(10) &_
"\newcommand{\alert}[1]{\textcolor{red}{\textbf{#1}}}" & chr(10) &_
"\newcommand{\intd}{\,{\rm d}}" & chr(10) &_
"\newcommand{\rme}{{\rm e}}" & chr(10) &_
"\newcommand{\rmd}{{\rm d}}" & chr(10) &_
"\newcommand{\rmi}{{\rm i}}" & chr(10) &_
"\newcommand{\diff}{{\rm d}}" & chr(10) &_
"\newcommand{\vect}[1]{\boldsymbol{#1}}" & chr(10) &_
"\newcommand{\abs}[1]{\lvert#1\rvert}" & chr(10) &_
"\newcommand{\norm}[1]{\lVert#1\rVert}" & chr(10) &_
"\newcommand{\curl}{\bf{curl}\,}" & chr(10) &_
"\newcommand{\grad}{\bf{grad}\,}" & chr(10) &_
"\DeclareMathOperator{\sgn}{sgn}" & chr(10) &_
"\DeclareMathOperator{\erf}{erf}" & chr(10) &_
"\newcommand{\suchthat}{\textit{s.t\;}}" & chr(10) &_
"\newcommand{\etal}{{\it et al}}" & chr(10) &_
"\newcommand{\alertboxm}[1]{{%" & chr(10) &_
" \setlength{\fboxrule}{.4mm}" & chr(10) &_
" \color{red}\boxed{{\color{black}#1}}}}" & chr(10) &_
"\newcommand{\emboxm}[1]{{\setlength{\fboxrule}{.4mm}\boxed{#1}}}" & chr(10) &_
"\newcommand{\alertbox}[1]{{%" & chr(10) &_
" \setlength{\fboxrule}{.4mm}" & chr(10) &_
" \color{red}\fbox{{\color{black}#1}}}}" & chr(10) &_
"\newcommand{\embox}[1]{{\setlength{\fboxrule}{.4mm}\fbox{#1}}}" & chr(10)
End Sub
TexMaths preamble I'm using,布布扣,bubuko.com
TexMaths preamble I'm using