4

I am trying to place a text box next to an equation like this:

enter image description here

I have tried defining two columns of different width with the vwcol environment, and then putting the text inside a framed environment. This is the result:

enter image description here

However, there are two things that I would like to fix:

  • the framed box spans to the right margin of the document
  • the equation and the text box are misaligned

How can I fix this items?

Also, I would like to know if using two columns is the right approach, or if there are better/more elegant approaches.


This is my minimal code:

\documentclass{article}

\usepackage[
    a4paper,
    top=2truecm,
    bottom=2truecm,
    left=2truecm,
    right=2truecm
]{geometry}

\usepackage{amsmath}
\usepackage{vwcol}
\usepackage{framed}

\begin{document}

\begin{vwcol}[widths={0.65,0.35},sep=0.5cm,rule=0pt,indent=0em]

\begin{equation*}
\begin{bmatrix}
\Delta\dot{\alpha}(t) \\
\Delta\dot{q}(t)      \\
\Delta\dot{\theta}(t) \\
\Delta\dot{h}(t)      \\
\end{bmatrix}
=
\begin{bmatrix}
-1.397 & 1     & 0   & 0 \\
-5.47  & -3.27 & 0   & 0 \\
0      & 1     & 0   & 0 \\
-400   & 0     & 400 & 0 \\
\end{bmatrix}
\begin{bmatrix}
\Delta\alpha(t) \\
\Delta q(t)     \\
\Delta\theta(t) \\
\Delta h(t)     \\
\end{bmatrix}
+
\begin{bmatrix}
-0.124 \\
-13.2  \\
0      \\
0      \\
\end{bmatrix}
\Delta\delta_{e}(t)
\end{equation*}

\begin{framed}
US units are used here, so the angles/angular velocities will be in [rad] or [rad/s], and h in [ft].
\end{framed}

\end{vwcol}

\end{document}

3 Answers 3

4

I would probably use either minipages or not an equation but simple math and a box beside:

\documentclass{article}

\usepackage[
    a4paper,
    top=2truecm,
    bottom=2truecm,
    left=2truecm,
    right=2truecm
]{geometry}

\usepackage{amsmath}
\usepackage{tcolorbox}

\begin{document}

$
\begin{bmatrix}
\Delta\dot{\alpha}(t) \\
\Delta\dot{q}(t)      \\
\Delta\dot{\theta}(t) \\
\Delta\dot{h}(t)      \\
\end{bmatrix}
=
\begin{bmatrix}
-1.397 & 1     & 0   & 0 \\
-5.47  & -3.27 & 0   & 0 \\
0      & 1     & 0   & 0 \\
-400   & 0     & 400 & 0 \\
\end{bmatrix}
\begin{bmatrix}
\Delta\alpha(t) \\
\Delta q(t)     \\
\Delta\theta(t) \\
\Delta h(t)     \\
\end{bmatrix}
+
\begin{bmatrix}
-0.124 \\
-13.2  \\
0      \\
0      \\
\end{bmatrix}
\Delta\delta_{e}(t)
$\hfill
\begin{tcolorbox}[width=0.3\textwidth,nobeforeafter,box align=center]
US units are used here, so the angles/angular velocities will be in [rad] or [rad/s], and h in [ft].
\end{tcolorbox}
\end{document}

enter image description here

1
  • Your solution was the simplest since I only needed to display the equation without making any cross-reference to it, so the equation environment was unnecessary. In order to get the desired style for the text box, I passed the options [boxrule=0.1mm, width=0.35\textwidth, colback=white, colframe=black, arc=0pt, nobeforeafter, box align=center] to tcolorbox. Jan 28, 2018 at 15:39
7

You can use a \parbox inside \fbox in the equation:

\documentclass{article}

\usepackage[
    a4paper,
    top=2truecm,
    bottom=2truecm,
    left=2truecm,
    right=2truecm
]{geometry}

\usepackage{amsmath}

\begin{document}

\begin{equation*}
\begin{bmatrix}
\Delta\dot{\alpha}(t) \\
\Delta\dot{q}(t)      \\
\Delta\dot{\theta}(t) \\
\Delta\dot{h}(t)      \\
\end{bmatrix}
=
\begin{bmatrix}
-1.397 & 1     & 0   & 0 \\
-5.47  & -3.27 & 0   & 0 \\
0      & 1     & 0   & 0 \\
-400   & 0     & 400 & 0 \\
\end{bmatrix}
\begin{bmatrix}
\Delta\alpha(t) \\
\Delta q(t)     \\
\Delta\theta(t) \\
\Delta h(t)     \\
\end{bmatrix}
+
\begin{bmatrix}
-0.124 \\
-13.2  \\
0      \\
0      \\
\end{bmatrix}
\Delta\delta_{e}(t)
\qquad
\fbox{%
  \parbox{.3\textwidth}{%
    US units are used here, so the angles/angular velocities will be 
    in [rad] or [rad/s], and h in [ft].
  }%
}
\end{equation*}

\end{document}

enter image description here

4

A simple \fbox and an align* environment will do the trick:

\documentclass{article}

\usepackage[
    a4paper,
   margin=2truecm
]{geometry}

\usepackage{amsmath}

\begin{document}

\begin{align*}
\begin{bmatrix}
\Delta\dot{\alpha}(t) \\
\Delta\dot{q}(t) \\
\Delta\dot{\theta}(t) \\
\Delta\dot{h}(t) \\
\end{bmatrix}
 & =
\begin{bmatrix}
-1.397 & 1 & 0 & 0 \\
-5.47 & -3.27 & 0 & 0 \\
0 & 1 & 0 & 0 \\
-400 & 0 & 400 & 0 \\
\end{bmatrix}
\begin{bmatrix}
\Delta\alpha(t) \\
\Delta q(t) \\
\Delta\theta(t) \\
\Delta h(t) \\
\end{bmatrix}
+
\begin{bmatrix}
-0.124 \\
-13.2 \\
0 \\
0 \\
\end{bmatrix}
\Delta\delta_{e}(t)
 & &
\fboxsep = 6pt\fbox{\parbox{45mm}{\small
US units are used here, so the angles/angular velocities will be in [rad] or [rad/s], and h in [ft].}}
\end{align*}

\end{document} 

enter image description here

2
  • this is really just a one-line display, so \[ ... \] or the equation* environment would be better. Dec 16, 2017 at 3:57
  • @barbarabeeton: That's right.The only reason I used align* was to have a consistent, standard spacing between the equation and the text block. Also, I'm not sure the O.P. posted the full real equation (there might be several lines like this one).
    – Bernard
    Dec 16, 2017 at 9:47

You must log in to answer this question.

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