2

I have to create this array:

enter image description here

I've tried this code:

~$$+\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}$$~

Unfortunately the dotfill und the hrulefill doesn't work in an array-enviroment. Is there any other possibility to get the array in the picture above?

Thank you!

0

3 Answers 3

0

Like this?

enter image description here

It is obtain with help of amsmath package and tikz library tikzmark. Solution need at least two compilation:

\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}

The same result you can obtain with use of mathtools package and math environment {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}

Addendum: I'd rather use \vdots instead of horizontal \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}

which gives to my opinion more logical structured presentation of equation:

enter image description here

Note: in LaTeX documents never use TeX commands $$ for displayed equations. Rather use \[ and \] pair or equation* environment.

3
  • Thanks for your answer! I agree with your structure but two errors occurred: \tikzmarknode has to be \tikzmark node right? And: "No shaped name A is known" (and the same for node B).
    – jacmeird
    Oct 12, 2019 at 11:04
  • @jacmeird, in MWE are not errors. I use tikzmarknode and it works fine. However its require recent tikzmark library. Try to update your LaTeX installation or at list package tikzmark.
    – Zarko
    Oct 12, 2019 at 11:14
  • @jacmeird, uh, small error in above comment. Last sentence should be: "Try to update your LaTeX installation or at least packages tikz and tikzmark ".
    – Zarko
    Oct 12, 2019 at 11:38
1

Some measuring is necessary; here are some not so complex tricks to set the width of the columns and preserve them in the next array.

\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}

enter image description here

0

With {NiceArray} of 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}

Output of the above code

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .