[Tex/LaTex] Why there is an “missing $ inserted error” in the equation* environment

environmentsequationsmath-modetables

The code is:

\begin{equation*}
\[I(t)=\begin{cases}
1; & |t|\le\frac{{\Delta}t_{p}^{FWHM}}{2}\\
0; & |t|>\frac{{\Delta}t_{p}^{FWHM}}{2}
\end{cases}\]
 \end{equation*}\\

the error is missing $ inserted and bad math delimiter, what should I do for this?

I try to generate a table, the above codes are some equation in the table, the whole codes are attached below:

\begin{table}[!htb]
\begin{center}
\renewcommand{\arraystretch}{2.7}
\begin{tabular}{|c|c|}
\hline
\multicolumn{2}{|c|}{Square Pulse} \\
\hline
Pulse & 
\begin{equation*}
\[I(t)=\begin{cases}
1; & |t|\le\frac{{\Delta}t_{p}^{FWHM}}{2}\\
0; & |t|>\frac{{\Delta}t_{p}^{FWHM}}{2}
\end{cases}\]
 \end{equation*}\\
 \hline
Autocorrelation & 
\begin{equation*}
    \[A^{(2)}(\tau)=\begin{cases}1-|\frac{\tau}{\Delta\tau_{A}^{FWHM}}|; &|\tau|\le\Delta\tau_{A}^{FWHM}\\
0; &|\tau|>\Delta\tau_{A}^{FWHM}\end{cases}\]
\end{equation*} \\
 \hline
 Relationship & ${\Delta}t_{p}^{FWHM}=\Delta\tau_{A}^{FWHM}$ \\
 \hline
 \multicolumn{2}{|c|}{Gaussian Pulse} \\
 \hline
 Pulse & $I(t)=exp[-(2\sqrt{ln2t}/{\Delta}t_{p}^{FWHM})^2]$ \\ 
 \hline
 Autocorrelation & $A^{(2)}(\tau)=exp[-         (2\sqrt{ln2\tau}}/{\Delta\tau_{A}^{FWHM}})^2)^2$ \\
 \hline
 Relationship & $1.41{\Delta}t_{p}^{FWHM}=\Delta\tau_{A}^{FWHM}$ \\
 \hline
 \end{tabular}
\centering{
\caption{The relationship between the initial pulse and autocorrelation of square pulse and Gaussian pulse}
\label{table AC1}}
\end{center}
\end{table}

Best Answer

You shouldn't be using either \begin{equation*} ... \end{equation*} or \[ ... \] inside the columns of a tabular environment. Instead, simply change the column definition of the right-hand column from c to >{$\displaystyle}c<{$}; this will ensure that all cells in the second column will automatically be in math mode.

You have several (syntax) errors in the equations. Also, write \exp and \ln instead of just exp and ln; that way, "exp" and "ln" will be typeset using upright letters.

Also, where possible, avoid using fractional expressions using \frac in the second column; instead, using "inline-style" fractions, e.g., a/b instead of \frac{a}{b}.

enter image description here

\documentclass{article}
\usepackage{mathtools,array}
\DeclarePairedDelimiter{\abs}{\lvert}{\rvert}
\newcommand\FWHM{\mathrm{FWHM}}
\begin{document}
\begin{table}[!htb]
\centering
\renewcommand{\arraystretch}{2.75}
\begin{tabular}{|l|>{$\displaystyle}l<{$}|}
\hline
\multicolumn{2}{|c|}{Square Pulse} \\
\hline
Pulse & 
I(t)=
\begin{cases}
1; & \abs{t}\le\tfrac{1}{2}\Delta t_{p}^{\FWHM}\\[1.5ex]
0; & \abs{t}>  \tfrac{1}{2}\Delta t_{p}^{\FWHM}
\end{cases}
 \\
\hline
Autocorrelation & 
A^{(2)}(\tau)=
\begin{cases}
1-\abs*{\tau\big/\Delta\tau_{A}^{\FWHM}}; 
& \abs{\tau}\le\Delta\tau_{A}^{\FWHM}\\[2ex]
0;  & \abs{\tau}>\Delta\tau_{A}^{\FWHM}
\end{cases}
 \\
\hline
Relationship & {\Delta}t_{p}^{\FWHM}=\Delta\tau_{A}^{\FWHM} \\
\hline
 \multicolumn{2}{|c|}{Gaussian Pulse} \\
 \hline
 Pulse & I(t)=\exp\Bigl[-\bigl(2\sqrt{\ln2t}/{\Delta}t_{p}^{\FWHM}\bigr)^2\Bigr] \\ 
\hline
Autocorrelation & 
A^{(2)}(\tau)=\exp\Bigl[-\bigl(2\sqrt{\ln2\tau}/\Delta\tau_{A}^{\FWHM}\bigr)^2\Bigr] \\
\hline
Relationship & 
{\Delta}t_{p}^{\FWHM}=\Delta\tau_{A}^{\FWHM} \\
\hline
 \end{tabular}
\caption{The relationship between the initial pulse and autocorrelation of square pulse and Gaussian pulse}
\label{table AC1}
\end{table}

\end{document}

Addendum: Your table contains lots of vertical and horizontal lines, which actually don't enhance the readability of its contents. You may want to give some thought to giving the table a more "open" look, e.g., by getting rid all vertical lines and most horizontal lines. I hope you will agree that the following table is much more "inviting" to the readers' eye (and brain...).

enter image description here

\documentclass{article}
\usepackage{mathtools,array,booktabs}
\DeclarePairedDelimiter{\abs}{\lvert}{\rvert}  % "absolute value" macro
\newcommand\FWHM{\mathrm{FWHM}}
\begin{document}
\begin{table}[!htb]
\centering
\renewcommand{\arraystretch}{1.25}
\begin{tabular}{@{}l>{$\displaystyle}l<{$}@{}}
\toprule
\multicolumn{2}{@{}l}{\bfseries Square Pulse} \\
\addlinespace
Pulse & 
I(t)=
\begin{cases}
1; & \abs{t}\le\tfrac{1}{2}\Delta t_{p}^{\FWHM}\\[1ex]
0; & \abs{t}>  \tfrac{1}{2}\Delta t_{p}^{\FWHM}
\end{cases}
 \\
\addlinespace
Autocorrelation & 
A^{(2)}(\tau)=
\begin{cases}
1-\abs*{\tau\big/\Delta\tau_{A}^{\FWHM}}; 
& \abs{\tau}\le\Delta\tau_{A}^{\FWHM}\\[1ex]
0;  & \abs{\tau}>\Delta\tau_{A}^{\FWHM}
\end{cases}
 \\
\addlinespace
Relationship & {\Delta}t_{p}^{\FWHM}=\Delta\tau_{A}^{\FWHM} \\
\midrule
\multicolumn{2}{@{}l}{\bfseries Gaussian Pulse} \\
\addlinespace
Pulse & I(t)=\exp\bigl[-\bigl(2\sqrt{\ln2t}\big/{\Delta}t_{p}^{\FWHM}\bigr)^2\,\bigr] \\ 
\addlinespace
Autocorrelation & 
A^{(2)}(\tau)=\exp\bigl[-\bigl(2\sqrt{\ln2\tau}\big/\Delta\tau_{A}^{\FWHM}\bigr)^2\,\bigr] \\
\addlinespace
Relationship & 
{\Delta}t_{p}^{\FWHM}=\Delta\tau_{A}^{\FWHM} \\
\bottomrule
 \end{tabular}
\caption{Relationship between initial pulse and autocorrelation for square and Gaussian pulses}
\label{table AC1}
\end{table}

\end{document}