![如何在 LaTex 中组织表格?](https://linux22.com/image/459479/%E5%A6%82%E4%BD%95%E5%9C%A8%20LaTex%20%E4%B8%AD%E7%BB%84%E7%BB%87%E8%A1%A8%E6%A0%BC%EF%BC%9F.png)
你能帮忙整理一下下面的表格吗?表格的最后两行很乱。
\begin{center}
\begin{tabular}{ ||c|c|| }
\hline
\hline
&\\
Singular matrix & Non-singular matrix \\&\\
\hline
\hline
&\\
A matrix $A$ is singular if
$det(A)=0$
& A matrix $A$ is non-singular
$det(A)\ne0$
\\ &\\
\hline
&\\
If $A$ is singular, then $A^{-1}$ is not defined & If $A$ is non-singular, then $A^{-1}$ is defined \\&\\
\hline
&\\
Rank of $A <$ order of $ A$. &Rank of $A=$ order of $A$. \\&\\
\hline
&\\
Some rows and columns are linearly dependent. & All rows and columns are linearly independent \\&\\
\hline
&\\
If $A$ singular, then the system of equations\\ $A\bx=\bb$
has either no solution or\\infinitely many solutions.
& If A non-singular, then the system of equations\\& $A\bx=\bb$ has unique solutions.
\\&\\
\hline
&\\
Example: $
\left[\begin{array}{ll}
3 & 6 \\
1 & 2 \\
\end{array}\right]
$ is singular because
\\
$\left|\begin{array}{ll}3 & 6 \\ 1 & 2\end{array}\right|=(3 \times 2)-(6 \times 1)$
$=6-6=0$
& Example: $
\left[\begin{array}{ll}
3 & 2 \\
1 & -2 \\
\end{array}\right]
$ is non-singular because
\\&
$\left|\begin{array}{ll}3 & 2 \\ 1 & -2\end{array}\right|=(3 \times (-2))-(2 \times 1)$
$=-8\ne0$&\\
\hline
\hline
\end{tabular}
\end{center}
答案1
双线与其他单/双线的交互始终存在问题,正如您在表格角落中看到的那样。要制作具有单双规则的“监禁”表格,请考虑使用包hhlines
:
为了制作更加优雅的表格,请考虑囚禁思想的可憎之处,并使用以下方法释放您的文本booktabs
:
\documentclass{article}
\usepackage[margin=2cm]{geometry}
\usepackage{tabularx,tabulary}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\usepackage{hhline,booktabs}
\begin{document}
\renewcommand\arraystretch{2}
\noindent\begin{tabularx}{\linewidth}{||C|C||}
\hhline{|t:==:t|} Singular matrix & Non-singular matrix \\
\hhline{|:==:|} A matrix $A$ is singular if $det(A)=0$ & A matrix $A$ is non-singular $det(A)\ne0$ \\
\hhline{||-|-||} If $A$ is singular, then $A^{-1}$ is not defined & If $A$ is non-singular, then $A^{-1}$ is defined \\
\hhline{||-|-||} Rank of $A <$ order of $ A$. &Rank of $A=$ order of $A$. \\
\hhline{||-|-||} Some rows and columns are linearly dependent. & All rows and columns are linearly independent \\
\hhline{||-|-||} If $A$ singular, then the system of equations $Ax=b$ has either no solution or infinitely many solutions.
& If A non-singular, then the system of equations $Ax=b$ has unique solutions. \\
\hhline{||-|-||} Example: & Example: \\
\renewcommand\arraystretch{1}
$\left[\begin{array}{ll} 3 & 6 \\ 1 & 2 \\\end{array}\right]$ is singular because \bigskip\par
$\left|\begin{array}{ll}3 & 6 \\ 1 & 2\end{array}\right|=(3 \times 2)-(6 \times 1)$
$=6-6=0$\par &
\renewcommand\arraystretch{1}
$\left[\begin{array}{ll} 3 & 2 \\ 1 & -2 \\\end{array}\right]$ is non-singular because \bigskip\par
$\left|\begin{array}{ll}3 & 2 \\ 1 & -2\end{array}\right|=(3 \times (-2))-(2 \times 1)$
$=-8\ne0$par\\
\hhline{|b:=b=:b|}
\end{tabularx}
\vspace{1cm}
\renewcommand\arraystretch{1} % return to defeult
\tabcolsep2em
\noindent\begin{tabularx}{\linewidth}{@{}c@{\quad}Xc@{\quad}X@{}} \toprule[1.5pt]\addlinespace
\multicolumn{2}{c}{Singular matrix} & \multicolumn{2}{c}{Non-singular matrix} \\
\cmidrule(rl){1-2}\cmidrule(rl){3-4}\addlinespace
$\bullet$\quad & A matrix $A$ is singular if $det(A)=0$. &
$\bullet$\quad & A matrix $A$ is non-singular $det(A)\ne0$. \\\addlinespace
$\bullet$\quad & If $A$ is singular, then $A^{-1}$ is not defined . &
$\bullet$\quad & If $A$ is non-singular, then $A^{-1}$ is defined. \\\addlinespace
$\bullet$\quad & Rank of $A <$ order of $ A$. &
$\bullet$\quad & Rank of $A=$ order of $A$. \\\addlinespace
$\bullet$\quad & Some rows and columns are linearly dependent. &
$\bullet$\quad & All rows and columns are linearly independent. \\\addlinespace
$\bullet$\quad & If $A$ singular, then the system of equations $Ax=b$ has either no solution or infinitely many solutions. &
$\bullet$\quad & If A non-singular, then the system of equations $Ax=b$ has unique solutions. \\\addlinespace[3ex]
\multicolumn{2}{c}{Example:} & \multicolumn{2}{c}{Example:} \\
\cmidrule(rl){1-2}\cmidrule(rl){3-4}\addlinespace
\addlinespace
& \hfil $\left[\begin{array}{ll} 3 & 6 \\ 1 & 2 \\\end{array}\right]$ is singular because \bigskip\par
\hfil $\left|\begin{array}{ll}3 & 6 \\ 1 & 2\end{array}\right|=(3 \times 2)-(6 \times 1)$
$=6-6=0$\par & &
\hfil $\left[\begin{array}{ll} 3 & 2 \\ 1 & -2 \\\end{array}\right]$ is non-singular because \bigskip\par
\hfil $\left|\begin{array}{ll}3 & 2 \\ 1 & -2\end{array}\right|=(3 \times (-2))-(2 \times 1)$
$=-8\ne0$par\\
\bottomrule[1.5pt]
\end{tabularx}
\end{document}
答案2
我会重新设计你的表格如下:
为此我使用了以下软件包:
tabularray
对于tblr
表格,enumitem
用于矩阵属性列表amsmath
tabularray
作为用于编写矩阵和行列式的库加载- 写行列式
$det...$
用的是 mah 算符 $\det$
通过考虑上述所有内容,MWE 变得更短更清晰:
\documentclass{article}
\usepackage[a4paper,margin=2cm]{geometry}
\usepackage{enumitem}
\usepackage{tabularray}
\UseTblrLibrary{amsmath, varwidth}
\newcommand{\bx}{\mathbf{x}}
\newcommand{\bb}{\mathbf{b}}
\begin{document}
\begin{center}
\setlist[itemize]{nosep,
itemsep=0.5ex,
leftmargin=*}
\begin{tblr}{hlines, vlines,
colspec = {X[l] X[l]},
measure = vbox,
row{1} = {font=\bfseries, c},
row{Z} = {abovesep=5pt},
stretch=-1,%<--- remove extra space above and below lists
% with nosep option; doc p.51 tabularray
}
Singular matrix
& Non-singular matrix \\
\begin{itemize}
\item A matrix $A$ is singular if $\det(A)=0$
\item If $A$ is singular, then $A^{-1}$ is not defined
\item Rank of $A <$ order of $ A$.
\item Some rows and columns are linearly dependent.
\item If $A$ singular, then the system of equations $A\bx=\bb$
has either no solution or infinitely many solutions.
\end{itemize}
& \begin{itemize}
\item A matrix $A$ is non-singular $\det(A)\ne0$
\item If $A$ is non-singular, then $A^{-1}$ is defined
\item Rank of $A=$ order of $A$.
\item All rows and columns are linearly independent
\item If A non-singular, then the system of equations $A\bx=\bb$ has unique solutions.
\end{itemize} \\
%
\textbf{Example:}\par\medskip
$A = \begin{bmatrix}
3 & 6 \\
1 & 2 \\
\end{bmatrix}$ is singular because
\[
\det A = \begin{vmatrix}
3 & 6 \\
1 & 2 \\
\end{vmatrix} =(3\times 2) - (6\times 1) = 6-6 = 0
\]
%%
& \textbf{Example:}\par\medskip
$A = \begin{bmatrix}
3 & 2 \\
1 & -2 \\
\end{bmatrix}$ is non-singular because
\[
\det A = \begin{vmatrix}
3 & 2 \\
1 & -2 \\
\end{vmatrix} = (3\times (-2)) - (2\times 1) = -8\ne0
\] \\
\end{tblr}
\end{center}
\end{document}
如果矩阵属性和示例之间确实需要界限,我会再次重新考虑。
答案3
\documentclass{article}
\usepackage[a4paper,margin=2cm]{geometry}
\usepackage{tabularx}
\newcommand{\bx}{\mathbf{x}}
\newcommand{\bb}{\mathbf{b}}
\newcommand{\pbx}[1]{{\centering #1}}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\begin{document}
\begin{center}
\begin{tabularx}{\textwidth}{ ||C|C|| }
\hline
\hline
&\\
Singular matrix & Non-singular matrix \\&\\
\hline
\hline
&\\
A matrix $A$ is singular if
$det(A)=0$
& A matrix $A$ is non-singular
$det(A)\ne0$
\\ &\\
\hline
&\\
If $A$ is singular, then $A^{-1}$ is not defined & If $A$ is non-singular, then $A^{-1}$ is defined \\&\\
\hline
&\\
Rank of $A <$ order of $ A$. &Rank of $A=$ order of $A$. \\&\\
\hline
&\\
Some rows and columns are linearly dependent. & All rows and columns are linearly independent \\&\\
\hline
&\\
\pbx{If $A$ singular, then the system of equations\\ $A\bx=\bb$
has either no solution or\\infinitely many solutions.}
& \pbx{If A non-singular, then the system of equations\\ $A\bx=\bb$ has unique solutions.}
\\&\\
\hline
&\\
\pbx{Example: $
\left[\begin{array}{ll}
3 & 6 \\
1 & 2 \\
\end{array}\right]
$ is singular because
\\
$\left|\begin{array}{ll}3 & 6 \\ 1 & 2\end{array}\right|=(3 \times 2)-(6 \times 1)$
$=6-6=0$}
& \pbx{Example: $
\left[\begin{array}{ll}
3 & 2 \\
1 & -2 \\
\end{array}\right]
$ is non-singular because
\\
$\left|\begin{array}{ll}3 & 2 \\ 1 & -2\end{array}\right|=(3 \times (-2))-(2 \times 1)$
$=-8\ne0$} \\&\\
\hline
\hline
\end{tabularx}
\end{center}
\end{document}