带点填充的数组环境

带点填充的数组环境

我必须创建这个数组:

在此处输入图片描述

我已经尝试过这个代码:

~$$+\left\{\begin{array}{lll} m_1 (x_1-x_0)&\leq I_a(x_1)-I_a(x_0)&\leq M_1(x_1-x_0)\\
m_2(x_2-x_1)&\leq I_a(x_2)-I_a(x_1)&\leq M_2(x_2-x_1)\\
\multicolumn{3}{r}{\dotfill}\\
    m_{n-1}(x_{n-1}-x_{n-2})&\leq I_a(x_{n-1})-I_a(x_{n-2})&\leq M_{n-1}(x_{n-1}-x_{n-2})\\
m_n(x_n-x_{n-1})&\leq I_a(x_n)-I_a(x_{n-1})&\leq M_n(x_n-x_{n-1})
\end{array}\right.$$
$$\begin{array}{lll}
\multicolumn{3}{l}{\hrulefill}\\
\sum\limits_{i=1}^{n}m_i(x_i-x_{i-1})&\leq I_a(x_n)-I_a(x_0)&\leq \sum\limits_{i=1}^n M_i(x_i-x_{i-1})\end{array}$$~

不幸的是,dotfill 和 hrulefill 在数组环境中不起作用。还有其他方法可以获取上图中的数组吗?

谢谢你!

答案1

像这样?

在此处输入图片描述

它是通过amsmath包和tikz库获得的tikzmark。解决方案至少需要两次编译:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing,
                calligraphy,
                tikzmark}
\usepackage{amsmath}

\begin{document}
\[\setlength\arraycolsep{1.2pt}
\begin{array}{lll}
\tikzmarknode{A}{m_1 (x_1-x_0)}   
                &   \leq I_a(x_1)-I_a(x_0)  &   \leq M_1(x_1-x_0)   \\
m_2(x_2-x_1)    &   \leq I_a(x_2)-I_a(x_1)  &   \leq M_2(x_2-x_1)   \\
\hdotsfor{3}    \\
m_{n-1}(x_{n-1}-x_{n-2})
                &   \leq I_a(x_{n-1})-I_a(x_{n-2})
                                            &   \leq M_{n-1}(x_{n-1}-x_{n-2})   \\
\tikzmarknode{B}{m_n(x_n-x_{n-1})}
                &\leq I_a(x_n)-I_a(x_{n-1}) &   \leq M_n(x_n-x_{n-1})           \\
\hline
\sum\limits_{i=1}^{n}m_i(x_i-x_{i-1})
                &   \leq I_a(x_n)-I_a(x_0)  &   \leq \sum\limits_{i=1}^n M_i(x_i-x_{i-1})
\end{array}
    \begin{tikzpicture}[
overlay, remember picture,
B/.style = {decorate,
            decoration={calligraphic brace, amplitude=4pt,
            raise=7pt, mirror},% for mirroring of brace
            thick,
            pen colour=black},
nodes={inner sep=1pt, align=left}
                        ]
\draw[B] (A.north west) --  node [left=12pt] {+} (B.south west);
\end{tikzpicture}
\]
\end{document}

使用mathtools包和数学环境可以获得相同的结果{matrix*}[l]

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing,
                calligraphy,
                tikzmark}
\usepackage{mathtools}

\begin{document}
\[\setlength\arraycolsep{1.2pt}
\begin{matrix*}[l]
 ... < the same code as in above MWE >
\end{matrix*}
... < the same code as in above MWE >
\]
\end{document}

附录: 我宁愿使用\vdots而不是水平\hdotsfor

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing,
                calligraphy,
                tikzmark}
\usepackage{mathtools}
\usepackage{booktabs}

\begin{document}
\[\setlength\arraycolsep{1.2pt}
\begin{matrix*}[l]
\tikzmarknode{A}{m_1 (x_1-x_0)}   
                &   \leq I_a(x_1)-I_a(x_0)  &   \leq M_1(x_1-x_0)   \\
m_2(x_2-x_1)    &   \leq I_a(x_2)-I_a(x_1)  &   \leq M_2(x_2-x_1)   \\
\qquad\vdots    &   \qquad\vdots            &   \qquad\vdots        \\
m_{n-1}(x_{n-1}-x_{n-2})
                &   \leq I_a(x_{n-1})-I_a(x_{n-2})
                                            &   \leq M_{n-1}(x_{n-1}-x_{n-2})   \\
\tikzmarknode{B}{m_n(x_n-x_{n-1})}
                &\leq I_a(x_n)-I_a(x_{n-1}) &   \leq M_n(x_n-x_{n-1})           \\%[3pt]
    \midrule
\sum\limits_{i=1}^{n}m_i(x_i-x_{i-1})
                &   \leq I_a(x_n)-I_a(x_0)  &   \leq \sum\limits_{i=1}^n M_i(x_i-x_{i-1})
\end{matrix*}
    \begin{tikzpicture}[
overlay, remember picture,
B/.style = {decorate,
            decoration={calligraphic brace, amplitude=4pt,
            raise=7pt, mirror},% for mirroring of brace
            thick,
            pen colour=black},
nodes={inner sep=1pt, align=left}
                        ]
\draw[B] (A.north west) --  node [left=12pt] {+} (B.south west);
\end{tikzpicture}
\]
\end{document}

在我看来,这给出了更符合逻辑的结构化方程式表示:

在此处输入图片描述

笔记: 在 LaTeX 文档中,切勿使用 TeX 命令$$来显示方程式。而是使用\[配对\]equation*环境。

答案2

一些测量是必要的;这里有一些不太复杂的技巧来设置列的宽度并将它们保存在下一个数组中。

\documentclass{article}
\usepackage{amsmath,array,booktabs}

\begin{document}

\begingroup % to keep settings local
\dimendef\colA=2
\dimendef\colB=4
\dimendef\colC=6
\dimendef\colD=8
\settowidth\colA{$m_{n-1}(x_{n-1}-x_{n-2})$}%
\settowidth\colB{$I_a(x_{n-1})$}%
\settowidth\colC{$I_a(x_{n-2})$}%
\settowidth\colD{$M_{n-1}(x_{n-1}-x_{n-2})$}%
\setlength{\arraycolsep}{0pt}%
\newcolumntype{u}[1]{>{$\displaystyle}w{l}{#1}<{$}}%
\newcolumntype{o}{>{{}}c<{{}}}
\begin{align*}
+\left\{
   \vphantom{
     \begin{array}{c}
     I_a\\
     \addlinespace
     I_a\\
     \addlinespace
     I_a\\
     I_a\\
     I_a\\
     \end{array}
   }\right.&
 \begin{array}{ u{\colA} o u{\colB} o u{\colC} o u{\colD} }
   m_1(x_1-x_0)             &\leq& I_a(x_1)     &-& I_a(x_0)     &\leq& M_1(x_1-x_0)\\
   \addlinespace
   m_2(x_2-x_1)             &\leq& I_a(x_2)     &-& I_a(x_1)     &\leq& M_2(x_2-x_1)\\
   \multicolumn{7}{c}{\dotfill}\\
   m_{n-1}(x_{n-1}-x_{n-2}) &\leq& I_a(x_{n-1}) &-& I_a(x_{n-2}) &\leq& M_{n-1}(x_{n-1}-x_{n-2})\\
   \addlinespace
   m_n(x_n-x_{n-1})         &\leq& I_a(x_n)     &-& I_a(x_{n-1}) &\leq& M_n(x_n-x_{n-1})
  \end{array}
\\
&
\begin{array}{ u{\colA} o u{\colB} o u{\colC} o u{\colD} }
\midrule
\sum_{i=1}^{n}m_i(x_i-x_{i-1}) &\leq& I_a(x_n) &-& I_a(x_0) &\leq& \sum_{i=1}^n M_i(x_i-x_{i-1})
\end{array}
\end{align*}
\endgroup

\end{document}

在此处输入图片描述

答案3

与。{NiceArray}nicematrix

\documentclass{article}
\usepackage{nicematrix}
\usepackage{tikz}

\begin{document}
\[
\setlength\arraycolsep{1.2pt}
\begin{NiceArray}{lll}
m_1 (x_1-x_0)           & \le I_a(x_1)-I_a(x_0)         & \le M_1(x_1-x_0) \\
m_2(x_2-x_1)            & \le I_a(x_2)-I_a(x_1)         & \le M_2(x_2-x_1) \\
\Hdotsfor{3} \\
m_{n-1}(x_{n-1}-x_{n-2})& \le I_a(x_{n-1})-I_a(x_{n-2}) & \le M_{n-1}(x_{n-1}-x_{n-2})   \\
m_n(x_n-x_{n-1})        & \le I_a(x_n)-I_a(x_{n-1})     & \le M_n(x_n-x_{n-1})           \\
\hline
\sum\limits_{i=1}^{n}m_i(x_i-x_{i-1}) & \le I_a(x_n)-I_a(x_0) & \le \sum\limits_{i=1}^n M_i(x_i-x_{i-1})
\CodeAfter
  \SubMatrix\{{1-1}{5-1}{.}[name=MyBrace]
  \tikz \path (MyBrace-left) node [left] { $+$ } ;
\end{NiceArray}
\]
\end{document}

上述代码的输出

相关内容