From: Mark Riggs <msr1@ra...>  20040727 13:22:08

Stanley wrote: >I'm legally blind, so it's much easier to use the computer than to attempt to write directly. I would like to box the last line of a multiline equation set (homework problems). I would like the box to be aligned with the "=" sign like the rest of the equations, but I haven't figured out how to do that without breaking things. Here's what I currently have, which will work, if there is no simple way to do what I'd like: > > > > Here is an example I found on comp.text.tex; I usually just read from this group since they are a little hard on people who don't research first. http://groups.google.com/groups?hl=en&lr=&ie=UTF8&oe=UTF8&group=comp.text.tex \documentclass{article} \usepackage{amsmath} \newlength{\testwidth} \newsavebox{\tempbox} % This command sets back the equation counter and then readvances it, % in order to reset the current label string after our strange use of % \tag* has corrupted it with lots of extra junk. % \newcommand{\relabel}[1]{% \addtocounter{equation}{1}% \refstepcounter{equation}% \label{#1}% } \begin{document} Here is a test boxing the last line, including the equation number: % % Create the frame ahead of time; make it overlap to the left by using % the [r] placement option with a width of zero. % \savebox{\tempbox}[0pt][r]{ % % Print a box around an invisible space of the current width % (adjusting for fboxsep on both sides), and a vphantom of the tallest % element (to get the correct height). % \boxed{\hspace{2\fboxsep}\hspace{\linewidth}% \vphantom{\frac{\sin(\omega T)}{\omega T}}% }% }% \begin{align*} X_1(j\omega) & = \int\limits^{+\infty}_{\infty} x_1(t) e^{j\omega t} dt \\ & = \frac{v_o}{j\omega T} \left[e^{j\omega t}\right]^T_{T} \\ & = \frac{v_o}{j\omega T} \left( 2 j \sin (\omega T) \right) \\ X_1(j\omega) & = 2v_o \frac{\sin(\omega T)}{\omega T} % % We need to use \tag*, but that doesn't change the equation counter, so % we increment the counter by hand. Getting the label right takes more % work, see below. % \stepcounter{equation} \tag*{(\theequation)% Normal equation number \hspace{\fboxsep}\usebox{\tempbox}% } \relabel{eq1} \end{align*} And a second test for boxing only the equation body, not the number. This time we can use \texttt{align} and \verb'\notag' because \verb'\tag*' is not necessary. \begin{align} X_1(j\omega) & = \int\limits^{+\infty}_{\infty} x_1(t) e^{j\omega t} dt \notag\\ & = \frac{v_o}{j\omega T} \left[e^{j\omega t}\right]^T_{T} \notag\\ & = \frac{v_o}{j\omega T} \left( 2 j \sin (\omega T) \right) \notag\\ % Skip to the righthand column, see below. & % % Measure the width of the lefthand side, including some adjustments % for the frame. % \settowidth{\testwidth}{\hspace{\fboxrule}\hspace{\fboxsep}$X_1(j\omega)$} % % Print the lefthand side and the righthand side together in the % *righthand column* with negative space to shift it to the left. % \hspace{\testwidth}% % % And now we can use amsmath's \boxed command which is just \fbox for % math with \displaystyle. % \boxed{X_1(j\omega) = 2v_o \frac{\sin(\omega T)}{\omega T}} \end{align} \end{document} 