[texhax] Multiline array elements

Steve Schwartz s.schwartz at imperial.ac.uk
Thu Aug 18 16:28:47 CEST 2011


On Thu, 2011-08-18 at 15:54 +0200, Cong Ding wrote:
> no other solutions, i think
> 
> because when you are writing a long algebraic expressions in general
> situation (not in table), it is impossible to split it into
> multi-lines automatically.

Not true if you use inline maths (i.e., not displaymath). The following
works:

=====================
\documentclass{article}
\newcommand\eqone{$a + b + c + d + e + f + g$}
\begin{document}
\[
\begin{array}{lcccr}
a && b && c \\[1ex]
d && e && f \\[1ex]
\hbox{abc} && \hbox{def} && \hbox{hij}\\[3ex]
\parbox{0.2\textwidth}{Hello Hello Hello Hello Hello} && H && I\\[6ex]
\parbox{0.2\textwidth}{\eqone} && \parbox{0.2\textwidth}{\eqone} &&
\parbox{0.2\textwidth}{\eqone}
\end{array}
\]
\end{document}

If you don't need it in an array environment, it would probably be
easier in tabularx. I've added extra columns and manually played with
the line spacing.

Steve

-- 
+-------------------------------------------------------------------+
Professor Steven J Schwartz        Phone: +44-(0)20-7594-7660
Head, Space & Atmospheric Physics  Fax:   +44-(0)20-7594-7772
The Blackett Laboratory            E-mail: s.schwartz at imperial.ac.uk
Imperial College London            Office: Huxley 6M67A 
London SW7 2AZ, U.K.               Web: www.sp.ph.ic.ac.uk/~sjs
+-------------------------------------------------------------------+



More information about the texhax mailing list