我想在方程式中使用表格,如下所示:
这可能吗?该示例只是一张手动添加表格的图片。
表格如下:
\begin{table}[H]
\centering
\begin{tabular}{|l|l|}
\hline
\multicolumn{1}{|c|}{\textbf{name}}
& \multicolumn{1}{c|}{\textbf{movie}}\\
\hline
Jack Nicholson & Wolf \\
Dennis Quaid & Frequency \\
Jack Black & The School of Rock \\
Jack Nicholson & The Shining \\
Morgan Freeman & Se7en \\
\hline
\end{tabular}
\end{table}
\begin{table}[H]
\centering
\begin{tabular}{|l|}
\hline
\multicolumn{1}{|c|}{\textbf{name}} \\
\hline
Jack Nicholson \\
Dennis Quaid \\
Jack Black \\
Morgan Freeman \\
\hline
\end{tabular}
\end{table}
答案1
您可以完全按照您期望的方式进行操作:
\documentclass{article}
\begin{document}
$
\pi_{\mathrm{name}}\left(\
\begin{tabular}{|l|l|}
\hline
\multicolumn{1}{|c|}{\textbf{name}}
& \multicolumn{1}{c|}{\textbf{movie}}\\
\hline
Jack Nicholson & Wolf \\
Dennis Quaid & Frequency \\
Jack Black & The School of Rock \\
Jack Nicholson & The Shining \\
Morgan Freeman & Se7en \\
\hline
\end{tabular}
\ \right)=
\begin{tabular}{|l|}
\hline
\multicolumn{1}{|c|}{\textbf{name}} \\
\hline
Jack Nicholson \\
Dennis Quaid \\
Jack Black \\
Morgan Freeman \\
\hline
\end{tabular}
$
\end{document}
答案2
这是完全可能的,因为tabular
环境会自动切换到文本模式。但是,不要使用table
浮点型环境。
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[ \pi_{\text{name}} \\begin{pmatrix}\:
\begin{tabular}{|l|l|}
\hline
\multicolumn{1}{|c|}{\textbf{name}}
& \multicolumn{1}{c|}{\textbf{movie}}\\
\hline
Jack Nicholson & Wolf \\
Dennis Quaid & Frequency \\
Jack Black & The School of Rock \\
Jack Nicholson & The Shining \\
Morgan Freeman & Se7en \\
\hline
\end{tabular}\:
\end{pmatrix}
=
\begin{tabular}{|l|}
\hline
\multicolumn{1}{|c|}{\textbf{name}} \\
\hline
Jack Nicholson \\
Dennis Quaid \\
Jack Black \\
Morgan Freeman \\
\hline
\end{tabular} \]%
\end{document}