I have the following code
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{alignat*}{4}
\begin{minipage}[h!]{0\linewidth}
\text{Let:} \end{minipage}
&& G_{\delta_r}^{\beta} &= \frac{n_1 s + n_0}{s^2 + d_1 s + d_0} = \frac{0.01956 s + 7.01}{s^2 + 0.802 s + 6.489} \\
&& step \left(G_{\delta_r}^{\beta}(s) \right) = \frac{G_{\delta_r}^{\beta}(s)}{s} &= \frac{1}{s} \cdot \frac{n_1 s + n_0}{s^2 + d_1 s + d_0} \\
\\
% \left[
% \makebox[0\linewidth][s] {
% \begin{dcases}
\makebox[0\linewidth][s]{Expanding with partial fractions:} \\
&& \frac{x_1}{s} + \frac{x_{21}s + x_{20}}{s^2 + d_1 s + d_0} &= \frac{1}{s} \cdot \frac{n_1 s + n_0}{s^2 + d_1 s + d_0} \\
\\
\makebox[0\linewidth][s]{Removing denominator:} \\
&& x_1(s^2 + d_1 s + d_0) + s(x_{21} s + x_{20}) &= n_1 s + n_0 \\
\\
\makebox[0\linewidth][s]{Has solutions:} \\
\makebox[0\linewidth][s]{
\begin{minipage}[h!]{0.3\linewidth} \centering
$x_{21} = \frac{-n_0}{d_0} = -1.08$ \end{minipage}
\begin{minipage}[h!]{0.3\linewidth} \centering
$x_1 = \frac{n_0}{d_0} = 1.08$ \end{minipage}
\begin{minipage}[h!]{0.3\linewidth} \centering
$x_{20} = n_1 - \frac{n_0 d_1}{d_0} = -0.847$ \end{minipage} }
% \end{dcases}
% }
\\
\begin{minipage}[h!]{0\linewidth}
\text{Hence:} \end{minipage}
&& \frac{G_{\delta_r}^{\beta}(s)}{s} &= \frac{1.08}{s} - \frac{1.08s + 0.847}{s^2 + 0.8-2s + 6.489} \\
\\
\makebox[0\linewidth][s]{Completing the square:} \\
&& \frac{G_{\delta_r}^{\beta}(s)}{s} &= \frac{1.08}{s} - \frac{1.08s + 0.847}{(s + 0.401)^2 + 6.328} \\
\makebox[0\linewidth][s]{Inverse Laplace:} \\
&& \mathcal{L}^{-1}\left\{ \frac{G_{\delta_r}^{\beta}(s)}{s} \right\} &= 1.08 - e^{-.401t} \left(1.08 \cos(t\sqrt{6.328}) + \frac{0.847}{\sqrt{6.328}} \sin(t\sqrt{6.328}) \right)
\end{alignat*}
\end{document}
Which produces:
I would like to put a box (or some kind of a bracket) like the one shown in the picture to denote "sub working out". The complications are that the box will need to span many lines of equations and many columns of the alignat environment.
I have tried many things including \makebox
, \minipage
, \bcases,
\matrix
Any suggestions?
Best Answer
An option using a
\parbox
inside a\fcolorbox
inside a\makebox
, and the whole construct inside\intertext
; some changes to the original mark-up were done (in particular, the code was greatly simplified), but the original alignment of expressions before and after the box was preserved:Another option would be to use the
tikzmark
library; the idea is to use\tikzmark
to place marks at the appropriate locations and then to use those marks to draw the blue rectangle. Below I show this approach and also illustrate another option for the mark-up (of course, this approach will also work with the above approach or with any other variation):