我需要创建一个行列式(vmatrix),如下图所示。因此,我编写了一个简单的 LaTEX 文件用于测试目的,如下所示:
\documentclass[a4paper,10pt]{article}
\usepackage{amsmath}
\begin{document}
\begin{equation*}
\begin{vmatrix}
0 &\cdot &\cdot &0 &a_{1} \alpha_{1}+ \cdots +k_{1} \alpha_{n} &\cdot &\cdot &a_{1} \kappa_{1}+ \cdots +k_{1} \kappa_{n} \\
\cdot &\cdot &\cdot &\cdot &\cdot &\cdot &\cdot &\cdot \\
0 &\cdot &\cdot &0 &a_{n} \alpha_{1}+ \cdots +k_{n} \alpha_{n} &\cdot &\cdot &a_{n} \kappa_{1}+ \cdots +k_{n} \kappa_{n} \\
-1 &\cdot &\cdot &0 &\alpha_{1} &\cdot &\cdot &\kappa_{1} \\
\cdot &\cdot &\cdot &\cdot &\cdot &\cdot &\cdot &\cdot \\
0 &\cdot &\cdot &-1 &\alpha_{n} &\cdot &\cdot &\kappa_{n}
\end{vmatrix}
\end{equation*}
\end{document}
当在 Linux 台式计算机上使用 TeXLive 编译上述文件时,它会产生以下丑陋的结果:我曾想过用\hdotsfor{}
它画水平线,但点之间的间距太近了。如果有一个简单的方法可以\hdotsfor{}
跳过每个点,我相信这样做就行了。不过,也许有人知道更好的方法。
答案1
这似乎是一个很好的近似值:
\documentclass[a4paper,10pt]{article}
\usepackage{amsmath}
\newcommand{\widedots}{%
.\cleaders\hbox to 2\tabcolsep{\hss.\hss}\hfill.%
\hspace*{0pt}%
}
\begin{document}
\begin{equation*}
\newcommand{\ak}[2]{%
\makebox[14\tabcolsep][s]{$\displaystyle a_{#2}#1_1+\dots+k_{#2}#1_n$}%
}
\begin{vmatrix}
0 & . & . & 0 & \ak{\alpha}{1} & . & . & \ak{\kappa}{1} \\
. & . & . & . & \widedots & . & . & \widedots \\
0 & . & . & 0 & \ak{\alpha}{n} & . & . & \ak{\kappa}{n} \\
-1 & . & . & 0 & \alpha_{1} & . & . & \kappa_{1} \\
. & . & . & . & \widedots & . & . & \widedots \\
0 & . & . & -1 & \alpha_{n} & . & . & \kappa_{n}
\end{vmatrix}
\end{equation*}
\end{document}
该值14\tabcolsep
是通过首先查看条目的自然宽度来确定的。
-1
如果我们隐藏它的宽度,甚至比原来更好。
\documentclass[a4paper,10pt]{article}
\usepackage{amsmath}
\newcommand{\widedots}{%
.\cleaders\hbox to 2\tabcolsep{\hss.\hss}\hfill.%
\hspace*{0pt}%
}
\begin{document}
\begin{equation*}
\newcommand{\ak}[2]{%
\makebox[14\tabcolsep][s]{$\displaystyle a_{#2}#1_1+\dots+k_{#2}#1_n$}%
}
\newcommand{\?}{\makebox[0pt]{$-1$}}
\begin{vmatrix}\mspace{8mu}
\begin{matrix}
0 & . & . & 0 & \ak{\alpha}{1} & . & . & \ak{\kappa}{1} \\
. & . & . & . & \widedots & . & . & \widedots \\
0 & . & . & 0 & \ak{\alpha}{n} & . & . & \ak{\kappa}{n} \\
\? & . & . & 0 & \alpha_{1} & . & . & \kappa_{1} \\
. & . & . & . & \widedots & . & . & \widedots \\
0 & . & . & \? & \alpha_{n} & . & . & \kappa_{n}
\end{matrix}\mspace{3mu}
\end{vmatrix}
\end{equation*}
\end{document}
使用\dots
和\hdotsfor
:
\begin{equation*}
\newcommand{\ak}[2]{a_{#2}#1_1+\dots+k_{#2}#1_n}
\begin{vmatrix}
0 & \dots & 0 & \ak{\alpha}{1} & \dots & \ak{\kappa}{1} \\
\hdotsfor{6} \\
0 & \dots & 0 & \ak{\alpha}{n} & \dots & \ak{\kappa}{n} \\
-1 & \dots & 0 & \alpha_{1} & \dots & \kappa_{1} \\
\hdotsfor{6} \\
0 & \dots & -1 & \alpha_{n} & \dots & \kappa_{n}
\end{vmatrix}
\end{equation*}
答案2
一种方法是手动放置一些具有水平空间的点。
\documentclass[a4paper,10pt]{article}
\usepackage{amsmath}
\begin{document}
\begin{equation*}
\begin{vmatrix}
0 &\cdot &\cdot &0 &a_{1} \alpha_{1}+ \cdots +k_{1} \alpha_{n} &\cdot &\cdot &a_{1} \kappa_{1}+ \cdots +k_{1} \kappa_{n} \\
\cdot &\cdot &\cdot &\cdot &\cdot \hfil \hfil \cdot \hfil \cdot \hfil \cdot \hfil \cdot &\cdot &\cdot &\cdot \hfil \hfil \cdot \hfil \cdot \hfil \cdot \hfil \cdot \\
0 &\cdot &\cdot &0 &a_{n} \alpha_{1}+ \cdots +k_{n} \alpha_{n} &\cdot &\cdot &a_{n} \kappa_{1}+ \cdots +k_{n} \kappa_{n} \\
-1 &\cdot &\cdot &0 &\alpha_{1} &\cdot &\cdot &\kappa_{1} \\
\cdot &\cdot &\cdot &\cdot &\cdot \hfil \hfil \cdot \hfil \cdot \hfil \cdot \hfil \cdot &\cdot &\cdot &\cdot \hfil \hfil \cdot \hfil \cdot \hfil \cdot \hfil \cdot \\
0 &\cdot &\cdot &-1 &\alpha_{n} &\cdot &\cdot &\kappa_{n}
\end{vmatrix}
\end{equation*}
\end{document}
答案3
为空列和空行定义两个新命令\twodts
和\fivedts
可以简化表格。
\documentclass[a4paper,10pt]{article}
\usepackage{amsmath}
\begin{document}
\newcommand{\twodts}{\begin{tabular}{@{}cc@{}}$\cdot$&$\cdot$\end{tabular}}
\newcommand{\fivedts}{\begin{tabular}{@{}*5{c}@{}}$\cdot$&$\cdot$&$\cdot$&$\cdot$&$\cdot$\end{tabular}}
\begin{equation*}
\begin{array}{|cccccc|}
0 & \twodts & 0 & a_1 \alpha_1+ \cdots +k_1 \alpha_n & \twodts & a_1 \kappa_1+ \cdots +k_1 \kappa_n \\
\cdot & \twodts & \cdot & \fivedts & \twodts & \fivedts \\
0 & \twodts & 0 & a_n \alpha_1+ \cdots +k_n \alpha_n & \twodts & a_n \kappa_1+ \cdots +k_n \kappa_n \\
-1 & \twodts & 0 & \alpha_1 & \twodts & \kappa_1 \\
\cdot & \twodts & \cdot & \fivedts & \twodts & \fivedts \\
0 & \twodts & -1 & \alpha_n & \twodts & \kappa_n
\end{array}
\end{equation*}
\end{document}
更新:
您可以轻松地调整我的答案以添加六个点而不是五个点,如下所示:
\documentclass[a4paper,10pt]{article}
\usepackage{amsmath,array}
\begin{document}
\def\twocdots{$\cdot$&$\cdot$}
\newcommand{\twodts}{\begin{tabular}{@{}cc@{}}\twocdots\end{tabular}}
\newcommand{\sixdts}{\begin{tabular}{@{}*6{c}@{}}\twocdots&\twocdots&\twocdots\end{tabular}}
\begin{equation*}
\begin{array}{|cccccc|}
0 & \twodts & 0 & a_1 \alpha_1+ \cdots +k_1 \alpha_n & \twodts & a_1 \kappa_1+ \cdots +k_1 \kappa_n \\
\cdot & \twodts & \cdot & \sixdts & \twodts & \sixdts \\
0 & \twodts & 0 & a_n \alpha_1+ \cdots +k_n \alpha_n & \twodts & a_n \kappa_1+ \cdots +k_n \kappa_n \\
-1 & \twodts & 0 & \alpha_1 & \twodts & \kappa_1 \\
\cdot & \twodts & \cdot & \sixdts & \twodts & \sixdts \\
0 & \twodts & -1 & \alpha_n & \twodts & \kappa_n
\end{array}
\end{equation*}
\end{document}
答案4
这可以接受吗?
\documentclass[a4paper,10pt]{article}
\usepackage{amsmath}
\begin{document}
\begin{equation*}
\begin{vmatrix}
0 &\cdots &0 &a_{1} \alpha_{1}+ \cdots +k_{1} \alpha_{n} &\cdots &a_{1} \kappa_{1}+ \cdots +k_{1} \kappa_{n} \\
\vdots &\ddots &\vdots &\vdots &\ddots &\vdots \\
0 &\cdots & 0 &a_{n} \alpha_{1}+ \cdots +k_{n} \alpha_{n} &\cdots &a_{n} \kappa_{1}+ \cdots +k_{n} \kappa_{n} \\
-1 &\cdots &0 &\alpha_{1} &\cdots &\kappa_{1} \\
\vdots &\ddots &\vdots &\vdots &\ddots &\vdots \\
0 &\cdots & -1 &\alpha_{n} &\cdots &\kappa_{n}
\end{vmatrix}
\end{equation*}
\end{document}