[OS X TeX] LaTeX question

Ross Moore ross.moore at mq.edu.au
Mon Aug 13 10:06:55 CEST 2012


Hi Gary,

On 13/08/2012, at 5:10 AM, Gary L. Gray wrote:

>> parbox; and better equation*/split than align*:
>> 
>> \item
>> \raisebox{0pt}{\parbox{10pc}{
>> \begin{equation*}
>> \begin{split}
>> y &= \int \sin x \,dx \\
>> &\qquad{} + x^{2}
>> \end{split}
>> \end{equation*}
>> }}
> 
> I am finally getting back to this project and I want to thank everyone who answered. This solution from Axel works very well as long as I adjust the length in the \raisebox command (it turns out that -8pt works well). It turns out I did try using \parbox before, but not in this way. Nicely done.

You really want to use a solution that does not require you to guess
how much to raise by.

The attached examples give several options.
Note that for internal reasons, \begin{align*} ... \end{align*}
should be replaced by  \begin{aligned} ... \end{aligned} inside
a surrounding  {equation*} environment, or similar.
----  {align}  is too "outer" to work properly when boxed.
You discovered this already, I guess.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: raisealign.pdf
Type: application/pdf
Size: 28082 bytes
Desc: not available
URL: <http://tug.org/pipermail/macostex-archives/attachments/20120813/0b241ce3/attachment.pdf>
-------------- next part --------------


\documentclass[12pt,fleqn]{article}
\usepackage{amsmath}
\usepackage[all]{xy}

\begin{document}

\Xy-pic allows for great flixibility in how the equation is aligned.
The main thing though is to adjust the \verb|\displaywidth| with the 
equation-display inside a box. Framing is optional, and there are
many different styles of frame that can be used.

\begin{itemize}
\item
$\xy*+!U[F-]\txt{%  aligns a the top
 \setlength{\displaywidth}{.5\textwidth}%
 \begin{equation*}
 y = \int \sin x \,dx + x^{2}
 \end{equation*}
}\endxy$ 
aligned at the top

\item
$\xy*+!C[F=]\txt{%   aligns in the centre
 \setlength{\displaywidth}{.5\textwidth}%
 \begin{equation*}
 y = \int \sin x \,dx + x^{2}
 \end{equation*}
}\endxy$ 
aligned in the centre

\item
$\xy*+!D[F.]\txt{%  aligns at the bottom
 \setlength{\displaywidth}{.5\textwidth}%
 \begin{equation*}
 y = \int \sin x \,dx + x^{2}
 \end{equation*}
}\endxy$
aligned at the bottom

\item
$\xy*+!C[F=]\txt{{%   aligns in the centre
 \setlength{\displaywidth}{.5\textwidth}%
\begin{equation*}
\begin{aligned}
y &= \int \sin x \,dx \cr
&\qquad{} + x^{2}
\end{aligned}
\end{equation*}
}}\endxy$ 
multiline environments require an extra set of \verb|{...}| to shield the \verb|&| characters.

\end{itemize}

You don't need to use \Xy-pic; a simple \verb|\framebox| will do\dots

\begin{itemize}
\item \framebox{% aligns in the centre
 \setlength{\displaywidth}{.5\textwidth}%
 \begin{equation*}
 y = \int \sin x \,dx + x^{2}
 \end{equation*}
} \dots but then there is no easy control over the vertical alignment.


\item \framebox{% aligns in the centre
 \setlength{\displaywidth}{.5\textwidth}%
\begin{equation*}
\begin{aligned}
y &= \int \sin x \,dx \\
&\qquad{} + x^{2}
\end{aligned}
\end{equation*}}

\end{itemize}

\end{document}



> 
> Thank you again.
> 
> Gary


Hope this helps,

	Ross

------------------------------------------------------------------------
Ross Moore                                       ross.moore at mq.edu.au 
Mathematics Department                           office: E7A-419      
Macquarie University                             tel: +61 (0)2 9850 8955
Sydney, Australia  2109                          fax: +61 (0)2 9850 8114
------------------------------------------------------------------------





More information about the macostex-archives mailing list