2

I would like to float a minipage next to an enumerate. I am looking to get this effect:

enter image description here

Here is code that was developed from posts found draw-a-simple-figure-with-arrows and here:

\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}
0

2 Answers 2

5

Just use two minipages:

enter image description here

\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}
1

Just add the (smashed) picture as the final element in one of the rows:

\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}

enter image description here

I used my enumeratealign environment, but the idea is the same with the other solution.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .