다음 출력을 얻기 위해 매트릭스에 일부 중괄호를 추가하고 싶습니다.
그러나 이것이 내가 얻은 것입니다.
뉴런 1과 뉴런 2 제목을 얻는 방법을 모르겠습니다...오버브레이스를 생각하고 있었지만 이 경우 어떻게 사용하는지 잘 모르겠습니다. 행렬 오른쪽에 있는 항목이 제대로 정렬되지 않았습니다. 방정식 번호도 다음 줄로 이동합니다. 누구든지 도와주세요.
내 코드는 다음과 같습니다(amsmath 패키지를 사용하고 있습니다).
\begin{equation}
\begin{matrix}
J
=
\begin{bmatrix}
\frac{\delta e_{1,1}}{\delta w_{1,1}} & \frac{\delta e_{1,1}}{\delta w_{1,2}} &
\cdots & \frac{\delta e_{1,1}}{\delta w_{j,1}} & \cdots \\[0.5em]
\frac{\delta e_{1,2}}{\delta w_{1,1}} & \frac{\delta e_{1,2}}{\delta w_{1,2}} &
\cdots & \frac{\delta e_{1,2}}{\delta w_{j,1}} & \cdots \\[0.5em]
\cdots & \cdots & \cdots &
\cdots & \cdots \\[0.5em]
\frac{\delta e_{1,M}}{\delta w_{1,1}} & \frac{\delta e_{1,M}}{\delta w_{1,2}} &
\cdots & \frac{\delta e_{1,M}}{\delta w_{j,1}} & \cdots \\[0.5em]
\cdots & \cdots & \cdots &
\cdots & \cdots \\[0.5em]
\frac{\delta e_{P,1}}{\delta w_{1,1}} & \frac{\delta e_{P,1}}{\delta w_{1,2}} &
\cdots & \frac{\delta e_{P,1}}{\delta w_{j,1}} & \cdots \\[0.5em]
\frac{\delta e_{P,1}}{\delta w_{1,1}} & \frac{\delta e_{np,2}}{\delta w_{1,2}} &
\cdots & \frac{\delta e_{P,2}}{\delta w_{j,1}} & \cdots \\[0.5em]
\cdots & \cdots & \cdots &
\cdots & \cdots \\[0.5em]
\frac{\delta e_{P,M}}{\delta w_{1,1}} & \frac{\delta e_{P,M}}{\delta w_{1,2}} &
\cdots & \frac{\delta e_{P,M}}{\delta w_{j,1}} & \cdots \\[0.5em]
\end{bmatrix} %\!\!
\begin{aligned}
&\left.\begin{matrix}
m = 1 \\[0.5em]
m = 2 \\[0.5em]
\cdots \\[0.5em]
m = M \\[0.5em]
\end{matrix} \right\} %
p = 1\\
&\begin{matrix}
\phantom{\cdots}\cdots\\[0.5em]
\end{matrix}\\ %
&\left.\begin{matrix}
m = 1 \\[0.5em]
m = 2 \\[0.5em]
\cdots \\[0.5em]
m = M\\[0.5em]
\end{matrix}\right\}%
p = P\\
\end{aligned}
\end{matrix}
\end{equation}
답변1
여기에 하나의 (TikZ 무료) 가능성이 있습니다. \overmat
두 번째 인수에 포함된 항목 위에 첫 번째 인수를 씁니다. \bovermat
(아래 두 번째 예에서) 유사하게 작동하지만 과도한 버팀대를 보여줍니다. 또한 일부 팬텀을 사용하여 표현식의 오른쪽 정렬을 수정했습니다.
\documentclass{article}
\usepackage{amsmath}
\usepackage{xcolor}
\newcommand\overmat[2]{%
\makebox[0pt][l]{$\smash{\color{white}\overbrace{\phantom{%
\begin{matrix}#2\end{matrix}}}^{\text{\color{black}#1}}}$}#2}
\newcommand\partialphantom{\vphantom{\frac{\partial e_{P,M}}{\partial w_{1,1}}}}
\begin{document}
\begin{equation}
\begin{matrix}
J
=
\begin{bmatrix}
\overmat{neuron 1}{\frac{\partial e_{1,1}}{\partial w_{1,1}} & \frac{\partial e_{1,1}}{\partial w_{1,2}}} &
\overmat{$\mkern-3.5mu\cdots$}{\cdots} & \overmat{neuron $j$}{\frac{\partial e_{1,1}}{\partial w_{j,1}} & \frac{\partial e_{1,1}}{\partial w_{j,1}}} & \cdots \\[0.5em]
%
\frac{\partial e_{1,2}}{\partial w_{1,1}} & \frac{\partial e_{1,2}}{\partial w_{1,2}} &
\cdots & \frac{\partial e_{1,2}}{\partial w_{j,1}} & \cdots \\[0.5em]
%
\cdots & \cdots & \cdots &
\cdots & \cdots \\[0.5em]
%
\frac{\partial e_{1,M}}{\partial w_{1,1}} & \frac{\partial e_{1,M}}{\partial w_{1,2}} &
\cdots & \frac{\partial e_{1,M}}{\partial w_{j,1}} & \cdots \\[0.5em]
%
\cdots & \cdots & \cdots &
\cdots & \cdots \\[0.5em]
%
\frac{\partial e_{P,1}}{\partial w_{1,1}} & \frac{\partial e_{P,1}}{\partial w_{1,2}} &
\cdots & \frac{\partial e_{P,1}}{\partial w_{j,1}} & \cdots \\[0.5em]
%
\frac{\partial e_{P,1}}{\partial w_{1,1}} & \frac{\partial e_{np,2}}{\partial w_{1,2}} &
\cdots & \frac{\partial e_{P,2}}{\partial w_{j,1}} & \cdots \\[0.5em]
%
\cdots & \cdots & \cdots &
\cdots & \cdots \\[0.5em]
%
\frac{\partial e_{P,M}}{\partial w_{1,1}} & \frac{\partial e_{P,M}}{\partial w_{1,2}} &
\cdots & \frac{\partial e_{P,M}}{\partial w_{j,1}} & \cdots \\[0.5em]
\end{bmatrix}
\begin{aligned}
&\left.\begin{matrix}
\partialphantom m = 1 \\[0.5em]
\partialphantom m = 2 \\[0.5em]
\cdots \\[0.5em]
\partialphantom m = M \\[0.5em]
\end{matrix} \right\} %
p = 1\\
&\begin{matrix}
\\[-1.67em]\phantom{\cdots}\cdots
\end{matrix}\\ %
&\left.\begin{matrix}
\partialphantom m = 1 \\[0.5em]
\partialphantom m = 2 \\[0.5em]
\cdots \\[0.5em]
\partialphantom m = M\\[0.5em]
\end{matrix}\right\}%
p = P\\
\end{aligned}
\end{matrix}
\end{equation}
\end{document}
그리고 중괄호를 사용한 변형:
\documentclass{article}
\usepackage{amsmath}
\usepackage{xcolor}
\newcommand\overmat[2]{%
\makebox[0pt][l]{$\smash{\color{white}\overbrace{\phantom{%
\begin{matrix}#2\end{matrix}}}^{\text{\color{black}#1}}}$}#2}
\newcommand\bovermat[2]{%
\makebox[0pt][l]{$\smash{\overbrace{\phantom{%
\begin{matrix}#2\end{matrix}}}^{\text{#1}}}$}#2}
\newcommand\partialphantom{\vphantom{\frac{\partial e_{P,M}}{\partial w_{1,1}}}}
\begin{document}
\begin{equation}
\begin{matrix}
J
=
\begin{bmatrix}
\bovermat{neuron 1}{\frac{\partial e_{1,1}}{\partial w_{1,1}} & \frac{\partial e_{1,1}}{\partial w_{1,2}}} &
\overmat{$\mkern-3.5mu\cdots$}{\cdots} & \bovermat{neuron $j$}{\frac{\partial e_{1,1}}{\partial w_{j,1}} & \frac{\partial e_{1,1}}{\partial w_{j,1}}} & \cdots \\[0.5em]
%
\frac{\partial e_{1,2}}{\partial w_{1,1}} & \frac{\partial e_{1,2}}{\partial w_{1,2}} &
\cdots & \frac{\partial e_{1,2}}{\partial w_{j,1}} & \cdots \\[0.5em]
%
\cdots & \cdots & \cdots &
\cdots & \cdots \\[0.5em]
%
\frac{\partial e_{1,M}}{\partial w_{1,1}} & \frac{\partial e_{1,M}}{\partial w_{1,2}} &
\cdots & \frac{\partial e_{1,M}}{\partial w_{j,1}} & \cdots \\[0.5em]
%
\cdots & \cdots & \cdots &
\cdots & \cdots \\[0.5em]
%
\frac{\partial e_{P,1}}{\partial w_{1,1}} & \frac{\partial e_{P,1}}{\partial w_{1,2}} &
\cdots & \frac{\partial e_{P,1}}{\partial w_{j,1}} & \cdots \\[0.5em]
%
\frac{\partial e_{P,1}}{\partial w_{1,1}} & \frac{\partial e_{np,2}}{\partial w_{1,2}} &
\cdots & \frac{\partial e_{P,2}}{\partial w_{j,1}} & \cdots \\[0.5em]
%
\cdots & \cdots & \cdots &
\cdots & \cdots \\[0.5em]
%
\frac{\partial e_{P,M}}{\partial w_{1,1}} & \frac{\partial e_{P,M}}{\partial w_{1,2}} &
\cdots & \frac{\partial e_{P,M}}{\partial w_{j,1}} & \cdots \\[0.5em]
\end{bmatrix}
\begin{aligned}
&\left.\begin{matrix}
\partialphantom m = 1 \\[0.5em]
\partialphantom m = 2 \\[0.5em]
\cdots \\[0.5em]
\partialphantom m = M \\[0.5em]
\end{matrix} \right\} %
p = 1\\
&\begin{matrix}
\\[-1.67em]\phantom{\cdots}\cdots
\end{matrix}\\ %
&\left.\begin{matrix}
\partialphantom m = 1 \\[0.5em]
\partialphantom m = 2 \\[0.5em]
\cdots \\[0.5em]
\partialphantom m = M\\[0.5em]
\end{matrix}\right\}%
p = P\\
\end{aligned}
\end{matrix}
\end{equation}
\end{document}
답변2
{NiceMatrix}
다음은 of를 사용한 솔루션입니다 nicematrix
(여러 컴파일이 필요함).
\documentclass{article}
\usepackage{nicematrix}
\begin{document}
\[
J
=
\begin{NiceMatrix}[margin,cell-space-limits=3pt,first-row]
\Block{1-2}{\text{neuron } 1} & & \cdots & \Block{1-2}{\text{neuron } j} \\
\frac{\partial e_{1,1}}{\partial w_{1,1}} & \frac{\partial e_{1,1}}{\partial w_{1,2}} &
& \frac{\partial e_{1,1}}{\partial w_{j,1}} & \frac{\partial e_{1,1}}{\partial w_{j,1}} & \cdots & m=1 &
\Block{4-1}{p=1} \\
%
\frac{\partial e_{1,2}}{\partial w_{1,1}} & \frac{\partial e_{1,2}}{\partial w_{1,2}} &
\cdots & \frac{\partial e_{1,2}}{\partial w_{j,1}} & \cdots & & m=2\\
%
\cdots & \cdots & & \cdots &
\cdots & & \cdots \\
%
\frac{\partial e_{1,M}}{\partial w_{1,1}} & \frac{\partial e_{1,M}}{\partial w_{1,2}} &
\cdots & \frac{\partial e_{1,M}}{\partial w_{j,1}} & \cdots & & m=M\\
%
\cdots & \cdots & \cdots &
\cdots & \cdots & & \cdots \\
%
\frac{\partial e_{P,1}}{\partial w_{1,1}} & \frac{\partial e_{P,1}}{\partial w_{1,2}} &
\cdots & \frac{\partial e_{P,1}}{\partial w_{j,1}} & \cdots & & m=1 & \Block{4-1}{p=P}\\
%
\frac{\partial e_{P,1}}{\partial w_{1,1}} & \frac{\partial e_{np,2}}{\partial w_{1,2}} &
\cdots & \frac{\partial e_{P,2}}{\partial w_{j,1}} & \cdots & & m=2\\
%
\cdots & \cdots & \cdots &
\cdots & \cdots & & \cdots \\
%
\frac{\partial e_{P,M}}{\partial w_{1,1}} & \frac{\partial e_{P,M}}{\partial w_{1,2}} &
\cdots & \frac{\partial e_{P,M}}{\partial w_{j,1}} & \cdots & & m = M\\
\CodeAfter
\SubMatrix[{1-1}{9-6}]
\SubMatrix{.}{1-7}{4-7}{\}}
\SubMatrix{.}{6-7}{9-7}{\}}
\end{NiceMatrix}\]
\end{document}
답변3
나는 당신의 매트릭스를 사용하지 않았지만 내 예가 우리 커뮤니티에 도움이 될 것이라고 생각합니다.
\documentclass{article}
\usepackage{amsmath}
\[
\begin{array}{| c | c | c | c | c | c | c | c | c | c |}
\multicolumn{3}{c}{\rho_1 } &
\multicolumn{3}{c}{\rho_2} &
\multicolumn{1}{c}{ \ } &
\multicolumn{3}{c}{\rho_k} \\
%
\multicolumn{3}{c}{\overbrace{\rule{4cm}{0pt}}} &
\multicolumn{3}{c}{\overbrace{\rule{4cm}{0pt}}} &
\multicolumn{1}{c}{ \ } &
\multicolumn{3}{c}{\overbrace{\rule{4cm}{0pt}}} \\[-3pt]
\hline
p(t_1) & \cdots & p^{(\rho_1-1)}(t_1) & p(t_2) & \cdots &
p^{(\rho_2-1)}(t_2) & \cdots & p(t_k) & \cdots &
p^{(\rho_k-1)}(t_k) \\
\hline
\end{array}
\]
\end{document}