
Ich suche nach einer Möglichkeit, die Abbildung neben der Matrix zu platzieren, wobei die Matrix die Nummer (1) erhält und die Abbildung mit dem entsprechenden Graphen zur Matrix benannt werden kann (Abb. 1: entsprechender Graph der Matrix (1)).
Meine Versuche:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,positioning}
\usepackage{enumitem}
\usepackage{amssymb}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,positioning}
\usepackage{rotating}
\usepackage{kbordermatrix}
\begin{document}
\[ CM' ={%
\begin{tabular}[b]{cc}
{\(\kbordermatrix
{ & 1 & \textcolor{red}{3} & 4 \\
1 & 1 & \textcolor{red}{x_{13}} & x_{12}x_{24} \\
\textcolor{red}{3}& \textcolor{red}{0} & \textcolor{red}{1} & \textcolor{red}{x_{34}} \\
4 & 0 & \textcolor{red}{0} & 1
}
\)%
}
\end{tabular}}
\]
\begin{tikzpicture}[
mycircle/.style={
circle,
draw=black,
fill=black,
fill opacity = 0.99,
text opacity=1,
inner sep=0pt,
minimum size=12pt,
font=\small},
myarrow/.style={-Stealth},
node distance=0.6cm and 1.2cm
]
\node[mycircle] (c1) {\textcolor{white}{1}};
\node[mycircle,above right=of c1] (c2) {\textcolor{white}{2}};
\node[mycircle,below right=of c1] (c4) {\textcolor{white}{3}};
\node[mycircle,below right=of c2] (c3) {\textcolor{white}{4}};
\foreach \i/\j/\txt/\p in {% start node/end node/text/position
c2/c3/$e_{24}$/above,
c1/c2/$e_{12}$/above,
c1/c3/$e_{14}$/below,
c1/c4/$e_{13}$/below,
c4/c3/$e_{34}$/below}
\draw [myarrow] (\i) -- node[sloped,font=\small,\p] {\txt} (\j);
% draw this outside loop to get proper orientation of 10
\end{tikzpicture}
\end{document}
Abb.1: zugehöriger Graph der Matrix (1) Das Ergebnis war unbefriedigend:
Ich suche nach einer Ausgabe wie dieser:
Antwort1
Verschachteln Sie die beiden Teile in Miniseiten.
Ich würde nicematrix
eher Features als verwenden \kbordermatrix
.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,positioning}
\usepackage{nicematrix}
\begin{document}
\begin{figure}[htp]
\begin{minipage}[t]{0.48\textwidth}
\vspace{-0.8\baselineskip}
\begin{equation}\label{a-matrix}
CM'=
\begin{bNiceMatrix}[
first-row,code-for-first-row=\scriptstyle,
first-col,code-for-first-col=\scriptstyle,
]
& 1 & \mathcolor{red}{3} & 4 \\
1 & 1 & \mathcolor{red}{x_{13}} & x_{12}x_{24} \\
\mathcolor{red}{3} & \mathcolor{red}{0} & \mathcolor{red}{1} & \mathcolor{red}{x_{34}} \\
4 & 0 & \mathcolor{red}{0} & 1
\end{bNiceMatrix}
\end{equation}
\end{minipage}\hfill
\begin{minipage}[t]{0.48\textwidth}
\centering
\vspace{0pt}
\begin{tikzpicture}[
mycircle/.style={
circle,
draw=black,
fill=black,
fill opacity = 0.99,
text opacity=1,
inner sep=0pt,
minimum size=12pt,
font=\small
},
myarrow/.style={-Stealth},
node distance=0.6cm and 1.2cm
]
\node[mycircle] (c1) {\textcolor{white}{1}};
\node[mycircle,above right=of c1] (c2) {\textcolor{white}{2}};
\node[mycircle,below right=of c1] (c4) {\textcolor{white}{3}};
\node[mycircle,below right=of c2] (c3) {\textcolor{white}{4}};
\foreach \i/\j/\txt/\p in {% start node/end node/text/position
c2/c3/$e_{24}$/above,
c1/c2/$e_{12}$/above,
c1/c3/$e_{14}$/below,
c1/c4/$e_{13}$/below,
c4/c3/$e_{34}$/below%
}
{\draw [myarrow] (\i) -- node[sloped,font=\small,\p] {\txt} (\j);}
% draw this outside loop to get proper orientation of 10
\end{tikzpicture}
\caption{Corresponding graph of the matrix~\eqref{a-matrix}}
\end{minipage}
\end{figure}
\end{document}
Mir wäre die Beschriftung lieber in der Mitte.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,positioning}
\usepackage{nicematrix}
\begin{document}
\begin{figure}[htp]
\begin{minipage}[t]{0.48\textwidth}
\vspace{-0.8\baselineskip}
\begin{equation}\label{a-matrix}
CM'=
\begin{bNiceMatrix}[
first-row,code-for-first-row=\scriptstyle,
first-col,code-for-first-col=\scriptstyle,
]
& 1 & \mathcolor{red}{3} & 4 \\
1 & 1 & \mathcolor{red}{x_{13}} & x_{12}x_{24} \\
\mathcolor{red}{3} & \mathcolor{red}{0} & \mathcolor{red}{1} & \mathcolor{red}{x_{34}} \\
4 & 0 & \mathcolor{red}{0} & 1
\end{bNiceMatrix}
\end{equation}
\end{minipage}\hfill
\begin{minipage}[t]{0.48\textwidth}
\centering
\vspace{0pt}
\begin{tikzpicture}[
mycircle/.style={
circle,
draw=black,
fill=black,
fill opacity = 0.99,
text opacity=1,
inner sep=0pt,
minimum size=12pt,
font=\small
},
myarrow/.style={-Stealth},
node distance=0.6cm and 1.2cm
]
\node[mycircle] (c1) {\textcolor{white}{1}};
\node[mycircle,above right=of c1] (c2) {\textcolor{white}{2}};
\node[mycircle,below right=of c1] (c4) {\textcolor{white}{3}};
\node[mycircle,below right=of c2] (c3) {\textcolor{white}{4}};
\foreach \i/\j/\txt/\p in {% start node/end node/text/position
c2/c3/$e_{24}$/above,
c1/c2/$e_{12}$/above,
c1/c3/$e_{14}$/below,
c1/c4/$e_{13}$/below,
c4/c3/$e_{34}$/below%
}
{\draw [myarrow] (\i) -- node[sloped,font=\small,\p] {\txt} (\j);}
% draw this outside loop to get proper orientation of 10
\end{tikzpicture}
\end{minipage}
\caption{Matrix and corresponding graph}
\end{figure}
\end{document}