을 사용하여 다음 이미지를 생성했습니다 nicematrix
.
모든 것이 잘 작동합니다. 그래서 현재로서는 긴급한 문제는 없습니다.
메모:결과 또는 광학은 정확히 원하는 대로입니다. 다음에서는 nicematrix-package를 최적으로 사용하기 위한 코드의 몇 가지 미묘한 부분에만 관심이 있습니다.
그러나 개인적인 관심으로 인해 저는 다음 두 가지에 관심을 두었습니다.
"A1 A2 ... A4"
전체에 수직으로 중앙에 위치해야 합니다.
여기서는 괜찮 습니까 ? 아니면 의 의미에서 더 잘했어야 했나요 ?
\Block{2-1}{A1} & \Block{2-1}{A2} & \Block{2-1}{\cdots} & \Block{2-1}{A4} ... \\
nicematrix.sty
위와 아래에는
"A1 A2 ... A4"
각각 행렬의 끝에 수직선을 추가했습니다.
에 대한아래쪽 라인시각적인 조정을 해야 했습니다.
\draw[
shorten <=1em+2pt
] (2-\col) -- (last-|\col.5);
이는 내용이 변경되면 조정이 다시 필요할 수 있음을 의미합니다.
좀 더 안정적이고 유연하게 만들 수 있을까요?
암호:
\documentclass{article}
\usepackage{amsmath}
\usepackage{nicematrix}
\usepackage{tikz}
\begin{document}
$M=\begin{NiceArray}{(c c c c) c (c c c c)}
& & & & \Block{*-1}{\cdot} & B1 & & & \\
\Block{2-1}{A1} & \Block{2-1}{A2} & \Block{2-1}{\cdots} & \Block{2-1}{A4}
& & & B2 & & \\
& & & & & & & \ddots & \\
& & & & & & & & B4
\CodeAfter
\begin{tikzpicture}[]
% Verticals =====================
\foreach \col in {1,2,4}{%%
\draw[shorten <=0pt] (2-\col) -- (1-|\col.5) ;
\draw[shorten <=1em+2pt] (2-\col) -- (last-|\col.5) ;
}%%
\end{tikzpicture}
% Underbracing =================
\UnderBrace[yshift=2pt]{4-6}{4-9}{=X}
\end{NiceArray}$
\end{document}
답변1
원하는 기준선을 얻으 baseline=<row number>
려면 NiceArray
. 그러나 이를 위해서는 A1
블록이 아닌 자체 행에 있어야 합니다. 한 가지 가능성은 5개의 행과 10개의 열로 배열을 만드는 것입니다. 그런 다음 "두 번째" 배열에서 2 x 2 Block
for 를 사용합니다 \ddots
.
기타 변경사항:
- 두 개의 별도 배열을 사용한 것과 같은 간격이 되도록 열의
\,
오른쪽과 왼쪽에 얇은 공간( )을 배치합니다 .\cdot
myline
수직선을 짧게 하려면 새로운 스타일(아래 코드)을 만드세요 .A1
,A2
등이 자체 셀에 있으므로 간격이 균일합니다 .
코드는 다음과 같습니다.
\documentclass{article}
\usepackage{amsmath}
\usepackage{nicematrix}
\usepackage{tikz}
\tikzset{myline/.style={shorten <=3pt}}
\begin{document}
$M=\begin{NiceArray}{(cccc)!\,c!\,(ccccc)}[baseline=3]
& & & & \Block{*-1}{\cdot} & B1\\
& & & & & & B2 \\
A1 & A2 & \cdots & A4 & & & & \Block{2-2}{\ddots} \\
\\
& & & & & & & & & B4
\CodeAfter
\begin{tikzpicture}[]
% Verticals =====================
\foreach \col in {1,2,4}{%%
\draw[myline] (3-\col) -- (1-|\col.5) ;
\draw[myline] (3-\col) -- (last-|\col.5) ;
}%%
\end{tikzpicture}
% Underbracing =================
\UnderBrace[yshift=2pt]{5-6}{5-10}{=X}
\end{NiceArray}$
\end{document}
답변2
줄을 아래에 유지하려면 라이브러리 에서 "A1 A2 ... A4"
사용해야 합니다.\tikzmarknode
tikzmark
\documentclass{article}
\usepackage[x11names]{xcolor}
\usepackage{amsmath}
\usepackage{nicematrix}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{tikzmark}
\begin{document}
\begin{equation*}
\setlength{\arraycolsep}{1em}
\smash{\rlap{\rule{11cm}{0.1pt}}}
M
=
\begin{NiceArray}{(c c c c) c (c c c c)}
\CodeBefore [create-cell-nodes]
\Body
& & & & \Block{*-1}{\cdot} & B1 & & & \\
\Block{2-1}{\tikzmarknode{A1}{A1}} & \Block{2-1}{\tikzmarknode{A2}{A2}} & \Block{2-1}{\cdots} & \Block{2-1}{\tikzmarknode{A4}{A4}}
& & & B2 & & \\
& & & & & & & \ddots & \\
& & & & & & & & B4
\CodeAfter
\begin{tikzpicture}[]
% Verticals =====================
\draw[shorten <=1pt] (A1.north) -- (1-|1.5);
\draw[shorten <=1pt] (A2.north) -- (1-|2.5);
\draw[shorten <=1pt] (A4.north) -- (1-|4.5);
\draw[shorten >=1pt] (last-|1.5) -- (A1.south);
\draw[shorten >=1pt] (last-|2.5) -- (A2.south);
\draw[shorten >=1pt] (last-|4.5) -- (A4.south);
\end{tikzpicture}
% Underbracing =================
\UnderBrace[yshift=2pt]{4-6}{4-9}{=X}
\end{NiceArray}
\end{equation*}
\end{document}