将 minipage 放在枚举环境旁边

将 minipage 放在枚举环境旁边

我想将小页面浮动在枚举旁边。我希望获得以下效果:

在此处输入图片描述

以下是根据找到的帖子开发的代码用箭头画一个简单的图形这里

\documentclass{book}
\usepackage{amsmath,amsfonts,amssymb,amsthm}
\usepackage{mathptmx}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}

\begin{document}
\begin{flalign*}
\textbf{(a)}    &&  P(1)        & = 3.1479              &&  \\
                &&  K(1)        & = 0.786986            &&  \\
                &&  \hat{x}(1)  & = 0  &&  \\
                &&              & = 1.1805              &&  \\[1ex]
\textbf{(b)}    &&  P(2)        & = 3.1431              &&  \\
                &&  K(2)        & = 0.7870              &&  \\
                &&  \hat{x}(2)  & = 1.1805
                                                        &&  \\
                &&              & = 2.6124              &&
\end{flalign*}
\begin{minipage}{\textwidth}
\begin{tikzpicture}[> = latex,
     decoration = {markings,mark=at position .55
                            with {\arrow[very thick]{latex}}},
    arrow/.style = {draw=blue!30,thick},
dasharrow/.style = {arrow,densely dashed}
                    ]
\draw[arrow,postaction={decorate}]
                    (0,0) node[below]{$(x_{0},y_{0})$}
                          -- (45:3) node[above] {$K^{-}_{k+1}$};
\draw[dasharrow,->] (0,0) -- (2.1,0)  node[below] {$K_{k+1}$};
\draw[dasharrow,postaction={decorate}] (45:3) -- (2.1,0);
\draw[dasharrow,->] (2.1,0) -- (4.2,0)     node[below] {$K_{k+2}$};
\draw[arrow,postaction={decorate}]
                    (2.1,0) -- ++ (45:3) node[above] {$K^{-}_{k+2}$};
\draw[dasharrow,postaction={decorate}]
                    (2.1,0) + (45:3) -- (4.2,0);
\end{tikzpicture}
\end{minipage}

答案1

只需使用两个小页面:

在此处输入图片描述

\documentclass{book}
\usepackage{amsmath,amsfonts,amssymb,amsthm}
\usepackage{mathptmx}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}

\begin{document}

\noindent
\begin{minipage}{.5\textwidth}
\begin{flalign*}
\textbf{(a)}    &&  P(1)        & = 3.1479              &&  \\
                &&  K(1)        & = 0.786986            &&  \\
                &&  \hat{x}(1)  & = 0  &&  \\
                &&              & = 1.1805              &&  \\[1ex]
\textbf{(b)}    &&  P(2)        & = 3.1431              &&  \\
                &&  K(2)        & = 0.7870              &&  \\
                &&  \hat{x}(2)  & = 1.1805
                                                        &&  \\
                &&              & = 2.6124              &&
\end{flalign*}
\end{minipage}\begin{minipage}{.5\textwidth}
\begin{tikzpicture}[> = latex,
     decoration = {markings,mark=at position .55
                            with {\arrow[very thick]{latex}}},
    arrow/.style = {draw=blue!30,thick},
dasharrow/.style = {arrow,densely dashed}
                    ]
\draw[arrow,postaction={decorate}]
                    (0,0) node[below]{$(x_{0},y_{0})$}
                          -- (45:3) node[above] {$K^{-}_{k+1}$};
\draw[dasharrow,->] (0,0) -- (2.1,0)  node[below] {$K_{k+1}$};
\draw[dasharrow,postaction={decorate}] (45:3) -- (2.1,0);
\draw[dasharrow,->] (2.1,0) -- (4.2,0)     node[below] {$K_{k+2}$};
\draw[arrow,postaction={decorate}]
                    (2.1,0) -- ++ (45:3) node[above] {$K^{-}_{k+2}$};
\draw[dasharrow,postaction={decorate}]
                    (2.1,0) + (45:3) -- (4.2,0);
\end{tikzpicture}
\end{minipage}

\end{document}

答案2

只需将(破碎的)图片作为其中一行的最后一个元素添加即可:

\documentclass{book}
\usepackage{amsmath,amsfonts,amssymb,amsthm}
\usepackage{mathptmx}
\usepackage{enumitem} % Customize lists
\usepackage{tikz}
\usetikzlibrary{decorations.markings}

\newenvironment{enumeratealign}
 {\setcounter{enumi}{0}\renewcommand{\theenumi}{\alph{enumi}}\csname flalign*\endcsname}
 {\endalign}
\makeatletter
\newcommand{\alignitem}{%
  \refstepcounter{enumi}%
  \textbf{(\theenumi)}%
  \let\label\ltx@label
}
\makeatletter

\begin{document}

\begin{enumeratealign}
&\alignitem\label{first} &
    P(1)       &= 3.1479 &&\\
&&  K(1)       &= 0.786986 &&\\
&&  \hat{x}(1) &= 0 + 0.786986(1.5-0) &&\\
&&             &= 1.1805 &&\\[1ex]
&\alignitem &
    P(2)       &= 3.1431 &&\\
&&  K(2)       &= 0.7870 &&\\
&&  \hat{x}(2) &= 1.1805 + 0.786986(3.0-1.1805) &&
\smash{\begin{tikzpicture}[> = latex,
     decoration = {markings,mark=at position .55
                            with {\arrow[very thick]{latex}}},
    arrow/.style = {draw=blue!30,thick},
dasharrow/.style = {arrow,densely dashed}
                    ]
\draw[arrow,postaction={decorate}]
                    (0,0) node[below]{$(x_{0},y_{0})$}
                          -- (45:3) node[above] {$K^{-}_{k+1}$};
\draw[dasharrow,->] (0,0) -- (2.1,0)  node[below] {$K_{k+1}$};
\draw[dasharrow,postaction={decorate}] (45:3) -- (2.1,0);
\draw[dasharrow,->] (2.1,0) -- (4.2,0)     node[below] {$K_{k+2}$};
\draw[arrow,postaction={decorate}]
                    (2.1,0) -- ++ (45:3) node[above] {$K^{-}_{k+2}$};
\draw[dasharrow,postaction={decorate}]
                    (2.1,0) + (45:3) -- (4.2,0);
\end{tikzpicture}}
\\
&&             &= 2.6124 &&
\end{enumeratealign}

\end{document}

在此处输入图片描述

我使用了我的enumeratealign环境,但是想法与其他解决方案相同。

相关内容