2

Can someone please help fit this matrix on a page so that it doesn't go beyond the 1inches width margin?

Or if possible, rotate the matrix sideways on a page.

\documentclass{article} 
\usepackage{amsmath,amssymb,graphicx}
\setcounter{MaxMatrixCols}{14}
\begin{document}
\[
\begin{pmatrix}  
0&0&0&0&8as^3&0&0&0&0&0&0&0&0&-4as^4+4as^2bs^2-4as^2cs^2\\   
0& 0&8as^3&0&0&0&0&0&0&0&0&-4as^4+4as^2bs^2-4as^2cs^2 &0&0\\    
0& 0&0&0&8as^3&0&0&0&0&0&0&0&0&-4as^4+4as^2bs^2-4as^2cs^2\\    
0& 0&0&8as^3&0&0&0&0&0&0&0&0&-4as^4+4as^2bs^2-4as^2cs^2&0\\    
0& 0&0&0&8as^3&0&0&0&0&0&0&0&0&-4as^4+4as^2bs^2-4as^2cs^2\\    
0&0&-8as^3&0&0&0&0&8as^3&0&0&-4as^4+4as^2ds^2-4as^2fs^2&4as^4-4as^2bs^2+ 4as^2cs^2&0&0\\        
0&-8as^3&0&0&0&0&0&0&0&0&4as^4-4as^2bs^2+4as^2cs^2&0&0&0 \\    
-8as^3&0&0&0&0&8as^3&-4as^4+4as^2ds^2-4as^2fs^2&0&4as^4-4as^2bs^2 +4as^2cs^2&0&0&0&0&0\\    
0& 0& 0& 0& 4as^4-4as^2ds^2+4as^2fs^2&0&0&0&8as^3&0&0&0&0&  -4as^3cs^2+4as^3es^2-4as^3fs^2\\    
0&0&0&0&0&0&0&0&0&8as^3&0&0&0&-48as^2vo\\    
0&0&4as^4-4as^2ds^2+4as^2fs^2&0&0&0&0&-4as^4+4as^2ds^2-4as^2fs^2&0&0& 8as^3fs^2&-4as^3cs^2+4as^3es^2-4as^3fs^2&-48as^2vo&0\\    
0&0&0&0&8as^3&0&0&0&0&0&0&0&0&-4as^4+4as^2bs^2-4as^2cs^2\\    
0&4as^4-4as^2ds^2+4as^2fs^2&-4as^4+4as^2bs^2-4as^2cs^2&0&0&0&0&0&0&0& -4as^3cs^2+4as^3es^2-4as^3fs^2&8as^3cs^2&0&0\\    
0&0&0&0&-4as^4+4as^2bs^2-4as^2cs^2&0&-8as^3&0&0&0&0&0&0&8as^3cs^2 \\    
0&0&0&4as^4+4as^2bs^2-4as^2cs^2&0&0&0&0&0&0&-48as^2vo&0& 8as^3cs^2&0\\    
4as^4-4as^2ds^2+4as^2fs^2&0&0&0&0&-4as^4+4as^2ds^2-4as^2fs^2&8as^3fs^2&0&-4as^3cs^2+ 4as^3es^2-4as^3fs^2&-48as^2vo&0&0&0&0\\
\end{pmatrix} 
\]
\end{document}
2
  • Welcome to TeX.SE... Can you provide your MWE from \documentclass to \end{document} also error free format....
    – MadyYuvi
    May 22, 2021 at 6:30
  • 1
    Hello, welcome to TeX.SE! Surely that matrix has some structure to it --- are you sure displaying it as one big matrix is the best approach? Expressing it using a simple formula that clarifies the structure might be preferable. Alternatively, perhaps write it as a block matrix (partitioned in some suitable way ideally suggested by whatever you're doing), and the give each block separately.
    – chsk
    May 22, 2021 at 7:00

2 Answers 2

6

You can do something like this:

$$
\pmatrix{
   0& 0& 0& 0& A& A& 0& 0& 0& 0& 0& 0& 0& C\cr
   0& 0& A& 0& 0& 0& 0& 0& 0& 0& 0& C& 0& 0\cr
   0& 0& 0& 0& A& A& 0& 0& 0& 0& 0& 0& 0& C\cr
   0& 0& 0& A& 0& 0& 0& 0& 0& 0& 0& 0& C& 0\cr
   0& 0& 0& 0& A& A& 0& 0& 0& 0& 0& 0& 0& C\cr
   0& 0&-A& 0& 0& 0& 0& 0& B& 0&-B&-C& 0& 0\cr
   0&-A& 0& 0& 0& 0& 0& 0& A& 0& H& 0& 0& 0\cr
  -A& 0& 0& 0& 0& 0& A&-B& 0& 0& C& 0& 0& 0\cr
   0& 0& 0& 0& B& B& 0& 0& 0& 0& 0& 0& 0& F\cr
   0& 0& 0& 0& 0& 0& 0& 0& 0& A& 0& 0& 0& G\cr
   0& 0& B& 0& 0& 0& 0& 0& 0& 0& K& F& G& 0\cr
   0& 0& 0& 0& A& A& 0& 0& 0& 0& 0& 0& 0& C\cr
   0& B& C& 0& 0& 0& 0& 0& 0& 0& L& E& 0& 0\cr
   0& 0& 0& 0& C& C& 0&-A& 0& 0& 0& 0& 0& K\cr
   0& 0& 0& D& 0& 0& 0& 0& 0& 0& G& 0& E& 0\cr
   B& 0& 0& 0& 0& 0&-B& E& F& G& 0& 0& 0& 0\cr
}
$$  
where
$$
\eqalign{
   A &= 8as^3 \cr
   B &= 4as^4 − 4as^2 ds^2 + 4as^2 f s^2 \cr
   C &= −4as^4 + 4as^2 bs^2 − 4as^2 cs^2 \cr
   D &= 4as^4 + 4as^2 bs^2 − 4as^2 cs^2 \cr
   E &= 8as^3 f s^2 \cr
   F &= −4as^3 cs^2 + 4as^3 es^2 − 4as^3 f s^2 \cr
   G &= −48as2 vo \cr
   H &= 4as^4 − 4as^2 bs2 + 4as^2 cs^2 \cr
   K &= 8as^3 f s^2 \cr
   L &= −4as^3 cs^2 + 4as^3 es^2 − 4as^3 f s^2 \cr

}
$$
\bye
2

You can force it to fit within the page by scaling it. The package adjustbox can do so. This gives the code

\documentclass[a4paper,landscape]{article}

\usepackage{amsmath,amssymb}
\usepackage[margin=1in]{geometry}
\usepackage{graphicx}

\usepackage{adjustbox}

\setcounter{MaxMatrixCols}{20}

\begin{document}
    \noindent
    \adjustbox{width=\linewidth}{\parbox{\linewidth}{
        \begin{align*}\begin{pmatrix}  
            0&0&0&0&8as^3&0&0&0&0&0&0&0&0&-4as^4+4as^2bs^2-4as^2cs^2\\
            %
            0& 0&8as^3&0&0&0&0&0&0&0&0&-4as^4+4as^2bs^2-4as^2cs^2 &0&0\\
            %
            0& 0&0&0&8as^3&0&0&0&0&0&0&0&0&-4as^4+4as^2bs^2-4as^2cs^2\\
            %
            0& 0&0&8as^3&0&0&0&0&0&0&0&0&-4as^4+4as^2bs^2-4as^2cs^2&0\\
            %
            0& 0&0&0&8as^3&0&0&0&0&0&0&0&0&-4as^4+4as^2bs^2-4as^2cs^2\\
            %
            0&0&-8as^3&0&0&0&0&8as^3&0&0&-4as^4+4as^2ds^2-4as^2fs^2&4as^4-4as^2bs^2+ 4as^2cs^2&0&0\\
            %
            %
            0&-8as^3&0&0&0&0&0&0&0&0&4as^4-4as^2bs^2+4as^2cs^2&0&0&0 \\
            %
            -8as^3&0&0&0&0&8as^3&-4as^4+4as^2ds^2-4as^2fs^2&0&4as^4-4as^2bs^2 +4as^2cs^2&0&0&0&0&0\\
            %
            0& 0& 0& 0& 4as^4-4as^2ds^2+4as^2fs^2&0&0&0&8as^3&0&0&0&0&  -4as^3cs^2+4as^3es^2-4as^3fs^2\\
            %
            0&0&0&0&0&0&0&0&0&8as^3&0&0&0&-48as^2vo\\
            %
            0&0&4as^4-4as^2ds^2+4as^2fs^2&0&0&0&0&-4as^4+4as^2ds^2-4as^2fs^2&0&0& 8as^3fs^2&-4as^3cs^2+4as^3es^2-4as^3fs^2&-48as^2vo&0\\
            %
            0&0&0&0&8as^3&0&0&0&0&0&0&0&0&-4as^4+4as^2bs^2-4as^2cs^2\\
            %
            0&4as^4-4as^2ds^2+4as^2fs^2&-4as^4+4as^2bs^2-4as^2cs^2&0&0&0&0&0&0&0& -4as^3cs^2+4as^3es^2-4as^3fs^2&8as^3cs^2&0&0\\
            %
            0&0&0&0&-4as^4+4as^2bs^2-4as^2cs^2&0&-8as^3&0&0&0&0&0&0&8as^3cs^2\\
            %
            0&0&0&4as^4+4as^2bs^2-4as^2cs^2&0&0&0&0&0&0&-48as^2vo&0& 8as^3cs^2&0\\
            %
            4as^4-4as^2ds^2+4as^2fs^2&0&0&0&0&-4as^4+4as^2ds^2-4as^2fs^2&8as^3fs^2&0&-4as^3cs^2+ 4as^3es^2-4as^3fs^2&-48as^2vo&0&0&0&0
        \end{pmatrix}\end{align*}
    }}
\end{document}

But you're putting in a ton of columns and rows. Printed on paper, this is going to be very tiny. You could try reducing columns widths by breaking the equations over multiple lines, but in the end it all comes down to the amount of columns.

Very large matrix

Does this answer help you?

EDIT:

About the rotation: first note you can put your page in landscape. For example like in the code I shared (also include the line for package geometry). But if you really want to just rotate it, you can change \adjustbox{width=\linewidth} to \adjustbox{width=\linewidth,rotate=90} (or -90, whichever way you like it rotated).

Don't forget to accept an answer if it solved your problem. Also, check out the idea in wipet's answer.

2
  • Thanks a lot for you help. I would prefer if the matrix could be rotated, so that it can be bigger. I really dont mind it taking the whole page. could you please help with this? Its going to be too tiny if i use it this way. Thanks!
    – user242714
    May 22, 2021 at 7:00
  • @user242714 Updated my answer to say something about that! May 22, 2021 at 7:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .