方程式环境中缺少 $ 插入

方程式环境中缺少 $ 插入

我对下面的表格有些困惑。编译时,我收到错误缺少 $ 插入, 这里:

I&CW& 
\begin{equation}\label{eq:jammer_CW}
i[n]=A_J\exp(j2\pi f_JnT_s)\qquad\quad
\end{equation}
&$A_{J}$, $f_{J}$ \\[1ex]
\hline

而当添加$符号时,就像这样:

I&CW& 
\begin{equation}\label{eq:jammer_CW}
$i[n]=A_J\exp(j2\pi f_JnT_s)$\qquad\quad
\end{equation}
&$A_{J}$, $f_{J}$ \\[1ex]
\hline

我收到另一个错误:您不能在受限水平模式下使用 eqno'

有人知道如何解决这个问题吗?提前谢谢您!

以下是整个表格:

\begingroup
% A table with adjusted row and column spacings
% \setlength sets the horizontal (column) spacing
% \arraystretch sets the vertical (row) spacing
\setlength{\tabcolsep}{2pt} % Default value: 6pt
\renewcommand{\arraystretch}{1.5} % Default value: 1
\begin{table}[h]
\small
\centering
\begin{tabular}{|c|c|c|c|}
\hline
Class&Type&Baseband model&Design parameters\\
\hline
I&CW& 
\begin{equation}\label{eq:jammer_CW}
i[n]=A_J\exp(j2\pi f_JnT_s)\qquad\quad
\end{equation}
&$A_{J}$, $f_{J}$ \\[1ex]
\hline
II&Single Chirp& \begin{equation}\label{eq:jammer_ST}
i[n] = A_{J}\exp(j2\pi T_{s}\sum_{j=0}^{n}f_{J}[j])\qquad \end{equation}&$A_{J}$, $T_{sweep}$, $\Delta f$ \\[1ex]
\hline
II&Pulsed Jammer&Equation \ref{eq:jammer_ST} with $\Delta f > BW$&$A_{J}$, $T_{sweep}$, $\Delta f$\\[1ex]
\hline
\end{tabular}
\caption{Classification of the implemented jamming baseband signal models, according to \citerd{Morales-Ferre2020}.}
\label{tab:signalmodels}
\end{table}
% The \begingroup ... \endgroup pair ensures the separation
% parameters only affect this particular table, and not any
% sebsequent ones in the document.
\endgroup

答案1

使用amsmath和:makecelltabullarx

\documentclass{article}
\usepackage{geometry}
\usepackage{amsmath}
\usepackage{makecell, tabularx}
\newcolumntype{C}[1]{>{\hsize=#1\hsize \centering\arraybackslash}X}

\begin{document}
    \begin{table}[ht]
    \setlength\extrarowheight{2pt}
    \renewcommand\tabularxcolumn[1]{m{#1}}
\begin{tabularx}{\linewidth}{|c |C{0.6}
                                |C{1.8}
                                |C{0.6}|
                            }
    \Xhline{1pt}
Class   & Type  & {Baseband model}
                    & {Design   parameters}                     \\
    \Xhline{0.6pt}
                    I   & CW
                            &   \begin{gather}\label{eq:jammer_CW}
                        i[n] = A_J\exp(j2\pi f_JnT_s)
                                \end{gather}
                            & $A_{J}$, $f_{J}$                          \\
    \hline
    II  & Single Chirp
                &   \begin{equation}\label{eq:jammer_ST}
                i[n] = A_{J}\exp(j2\pi T_{s}\sum_{j=0}^{n}f_{J}[j])
                    \end{equation}
                    & $A_{J}$, $T_\mathrm{sweep}$, $\Delta f$   \\
    \hline
    III & Pulsed Jammer
                &   Equation \eqref{eq:jammer_ST} with $\Delta f>BW$
                    & $A_{J}$, $T_\mathrm{sweep}$, $\Delta f$\\[1ex]
    \Xhline{1pt}
        \end{tabularx}
\caption{Classification of the implemented jamming baseband signal models,n according to equations \eqref{eq:jammer_CW} and \eqref{eq:jammer_ST}.}
\label{tab:signalmodels}
    \end{table}
\end{document}

在此处输入图片描述

答案2

如果不使用它\begin{equation)来创建方程编号和标签,而是定义一个特殊的标签来插入连续的数字并且能够引用表格中的特定单元格,则可以简化表格代码。

取自我可以引用表格中的单元格吗?

是

\documentclass[12pt,a4paper]{article}

%% From https://tex.stackexchange.com/questions/81973/can-i-refer-to-cells-in-a-tabular
\newcounter{spcounter}\renewcommand{\thespcounter}{\arabic{spcounter}}
\newcommand{\speciallabel}[1]{%          >>>> \speciallabel{<label>}
\hfill\refstepcounter{spcounter}(\thespcounter)\label{#1}%
}

\usepackage{tabularx}
\newcolumntype{C}[1]{>{\centering\arraybackslash}X|}

\begin{document}
    
    \setlength{\tabcolsep}{5pt} 
    \renewcommand{\arraystretch}{2} % Default value: 1
    \begin{table}[h]
        \small
        \centering
        \begin{tabularx}{\linewidth}{|c|C|c|c|}
            \hline
            Class&Type&Baseband model&Design parameters\\
            \hline
            I&CW&   $i[n]=A_J\exp(j2\pi f_JnT_s)\qquad$\speciallabel{eq:jammer_CW} % <<<<<<<<<<<<<<<
            &$A_{J}$, $f_{J}$ \\[1ex]
            \hline
            II&Single Chirp& $i[n] = A_{J}\exp(j2\pi T_{s}\sum_{j=0}^{n}f_{J}[j])\qquad$\speciallabel{eq:jammer_ST} %<<<<<<<<<<<<<<
            &$A_{J}$, $T_{sweep}$, $\Delta f$ \\[1ex]
            \hline
            II&Pulsed Jammer&Equation (\ref{eq:jammer_ST}) with $\Delta f > BW$&$A_{J}$, $T_{sweep}$, $\Delta f$\\[1ex]
            \hline
        \end{tabularx}
        \caption{Classification of the implemented jamming baseband signal models, according to equations (\ref{eq:jammer_CW}) and (\ref{eq:jammer_ST}).}
        \label{tab:signalmodels}
    \end{table} 
    
\end{document}

相关内容