3

I would like to write a 2*2 matrix with one of the coefficients given by a very long formula that I would like to write on two lines.

I tried this

 \begin{displaymath}
  \begin{pmatrix}
    X & X \\
\parbox[c]{3cm}{a+b+c+d\\ +e+f+g+h+j+t\\E+G+T+F+E} & X
  \end{pmatrix}
\end{displaymath}

But I am not very satisfied with it. I was hoping some function or package exist to do something cleaner.

How can I do it?

3
  • 4
    Please, be so kind and show us what you try so far. Perhaps some of the amsmath or mathtools math environments can solve your problem.
    – Zarko
    Oct 22 at 18:24
  • 3
    Please, edit your question and add to it an MWE (Minimal Working Example), a small but complete document with your matrix only, which reproduce problem. MWE preamble let be restricted to packages relevant to your problem. Help us to help you.
    – Zarko
    Oct 22 at 18:45
  • Is it really the case that there is no plus sign at the beginning of the third line, before the "E"? This has resulted in at least one questionable result in the answers already given. Oct 23 at 0:37
3

One of amsmath can be a solution for your problem. However, you can introduce a new variable in your matrix as shown in the MWE below:

\documentclass{article}
\usepackage{mathtools}

\begin{document}
\[
  \begin{pmatrix}
            X   & X \\
\begin{gathered} a+b+c+d\\
                 {}+e+f+g+h+j+t\\
                 E+G+T+F+E
\end{gathered}  & X
  \end{pmatrix}
\]

or
\[
  \begin{pmatrix}
    X   & X \\
    Y   & X
  \end{pmatrix}
\]
where $Y=a+b+c+d +e+f+g+h+j+t E+G+T+F+E$

\end{document}

Enter image description here

Addendum:

For the first example, someone may have liked that the long equation is written in a more condensed way. This can be achieved for example by use of matrix instead of gathered written with a \small font size:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\[
\begin{pmatrix}
            X   & X     \\[1ex]
\small\begin{matrix}
    a+b+c+d+e\\
    {}+f+g+h+j+t\\
    E+G+T+F+E
\end{matrix} & X
  \end{pmatrix}
\]
\end{document}

Enter image description here

2
  • 2nd option is better by far.
    – Joce
    Oct 22 at 20:17
  • @Joce, I am of the same opinion. That is reason why I add this possibilities. Thank you for comment!
    – Zarko
    Oct 22 at 20:47
2

I guess you've provided an actual use case for drawing horizontal and vertical lines to bring out the structure of the 2x2 matrix.

The following solution uses no extra packages, just a pair of basic array environments.

enter image description here

\documentclass{article}
\begin{document}
\[
  \left(
  \begin{array}{@{}c|c@{\,}}
     X & X \\
     \hline
     \begin{array}{@{}c@{}}  
        a+b+c+d\\ 
        +e+f+g+h+j+t\\
        +E+G+T+F+E 
     \end{array} 
       & X      
  \end{array}
  \right)
\] 
\end{document}
2

Using the same style of the image of Mico, here I add another option using the matrix environment. I think that with the nicematrix package it is possible to realize similar output.

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath,amssymb}
\begin{document}
\[
  \left(\begin{array}{c|c}
     X & X\\ \hline
       \begin{matrix} a+b+c+d\\
        +e+f+g+h+j+t\\
        +E+G+T+F+E \end{matrix} &  X
  \end{array}\right)
\]
\end{document}

Enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.