I am trying to make an array or matrix to represent this matrix:
But unfortunately, I don't manage to do it (I even don't know if I should do it with an array or a pmatrix). So, if someone can help me...
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityThis is a fairly faithful reproduction of the matrix using the nicematrix
package.
The solid lines were drawn using the package's ability to insert tikz commands (with \CodeAfter
) between the nodes it creates in the cells.
Requires compiling twice.
\documentclass[12pt,a4paper]{article}
\usepackage{tikz} % needed <<<<<<<
\usepackage{nicematrix} % needed <<<<<<<
\begin{document}
\setcounter{MaxMatrixCols}{20}
\[\tilde{A'} = \begin{pNiceMatrix}[first-row, cell-space-limits=5pt]
& & &j_{1} & & & &j_{2} & &\cdots & &j_{r-1}& &\cdots & &j_{r} & & & &\\
0 &- &0 &1 &* &\Cdots &* &0 &* &\Cdots &* &0 &* &\Cdots &* &0 &* &\Cdots &* &b'_{1} \\
& & & & & & & & & &\Vdots &\Vdots &\Vdots & &\Vdots &\Vdots &\Vdots & &\Vdots & \\[-10pt]
& &0 & & & &0 &1 &* & & & & & & & & & & &b'_{2} \\
& & & & & & & & & & & & & & & & & & & \\[-10pt]
& & & & & &0 & & & & & & & & & & & & &b'_{3} \\
& & & & & & & & & &* &0 & & & & & & & &\Vdots \\
& & & & & & & & & &0 &1 &* &\Cdots &* &0 & & & &b'_{r-1}\\
& & & & & & & & & & & & & & & & & & & \\[-10pt]
& & & & & & & & & &0 & & & &0 &1 &* &\Cdots &* &b'_{r} \\
& & & & & & & & & & & & & & & & & & & \\[-10pt]
& & & & & & & & & & & & & &0 & & & &0 &b'_{r+1}\\
& & & & & & & & & & & & & & & & & & &\Vdots \\
0 & & & & & & & & & & & & & & & & & &0 &b'_{n} \\
\CodeAfter
\tikz \draw (2-|1.5) -- (13-|1.5);
\tikz \draw (3-|4) -- (3-|7);
\tikz \draw (5-|8) -- (5-|9);
\tikz \draw (7.5-|10) -- (7.5-|11);
\tikz \draw (9-|12) -- (9-|15);
\tikz \draw (11-|16) -- (11-|19);
\tikz \draw (13.5-|2) -- (13.5-|19);
\tikz \draw (2-|3.5) -- (2.5-|3.5);
\tikz \draw (4-|7.5) -- (4.5-|7.5);
\tikz \draw (8-|11.5) -- (8.5-|11.5);
\tikz \draw (10-|15.5) -- (10.5-|15.5);
\tikz \draw (12-|19.5) -- (13-|19.5);
\end{pNiceMatrix}\]
\end{document}
\Vdot
s) ended up taller than the the others blank lines so the third line is in a lower position. For the same reason, the second vertical line --one row high--, is longer than the next three. The improvement is left to the reader :-)
Oct 24, 2021 at 21:19
\` (eg
\[-10pt]) are not compatible with
nicematrix` and that's why there is a problem with the position of the Tikz nodes...
Oct 26, 2021 at 9:01
Here is another solution with nicematrix
.
\documentclass[a4paper,10pt]{article}
\usepackage{tikz}
\usepackage{nicematrix}
\begin{document}
\setcounter{MaxMatrixCols}{20}
\[
\renewcommand{\arraystretch}{1.4}
\widetilde{A'}=
\begin{pNiceMatrix}[nullify-dots,first-row]
& &j_1& & & &j_2& &\cdots & &j_{r-1}& &\cdots& &j_r & & & &\\
0&0&1 &*&\Cdots&*&0 &*&\hspace*{1cm}& * &0 &* &\Cdots&* &0 &* &\Cdots&* &b_1' \\
&0& & & &0&1 &*& &\Vdots&\Vdots&\Vdots& &\Vdots&\Vdots&\Vdots& &\Vdots&b_2' \\
& & & & &0& & & & & & & & & & & & &b_3' \\
& & & & & & & & &* &0 & & & & & & & &\Vdots \\
& & & & & & & & &0 &1 &* &\Cdots&* &0 & & & &b_{r-1}' \\
& & & & & & & & &0 & & & &0 &1 &* &\Cdots&* &b_r' \\
& & & & & & & & & & & & &0 & & & &0 &b_{r+1}' \\
& & & & & & & & & & & & & & & & & &\Vdots \\
0& & & & & & & & & & & & & & & & &0 &b_n'
\CodeAfter
\begin{tikzpicture} [shorten < = 1mm, shorten > = 1mm]
\draw (3-6) -- ++(1cm,0) ;
\draw (2-6) -- (3-6) ;
\draw (2-2) -- (2-6) ;
\draw (1-2) -- (2-2) ;
\draw (1-1) -- (1-2) ;
\draw (1-1) -- (last-1) ;
\draw (last-1) -- (last-18) ;
\draw (last-18) -- (7-18) ;
\draw (7-18) -- (7-14) ;
\draw (7-14) -- (6-14) ;
\draw (6-14) -- (6-10) ;
\draw (6-10) -- (5-10) ;
\draw (5-10) -- ++(-1cm,0) ;
%
\draw [dashed] (1-8) -- (1-10) ;
\end{tikzpicture}
\end{pNiceMatrix}
\]
\end{document}
As usual with nicematrix
, you need several compilations.
nicematrix
have good features to achieve this...Please post the content your image inTeX
format, as no one wants tokeyin
the content....