未定义的控制序列。缺少$插入的乳胶

未定义的控制序列。缺少$插入的乳胶

我有下表

\documentclass[runningheads,a4paper]{llncs}

\usepackage{amssymb}
\setcounter{tocdepth}{2}
\usepackage{graphicx}
\usepackage[latin1]{inputenc}
\usepackage[english]{babel}
\usepackage{url}

\usepackage{float}
\usepackage{booktabs}
\usepackage{multirow}% http://ctan.org/pkg/multirow
\usepackage{hhline}% http://ctan.org/pkg/hhline

\usepackage{lipsum}
\setcounter{secnumdepth}{5}
\begin{document}



\begin{table}[h]
\centering
    \caption{Alignment of ADTree to ISSRM}
{\renewcommand\arraystretch{1.75}
\begin{tabular}{|l|l|l|} \hline
Statement & \multicolumn{2}{l|}{Description} \\ \hline\hline


P(\text{Attack} \mid \text{Asset}) & \multicolumn{2}{p{8cm}|}{\raggedright  The probability of Attack, given the Asset, was targeted} \\ \hline
P(\text{Attack} \cap \text{Asset}) & \multicolumn{2}{p{8cm}|}{\raggedright  The probability of happening Atomic attack on Asset, Can be obtained from join of Attack and Assets tables} \\ \hline
P(Asset & \multicolumn{2}{p{8cm}|}{\raggedright  Can be obtained from Asset table, and Table 15 } \\ \hline

\end{tabular}}
\label{Explanation of formula}
\end{table}

\end{document}

尽管 get*.tex已成功编译,并且正确显示了表格,但是其中有两个错误值得抱怨:

undefined control sequence.missing $ inserted latex

答案1

  • 命令\mid 必须当 TeX 处于数学模式时发生。

  • 为了使用宏,必须加载\text包。amsmath

  • 不要定义两列然后用来\multicolumn{2}{...}{...}连接这两列。

  • 无需发出重复\multicolumn{2}{p{8cm}|}{\raggedright ...}指令,只需加载array包并定义以下类型的单个列:>{\raggedright\arraybackslash}p{8cm}

  • 通过省略所有垂直杆和大多数内部水平杆,让您的桌子看起来更具吸引力、更开放。

  • 花点时间学习 LaTeX 的基础知识。你会发现写论文变得容易多了……

在此处输入图片描述

\documentclass[runningheads,a4paper]{llncs}

\usepackage{amsmath}
\usepackage[english]{babel}
\usepackage{booktabs,array}
\begin{document}

\begin{table}[h]
\centering
\caption{Alignment of ADTree to ISSRM}
 \label{Explanation of formula}
\renewcommand\arraystretch{1.25}
\begin{tabular}{@{}l>{\raggedright\arraybackslash}p{8cm}@{}} 
\toprule
Statement & Description \\ 
\midrule
$P(\text{Attack} \mid \text{Asset})$ 
& Probability of Attack, given that Asset was targeted\\ 
\addlinespace
$P(\text{Attack} \cap \text{Asset})$ 
& Probability of Atomic attack happening on Asset. Can be obtained from join of Attack and Assets tables \\ 
\addlinespace
$P(\text{Asset})$ 
& Can be obtained from Asset table and Table 15  \\ 
\bottomrule
\end{tabular}
\end{table}

\end{document}

相关内容