表中缺少 $ 插入错误

表中缺少 $ 插入错误

我不明白为什么会出现“缺少 $ 插入错误”。输出表甚至不会显示。起初,输出没有问题,因为在两端都插入了 $$。现在它把文件中的所有表都弄乱了。它甚至不在输出中。

\begin{table}
\centering
\caption{Lexical Unification of Roman Urdu}
\begin{tabular}{l} 
\hline
Algorithm: \\ \hline
\begin{tabular}[c]{@{}l@{}}1.~~~~~ Maintain a CSV file of scrapped data  \\2.~~~~~ Clean the data by removing \\~ ~ ~ ~ ~a.~~~~~ @mentions, \#hashtags, URLs, and Unicode characters. \\~ ~ ~ ~ ~b.~~~~~ White spaces and from the start and end of the line. \\~ ~ ~ ~ ~c.~~~~~ Non-English, numeric values, and special symbols. \\3.~~~~~ Read the CSV file  \\4.~~~~~ Compute a list F of the most frequently occurring words \\~ ~ ~ ~ ~a.~~~~~ 
$$\sum_{i=1}^n(\text{string}S)$$
\\5.~~~~~ Select strings with the highest frequency  \\~ ~ ~ ~ ~a.~~~~~ 
\begin{equation}
\operatorname{MAX}\left[\sum_{i=1}^n(\operatorname{string} S)\right]
\end{equation}
\\6.~~~~~ Create a list of vowels V \\7.~~~~~ Compare each string to the list of vowels \\~ ~ ~ ~ ~a.~~~~~ Convert strings to lowercase \\~ ~ ~ ~ ~b.~~~~~ For each x in input string S \\~ ~ ~ ~ ~c.~~~~~ If x is in V \\~ ~ ~ ~ ~ ~ ~ ~ ~ i.~~~~ Replace it with empty space  \\~ ~ ~ ~ ~d.~~~~~ Else  \\~ ~ ~ ~ ~ ~ ~ ~ ~ i.~~~~ Retain it as it is \\8.~~~~~ Replace all instances of the original string in the CSV file \\ ~ ~ ~ ~ ~ with the resultant string with vowels removed.\end{tabular}  \\
\hline
\end{tabular}
\label{tab: 100}
\end{table}

在此处输入图片描述

答案1

$$在这种情况下就像并产生一个空的内联数学,因此在文本模式下满足$ $以下内容并给出您显示的错误。\sum

使用

$\displaystyle\sum_{i=1}^n(\text{string}S)$

或者可能更好

$\displaystyle\sum_{i=1}^{n}(\mathrm{string}S)$

答案2

@David Carlisle 的回答(+1)解决了您的问题,因此这里有一个题外的建议,关于如何以更一致的方式编写表格:

\documentclass[oneside,onecolumn]{article}

\begin{document}
    \begin{table}
\centering
\caption{Lexical Unification of Roman Urdu}
\begin{tabular}{@{} l p{28em} @{}}
    \hline
    & Algorithm:        \\ 
    \hline
1.  & Maintain a CSV file of scrapped data  \\
2.  & Clean the data by removing            \\ 
    & \begin{tabular}{@{} c l}
        a.  & @mentions, \#hashtags, URLs, and Unicode characters.  \\
        b.  & White spaces and from the start and end of the line.  \\
        c.  & Non-English, numeric values, and special symbols.     \\
      \end{tabular}         \\
3.  &  Read the CSV file  q \\
4.  & Compute a list F of the most frequently occurring words \\
    & \begin{tabular}{@{} c l}
        a.  & $\displaystyle\sum_{i=1}^n(\mathrm{string}S)$  \\
      \end{tabular}         \\
5.  & Select strings with the highest frequency  \\
    & \begin{tabular}{@{} c l}
        a.  & $\displaystyle\max\left[\sum_{i=1}^n(\mathrm{string} S)\right]$ \\
      \end{tabular}             \\
6.  & Create a list of vowels V \\
7.  & Compare each string to the list of vowels \\
    & \begin{tabular}{@{} c l}
        a.  & Convert strings to lowercase \\
        b.  & For each x in input string S \\
        c.  & If x is in V \\
            &\quad   i Replace it with empty space  \\
            &   Else  \\
            &\quad   Retain it as it is
      \end{tabular}            \\
8.  & Replace all instances of the original string in the CSV file
      with the resultant string with vowels removed.    \\
    \hline
\end{tabular}
\label{tab: 100}
    \end{table}
\end{document}

在此处输入图片描述

相关内容