[texhax] Multiline array elements

when harry met sally whenharry_metsally at yahoo.com
Sat Aug 20 00:20:00 CEST 2011


Is there any simple way to introduce spaces in matrix elements? \, , \; , \quad don't work. I would like my big matrix to be right-justified (currently it is center-justified). I tried to use the following in the header, which fixes the matrix but it messes up a longtable in the document (The header of the table with the column descriptions and the rest of the table don't line up):

\makeatletter
\renewcommand*\env at matrix[1][*\c at MaxMatrixCols c]{%
    \hskip -\arraycolsep
   \let\@ifnextchar\new at ifnextchar
   \array{#1}}
\makeatother

Thanks,
Sally



________________________________
From: Steve Schwartz <s.schwartz at imperial.ac.uk>
To: Cong Ding <dingcongcs at gmail.com>
Cc: "texhax at tug.org" <texhax at tug.org>; when harry met sally <whenharry_metsally at yahoo.com>
Sent: Thursday, August 18, 2011 9:28 AM
Subject: Re: [texhax] Multiline array elements

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
+-------------------------------------------------------------------+

_______________________________________________
TeX FAQ: http://www.tex.ac.uk/faq
Mailing list archives: http://tug.org/pipermail/texhax/
More links: http://tug.org/begin.html

Automated subscription management: http://tug.org/mailman/listinfo/texhax
Human mailing list managers: postmaster at tug.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/texhax/attachments/20110819/b8b418d1/attachment.html>


More information about the texhax mailing list