Steven Harms (stharms) wrote:
I actually tried that, but it resulted in getting a bunch of errors from
LaTeX.  It look goot in LyX, but I don't understand how it's breaking
LaTeX in this instance.


%% LyX 1.4.3-5 created this file.  For more info, see
http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
%% Because html converters don't know tabularnewline
\providecommand{\tabularnewline}{\\}

\usepackage{babel}
\makeatother
\begin{document}
\begin{tabular}{|c|c|}
\hline \begin{align*}
7x+10y & =50\textrm{ for }y=4\\
7x+10(4) & =50\\
7x+40 & =50\\
7x+40-40 & =50-40\\
7x & =10\\
x & =\frac{10}{7}\end{align*}
&
\begin{align*}
 & \textrm{Check:}\\
7x+10y & =50\textrm{ for }y=4\\
7(\frac{10}{7})+10(4) & =50\\
10+40 & =50\\
50 & =50\end{align*}
\tabularnewline
\hline
\end{tabular}
\end{document}

AFAIK, you cannot use display math in a table cell, and multiline math environments like align* count as display math. (You can use inline math in table cells, but that's about it.)

Attached are three less than perfect possible solutions. The multicolumn approach handles the titles nicely, but you have to futz with the vertical spacing of the equation environments, and because they are two separate environments and equations with fractions eat more vertical space than those without, the equations on either side won't line up nicely. The align* approach handles the equations just fine, but getting the titles in will be a problem -- using \multicolumn only works in array and tabular environments, and apparently align* and its siblings don't count as array environments.

The final approach is to use a plain old math array, with \multicolumn to do the headings. Spacing is different -- more space around the equal signs, smaller fractions -- but if you're not finicky it might work for you. Note that whereas the headings occupy columns 1-3 and 5-7 respectively (column 4 is for the vertical spacer), you have to put the second \multicolumn in column 3. This is because LyX doesn't read the multicolumn commands and adjust the number of column separators (&) accordingly. LaTeX will apparently ignore the extras if they are at the end of the line, but it chokes on them if they occur in the middle of the line.

One other tip re the final solution. When you type '\multicolumn{' LyX will recognize you're about to enter an argument, and supply the closing brace. To enter the next two arguments, though, you can't just type the braces; LyX will take them as literal text. Type '\{' or click the TeX button and then type '{' to get each additional argument rolling.

/Paul

Attachment: eqs.lyx
Description: application/lyx

Reply via email to