TransWikia.com

Need help fitting this matrix on a page

TeX - LaTeX Asked by user242714 on May 27, 2021

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 Answers

You can do something like this:

$$
pmatrix{
   0& 0& 0& 0& A& A& 0& 0& 0& 0& 0& 0& 0& Ccr
   0& 0& A& 0& 0& 0& 0& 0& 0& 0& 0& C& 0& 0cr
   0& 0& 0& 0& A& A& 0& 0& 0& 0& 0& 0& 0& Ccr
   0& 0& 0& A& 0& 0& 0& 0& 0& 0& 0& 0& C& 0cr
   0& 0& 0& 0& A& A& 0& 0& 0& 0& 0& 0& 0& Ccr
   0& 0&-A& 0& 0& 0& 0& 0& B& 0&-B&-C& 0& 0cr
   0&-A& 0& 0& 0& 0& 0& 0& A& 0& H& 0& 0& 0cr
  -A& 0& 0& 0& 0& 0& A&-B& 0& 0& C& 0& 0& 0cr
   0& 0& 0& 0& B& B& 0& 0& 0& 0& 0& 0& 0& Fcr
   0& 0& 0& 0& 0& 0& 0& 0& 0& A& 0& 0& 0& Gcr
   0& 0& B& 0& 0& 0& 0& 0& 0& 0& K& F& G& 0cr
   0& 0& 0& 0& A& A& 0& 0& 0& 0& 0& 0& 0& Ccr
   0& B& C& 0& 0& 0& 0& 0& 0& 0& L& E& 0& 0cr
   0& 0& 0& 0& C& C& 0&-A& 0& 0& 0& 0& 0& Kcr
   0& 0& 0& D& 0& 0& 0& 0& 0& 0& G& 0& E& 0cr
   B& 0& 0& 0& 0& 0&-B& E& F& G& 0& 0& 0& 0cr
}
$$  
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

Correct answer by wipet on May 27, 2021

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.

Answered by Vincent Kuhlmann on May 27, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP