如何将图像放置在 bmatrix 旁边?

如何将图像放置在 bmatrix 旁边?

我目前正在使用这个,但矩阵太靠右了。我想将其向上和向左移动,而不改变文本宽度。

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{amsmath}
\begin{document}
\begin{figure}
    \centering
    \begin{minipage}{.5\textwidth}
        \centering
        \includegraphics[scale=0.5]{k3.png}
\caption{Fig 3}
\label{fig:Fig 3}
    \end{minipage}%
    \begin{minipage}{\textwidth}
        \begin{equation*}
{p} = 
\begin{bmatrix}
0 \\
\alpha_{1,2} \alpha_{1,3}  \\
(\alpha_{1,2}+ \alpha_{2,3})\alpha_{1,3}  \\ 
\end{bmatrix}
=
\begin{bmatrix}
p_{v_1} \\
p_{v_2} \\
p_{v_3} \\
\end{bmatrix}
\end{equation*}
\end{minipage}
\end{figure}
\end{document}

答案1

修复代码中的不一致并更正所有错误(缺少代码行)后,我获得:

在此处输入图片描述

(红线表示文本边框)。这是您要找的吗?

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{amsmath}

%-------------------------------- show page layout, only for test
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\begin{document}
    \begin{figure}
\begin{minipage}{.5\textwidth}
    \centering
    \includegraphics[scale=0.5]{k3.png}
\caption{Fig 3}
\label{fig:Fig 3}
\end{minipage}%
\begin{minipage}{0.5\textwidth}
\[
{p} =
\begin{bmatrix}
0 \\
\alpha_{1,2} \alpha_{1,3}  \\
(\alpha_{1,2}+ \alpha_{2,3})\alpha_{1,3}
\end{bmatrix}
=
\begin{bmatrix}
p_{v_1} \\
p_{v_2} \\
p_{v_3}
\end{bmatrix}
\]
\end{minipage}
    \end{figure}
\end{document}

或者使用tabularx代替minipage

在此处输入图片描述

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{amsmath}
\usepackage{tabularx}

%-------------------------------- show page layout, only for test
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\begin{document}
    \begin{figure}
\renewcommand\tabularxcolumn[1]{m{#1}}
\begin{tabularx}{\textwidth}{XX}
    \centering
    \includegraphics[width=\linewidth]{k3.png}
&
\[
{p} =
\begin{bmatrix}
0 \\
\alpha_{1,2} \alpha_{1,3}  \\
(\alpha_{1,2}+ \alpha_{2,3})\alpha_{1,3}
\end{bmatrix}
=
\begin{bmatrix}
p_{v_1} \\
p_{v_2} \\
p_{v_3}
\end{bmatrix}
\]      \\
\caption{Fig 3}
\label{fig:Fig 3}
&
\end{tabularx}
    \end{figure}
\end{document}

相关内容