我有以下表格。我该如何改进此表格的形状?我无法添加任何线条以节省空间。
\documentclass{article}
\usepackage{mathtools}
\usepackage{float}
\begin{document}
\begin{table}[H]
\centering
\begin{tabular}[t]{|l|}
\hline
$%
\begin{aligned}
\mathrm{N}_{\mathbf{x}_{j_{1}},\mathbf{x}_{j_{2}},\mathbf{x}_{j_{3}},\mathbf{x}%
_{j_{4}}}^{( -1,1,1,-1) } & =\mathrm{N}_{\mathbf{x}_{j_{1}},\mathbf{x}%
_{j_{2}},\mathbf{x}_{j_{3}},\mathbf{x}_{j_{4}}}^{( 1,-1,1,-1)
}=\mathrm{N}_{\mathbf{x}_{j_{1}},\mathbf{x}_{j_{2}},\mathbf{x}_{j_{3}},\mathbf{x}%
_{j_{4}}}^{( 1,1,-1,-1) }=\mathrm{N}_{\mathbf{x}_{j_{1}},\mathbf{x}%
_{j_{2}},\mathbf{x}_{j_{3}},\mathbf{x}_{j_{4}}}^{( -1,-1,-1,-1) }%
\end{aligned}%
$ \\
\hline
$%
\begin{aligned}
\mathrm{N}_{\mathbf{x}_{j_{1}},\mathbf{x}_{j_{2}},\mathbf{x}_{j_{3}},\mathbf{x}%
_{j_{4}}}^{( -1,-1,1,-1) } & =\mathrm{N}_{\mathbf{x}_{j_{1}},\mathbf{x}%
_{j_{2}},\mathbf{x}_{j_{3}},\mathbf{x}_{j_{4}}}^{( -1,1,-1,-1)
}=\mathrm{N}_{\mathbf{x}_{j_{1}},\mathbf{x}_{j_{2}},\mathbf{x}_{j_{3}},\mathbf{x}%
_{j_{4}}}^{( 1,-1,-1,-1) }=\mathrm{N}_{\mathbf{x}_{j_{1}},\mathbf{x}%
_{j_{2}},\mathbf{x}_{j_{3}},\mathbf{x}_{j_{4}}}^{( 1,1,1,-1) } \\
\phantom{{ }}& =\frac{\mathrm{f}+1}{4}-\mathrm{N}_{\mathbf{x}_{j_{1}},\mathbf{x}_{j_{2}},\mathbf{x}_{j_{3}},%
\mathbf{x}_{j_{4}}}^{( -1,-1,-1,-1) }%
\end{aligned}%
$ \\
\hline
$
\begin{aligned}
\mathrm{N}_{\mathbf{x}_{j_{1}},\mathbf{x}_{j_{2}},\mathbf{x}_{j_{3}},\mathbf{x}%
_{j_{4}}}^{( 1,1,1,1) } & =\mathrm{N}_{\mathbf{x}_{j_{1}},\mathbf{x}%
_{j_{2}},\mathbf{x}_{j_{3}},\mathbf{x}_{j_{4}}}^{( -1,-1,-1,-1)
}-1
\end{aligned}%
$ \\
\hline
\end{tabular}
\end{table}
\end{document}
答案1
我不会用任何水平和垂直规则,而是仅使用单一环境显示方程式aligned
。
\documentclass{article}
\usepackage{mathtools}
\newcommand\NX{\mathrm{N}_{\mathbf{x}_{j_1},\mathbf{x}_{j_2},\mathbf{x}_{j_3},\mathbf{x}_{j_4}}}
\begin{document}
\begin{table}[ht!]
\caption{Three equations} % choose a suitable caption
\[
\begin{aligned}
\NX^{(-1,1,1,-1)}
&=\NX^{(1,-1,1,-1)} = \NX^{(1,1,-1,-1)} = \NX^{(-1,-1,-1,-1)} \\[2ex]
\NX^{(-1,-1,1,-1) }
&=\NX^{(-1,1,-1,-1)} = \NX^{(1,-1,-1,-1)} = \NX^{(1,1,1,-1)} \\[1ex]
&=\tfrac{1}{4}(\mathrm{f}+1) - \NX^{(-1,-1,-1,-1)} \\[2ex]
\NX^{(1,1,1,1) }
&=\NX^{(-1,-1,-1,-1)} -1
\end{aligned}
\]
\end{table}
\end{document}
答案2
看一下booktabs
包装:
% arara: pdflatex
\documentclass{article}
\usepackage{mathtools}
\usepackage{booktabs}
\usepackage{array}
\newcolumntype{L}{>{$}l<{$}}
\newcolumntype{R}{>{$}r<{$}}
\newcommand*{\one}[1]{\mathrm{#1}}
\newcommand*{\two}[1]{\mathbf{#1}}
\begin{document}
\begin{table}
\centering
\begin{tabular}{R@{}L}
\toprule
\one{N}_{\two{x}_{j_{1}},\two{x}_{j_{2}},\two{x}_{j_{3}},\two{x}_{j_{4}}}^{( -1,1,1,-1) }
& {}= \one{N}_{\two{x}_{j_{1}},\two{x}_{j_{2}},\two{x}_{j_{3}},\two{x}_{j_{4}}}^{(1,-1,1,-1)} = \one{N}_{\two{x}_{j_{1}},\two{x}_{j_{2}},\two{x}_{j_{3}},\two{x}_{j_{4}}}^{( 1,1,-1,-1) } = \one{N}_{\two{x}_{j_{1}},\two{x}_{j_{2}},\two{x}_{j_{3}},\two{x}_{j_{4}}}^{( -1,-1,-1,-1)}\\
\midrule
\one{N}_{\two{x}_{j_{1}},\two{x}_{j_{2}},\two{x}_{j_{3}},\two{x}_{j_{4}}}^{( -1,-1,1,-1) }
& {}= \one{N}_{\two{x}_{j_{1}},\two{x}_{j_{2}},\two{x}_{j_{3}},\two{x}_{j_{4}}}^{( -1,1,-1,-1)} = \one{N}_{\two{x}_{j_{1}},\two{x}_{j_{2}},\two{x}_{j_{3}},\two{x}_{j_{4}}}^{( 1,-1,-1,-1) } = \one{N}_{\two{x}_{j_{1}},\two{x}_{j_{2}},\two{x}_{j_{3}},\two{x}_{j_{4}}}^{( 1,1,1,-1) } \\\addlinespace
& {}= \frac{\one{f}+1}{4} - \one{N}_{\two{x}_{j_{1}},\two{x}_{j_{2}},\two{x}_{j_{3}}, \two{x}_{j_{4}}}^{(-1,-1,-1,-1)}\\
\midrule
\one{N}_{\two{x}_{j_{1}},\two{x}_{j_{2}},\two{x}_{j_{3}},\two{x}_{j_{4}}}^{( 1,1,1,1) }
& {}= \one{N}_{\two{x}_{j_{1}},\two{x}_{j_{2}},\two{x}_{j_{3}},\two{x}_{j_{4}}}^{( -1,-1,-1,-1)} -1\\
\bottomrule
\end{tabular}
\end{table}
\end{document}
如果您只是想增加所有行的高度,请搜索此主页上的多个帖子。\renewcommand{\arraystretch}{<someValue>}
将成为你的朋友。
我已经为您介绍了自定义命令。给它起比\one
和更好的名字,\two
然后开始使用它们。想象一下,您(或您的讲师)决定您应该使用\mathit
而不是\mathbf
您展示 100 页作品的那一天......
答案3
由于我不明白为什么在这种情况下需要tabular
,我建议只使用 的解决方案align*
。如果您想要一个围绕方程的框,您可以使用empheq
:
\documentclass{article}
\usepackage[svgnames]{xcolor} %
\usepackage{empheq}
\newcommand*\widefbox[1]{\setlength\fboxrule{0.8pt}\setlength\fboxsep{8pt}\fcolorbox{IndianRed}{white}{\enspace #1\enspace}}
\begin{document}
\begin{align*}
\mathrm{N}_{\mathbf{x}_{j_{1}},\mathbf{x}_{j_{2}},\mathbf{x}_{j_{3}},\mathbf{x}%
_{j_{4}}}^{( -1,1,1,-1) } & =\mathrm{N}_{\mathbf{x}_{j_{1}},\mathbf{x}%
_{j_{2}},\mathbf{x}_{j_{3}},\mathbf{x}_{j_{4}}}^{( 1,-1,1,-1)} =\mathrm{N}_{\mathbf{x}_{j_{1}},\mathbf{x}_{j_{2}},\mathbf{x}_{j_{3}},\mathbf{x}%
_{j_{4}}}^{( 1,1,-1,-1) }=\mathrm{N}_{\mathbf{x}_{j_{1}},\mathbf{x}%
_{j_{2}},\mathbf{x}_{j_{3}},\mathbf{x}_{j_{4}}}^{( -1,-1,-1,-1) }%
\\[1.5ex]
\mathrm{N}_{\mathbf{x}_{j_{1}},\mathbf{x}_{j_{2}},\mathbf{x}_{j_{3}},\mathbf{x}%
_{j_{4}}}^{( -1,-1,1,-1) } & =\mathrm{N}_{\mathbf{x}_{j_{1}},\mathbf{x}%
_{j_{2}},\mathbf{x}_{j_{3}},\mathbf{x}_{j_{4}}}^{( -1,1,-1,-1)
}=\mathrm{N}_{\mathbf{x}_{j_{1}},\mathbf{x}_{j_{2}},\mathbf{x}_{j_{3}},\mathbf{x}%
_{j_{4}}}^{( 1,-1,-1,-1) }=\mathrm{N}_{\mathbf{x}_{j_{1}},\mathbf{x}%
_{j_{2}},\mathbf{x}_{j_{3}},\mathbf{x}_{j_{4}}}^{( 1,1,1,-1) } \\
& =\frac{\mathrm{f}+1}{4}-\mathrm{N}_{\mathbf{x}_{j_{1}},\mathbf{x}_{j_{2}},\mathbf{x}_{j_{3}},%
\mathbf{x}_{j_{4}}}^{( -1,-1,-1,-1) }%
\\[1.5ex]
\mathrm{N}_{\mathbf{x}_{j_{1}},\mathbf{x}_{j_{2}},\mathbf{x}_{j_{3}},\mathbf{x}%
_{j_{4}}}^{( 1,1,1,1) } & =\mathrm{N}_{\mathbf{x}_{j_{1}},\mathbf{x}%
_{j_{2}},\mathbf{x}_{j_{3}},\mathbf{x}_{j_{4}}}^{( -1,-1,-1,-1)
}-1
\end{align*}%
\begin{empheq}[box = \widefbox]{align*}
\mathrm{N}_{\mathbf{x}_{j_{1}},\mathbf{x}_{j_{2}},\mathbf{x}_{j_{3}},\mathbf{x}%
_{j_{4}}}^{( -1,1,1,-1) } & =\mathrm{N}_{\mathbf{x}_{j_{1}},\mathbf{x}%
_{j_{2}},\mathbf{x}_{j_{3}},\mathbf{x}_{j_{4}}}^{( 1,-1,1,-1)} =\mathrm{N}_{\mathbf{x}_{j_{1}},\mathbf{x}_{j_{2}},\mathbf{x}_{j_{3}},\mathbf{x}%
_{j_{4}}}^{( 1,1,-1,-1) }=\mathrm{N}_{\mathbf{x}_{j_{1}},\mathbf{x}%
_{j_{2}},\mathbf{x}_{j_{3}},\mathbf{x}_{j_{4}}}^{( -1,-1,-1,-1) }%
\\[1.5ex]
\mathrm{N}_{\mathbf{x}_{j_{1}},\mathbf{x}_{j_{2}},\mathbf{x}_{j_{3}},\mathbf{x}%
_{j_{4}}}^{( -1,-1,1,-1) } & =\mathrm{N}_{\mathbf{x}_{j_{1}},\mathbf{x}%
_{j_{2}},\mathbf{x}_{j_{3}},\mathbf{x}_{j_{4}}}^{( -1,1,-1,-1)
}=\mathrm{N}_{\mathbf{x}_{j_{1}},\mathbf{x}_{j_{2}},\mathbf{x}_{j_{3}},\mathbf{x}%
_{j_{4}}}^{( 1,-1,-1,-1) }=\mathrm{N}_{\mathbf{x}_{j_{1}},\mathbf{x}%
_{j_{2}},\mathbf{x}_{j_{3}},\mathbf{x}_{j_{4}}}^{( 1,1,1,-1) } \\
& =\frac{\mathrm{f}+1}{4}-\mathrm{N}_{\mathbf{x}_{j_{1}},\mathbf{x}_{j_{2}},\mathbf{x}_{j_{3}},%
\mathbf{x}_{j_{4}}}^{( -1,-1,-1,-1) }%
\\[1.5ex]
\mathrm{N}_{\mathbf{x}_{j_{1}},\mathbf{x}_{j_{2}},\mathbf{x}_{j_{3}},\mathbf{x}%
_{j_{4}}}^{( 1,1,1,1) } & =\mathrm{N}_{\mathbf{x}_{j_{1}},\mathbf{x}%
_{j_{2}},\mathbf{x}_{j_{3}},\mathbf{x}_{j_{4}}}^{( -1,-1,-1,-1)
}-1
\end{empheq}%
\end{document}
答案4
你不需要\begin{table}[H]
,只需要一个显示。
有几种选择;如果你坚持规则,你最好使用booktabs
:
\documentclass{article}
\usepackage{mathtools,booktabs,array}
\newcommand{\N}{\mathrm{N}}
\newcommand{\x}{\mathbf{x}}
\begin{document}
\[
\renewcommand{\arraystretch}{1.5}
\setlength{\arraycolsep}{0pt}
\begin{array}{r >{{}}l}
\toprule[\lightrulewidth]
\N_{\x_{j_{1}},\x_{j_{2}},\x_{j_{3}},\x_{j_{4}}}^{(-1,1,1,-1)}
&= \N_{\x_{j_{1}},\x_{j_{2}},\x_{j_{3}},\x_{j_{4}}}^{(1,-1,1,-1)}
= \N_{\x_{j_{1}},\x_{j_{2}},\x_{j_{3}},\x_{j_{4}}}^{(1,1,-1,-1)}
= \N_{\x_{j_{1}},\x_{j_{2}},\x_{j_{3}},\x_{j_{4}}}^{(-1,-1,-1,-1)}
\\
\midrule
\N_{\x_{j_{1}},\x_{j_{2}},\x_{j_{3}},\x_{j_{4}}}^{(-1,-1,1,-1)}
&= \N_{\x_{j_{1}},\x_{j_{2}},\x_{j_{3}},\x_{j_{4}}}^{(-1,1,-1,-1)}
= \N_{\x_{j_{1}},\x_{j_{2}},\x_{j_{3}},\x_{j_{4}}}^{(1,-1,-1,-1)}
=\N_{\x_{j_{1}},\x_{j_{2}},\x_{j_{3}},\x_{j_{4}}}^{( 1,1,1,-1) }
\\
&= \tfrac{f+1}{4}-\N_{\x_{j_{1}},\x_{j_{2}},\x_{j_{3}},\x_{j_{4}}}^{(-1,-1,-1,-1)}
\\
\midrule
\N_{\x_{j_{1}},\x_{j_{2}},\x_{j_{3}},\x_{j_{4}}}^{(1,1,1,1)}
&= \N_{\x_{j_{1}},\x_{j_{2}},\x_{j_{3}},\x_{j_{4}}}^{(- 1,-1,-1,-1)}-1
\\
\bottomrule[\lightrulewidth]
\end{array}
\]
\end{document}
这里也是一样,但没有规则;第一行和第二行以及第三行和第四行之间需要额外的分隔。
\documentclass{article}
\usepackage{mathtools,booktabs,array}
\newcommand{\N}{\mathrm{N}}
\newcommand{\x}{\mathbf{x}}
\begin{document}
\[
\renewcommand{\arraystretch}{1.5}
\setlength{\arraycolsep}{0pt}
\begin{array}{r >{{}}l}
\N_{\x_{j_{1}},\x_{j_{2}},\x_{j_{3}},\x_{j_{4}}}^{(-1,1,1,-1)}
&= \N_{\x_{j_{1}},\x_{j_{2}},\x_{j_{3}},\x_{j_{4}}}^{(1,-1,1,-1)}
= \N_{\x_{j_{1}},\x_{j_{2}},\x_{j_{3}},\x_{j_{4}}}^{(1,1,-1,-1)}
= \N_{\x_{j_{1}},\x_{j_{2}},\x_{j_{3}},\x_{j_{4}}}^{(-1,-1,-1,-1)}
\\
\addlinespace
\N_{\x_{j_{1}},\x_{j_{2}},\x_{j_{3}},\x_{j_{4}}}^{(-1,-1,1,-1)}
&= \N_{\x_{j_{1}},\x_{j_{2}},\x_{j_{3}},\x_{j_{4}}}^{(-1,1,-1,-1)}
= \N_{\x_{j_{1}},\x_{j_{2}},\x_{j_{3}},\x_{j_{4}}}^{(1,-1,-1,-1)}
=\N_{\x_{j_{1}},\x_{j_{2}},\x_{j_{3}},\x_{j_{4}}}^{( 1,1,1,-1) }
\\
&= \tfrac{f+1}{4}-\N_{\x_{j_{1}},\x_{j_{2}},\x_{j_{3}},\x_{j_{4}}}^{(-1,-1,-1,-1)}
\\
\addlinespace
\N_{\x_{j_{1}},\x_{j_{2}},\x_{j_{3}},\x_{j_{4}}}^{(1,1,1,1)}
&= \N_{\x_{j_{1}},\x_{j_{2}},\x_{j_{3}},\x_{j_{4}}}^{(- 1,-1,-1,-1)}-1
\end{array}
\]
\end{document}
本质上,
\documentclass{article}
\usepackage{mathtools,booktabs,array}
\newcommand{\N}{\mathrm{N}}
\newcommand{\x}{\mathbf{x}}
\begin{document}
\begin{align*}
\N_{\x_{j_{1}},\x_{j_{2}},\x_{j_{3}},\x_{j_{4}}}^{(-1,1,1,-1)}
&= \N_{\x_{j_{1}},\x_{j_{2}},\x_{j_{3}},\x_{j_{4}}}^{(1,-1,1,-1)}
= \N_{\x_{j_{1}},\x_{j_{2}},\x_{j_{3}},\x_{j_{4}}}^{(1,1,-1,-1)}
= \N_{\x_{j_{1}},\x_{j_{2}},\x_{j_{3}},\x_{j_{4}}}^{(-1,-1,-1,-1)}
\\[1ex]
\N_{\x_{j_{1}},\x_{j_{2}},\x_{j_{3}},\x_{j_{4}}}^{(-1,-1,1,-1)}
&= \N_{\x_{j_{1}},\x_{j_{2}},\x_{j_{3}},\x_{j_{4}}}^{(-1,1,-1,-1)}
= \N_{\x_{j_{1}},\x_{j_{2}},\x_{j_{3}},\x_{j_{4}}}^{(1,-1,-1,-1)}
=\N_{\x_{j_{1}},\x_{j_{2}},\x_{j_{3}},\x_{j_{4}}}^{( 1,1,1,-1) }
\\
&= \tfrac{f+1}{4}-\N_{\x_{j_{1}},\x_{j_{2}},\x_{j_{3}},\x_{j_{4}}}^{(-1,-1,-1,-1)}
\\[1ex]
\N_{\x_{j_{1}},\x_{j_{2}},\x_{j_{3}},\x_{j_{4}}}^{(1,1,1,1)}
&= \N_{\x_{j_{1}},\x_{j_{2}},\x_{j_{3}},\x_{j_{4}}}^{(- 1,-1,-1,-1)}-1
\end{align*}
\end{document}