3

I am typing a matrix in a document class but its size is too large to fit on the width the page. I have also used TeX code \tiny but it is making font of matrix entries too small. I am not able to fix this problem. Could anybody help me? I would be very much thankful to you. Here is the tex code that I am using .

\documentclass{article}
\usepackage{latexsym}
\usepackage{latexsym}
\usepackage{amsmath, times, amsfonts, mathrsfs, amssymb}
\usepackage{amsmath}
  \usepackage{amssymb}


\usepackage{graphicx}
       \usepackage{subfigure}
        \usepackage[labelsep=period]{caption}


\parindent 0.5 cm
\makeatletter \oddsidemargin .01in \evensidemargin .01in \textwidth
15cm \topmargin -1cm \textheight 20.5cm
\newcommand{\singlespacing}{\let\CS=\@currsize
\renewcommand{\baselinestretch}{1}\tiny\CS}
\newcommand{\doublespacing}{\let\CS=\@currsize
\renewcommand{\baselinestretch}{1.7}\tiny\CS}
\newcommand{\tab}{\hspace*{2em}}
\begin{document}
$X_1 = \left(
         \begin{array}{cccccc}
           1.059200000000000 & -1.059200000000000  & 0 & 0 & 0 & 0 \\
           -1.059200000000000 &  1.059200000000000  & 0 & 0 & 0 & 0 \\
           0 & 0 &  1.059200000000000 & -1.059200000000000 & 0 & 0 \\
           0 & 0 & -1.059200000000000 & 1.059200000000000 & 0 & 0 \\
           0 & 0& 0.364800000000000 & -1.364800000000000 &  0.694400000000000 & 0.305600000000000 \\
           0 & 0 &  -1.364800000000000 &  0.364800000000000 & 0.305600000000000 & 0.694400000000000 \\
         \end{array}
       \right)
$
\end{document}
  • I guess, instead of specifying the margins and other page layout parameters on your own (which might be inconsistent), you might prefer to use geometry package. I am not saying this might be the cause of the problem, but, take this as a suggestion. – kan Apr 21 '13 at 8:41
  • @kan What are the changes i have to do to use geometry package? Thanks – srijan Apr 21 '13 at 8:46
  • 2
    Hmm, I'd say just get rid of the page layout parameters and look at the documentation of geometry package to see how you'd change those parameters using geometry package. Also, note that, you have loaded the same <package> twice for many values of <package>. – kan Apr 21 '13 at 8:51
  • 1
    What's the meaning of all those zeroes? – egreg Apr 21 '13 at 9:33
8

I cannot see the sense of all those zeros. However, use:

\noindent
\resizebox{\linewidth}{!}{\arraycolsep=2pt%
$X_1 = \left(
  \begin{array}{@{}*6r}
  1.059200000000000 & -1.059200000000000  & 0 & 0 & 0 & 0 \\
 -1.059200000000000 &  1.059200000000000  & 0 & 0 & 0 & 0 \\
  0 & 0 &  1.059200000000000 & -1.059200000000000 & 0 & 0 \\
  0 & 0 & -1.059200000000000 & 1.059200000000000 & 0 & 0 \\
  0 & 0& 0.364800000000000 & -1.364800000000000 &  0.694400000000000 & 0.305600000000000 \\
  0 & 0 &  -1.364800000000000 &  0.364800000000000 & 0.305600000000000 & 0.694400000000000 \\
  \end{array}
\right)
$}
| improve this answer | |
  • Thanks for the help. I have one more question can we increase the font size of the matrix entries? – srijan Apr 21 '13 at 9:04
  • not really, see my edit. – user2478 Apr 21 '13 at 9:44
  • 1
    @srijan You can't have normal font size if you want to squeeze the matrix in your page: the natural width of the formula is more than 22 centimeters, that become 21 with the last adjustment. – egreg Apr 21 '13 at 9:45
5

enter image description here

I removed all the negative margin and other settings (If you need to change the page size, I'd recommend the geometry package). I removed the \tiny\CS weirdness from your doublespace settings. Using amsmath pmatrix gives a tighter setting of the matrix as you requested, but I also removed the trailing zeros (which can not possibly be the best way to give that information, if they are information carrying at all) and I used display math instead of inline math as the expression is clearly too large to be inline. Also removed several duplicated \usepackage lines.

\documentclass{article}

\usepackage{amsmath, times, amsfonts, mathrsfs, amssymb}


\usepackage{graphicx}
       \usepackage{subfigure}
        \usepackage[labelsep=period]{caption}



\newcommand{\singlespacing}{\renewcommand{\baselinestretch}{1}\selectfont}
\newcommand{\doublespacing}{\renewcommand{\baselinestretch}{1.7}\selectfont}
\newcommand{\tab}{\hspace*{2em}}
\begin{document}

\[
X_1 =     \begin{pmatrix}
           1.0592 & -1.0592  & 0 & 0 & 0 & 0 \\
           -1.0592 &  1.0592  & 0 & 0 & 0 & 0 \\
           0 & 0 &  1.0592 & -1.0592 & 0 & 0 \\
           0 & 0 & -1.0592 & 1.0592 & 0 & 0 \\
           0 & 0& 0.3648 & -1.3648 &  0.6944 & 0.3056 \\
           0 & 0 &  -1.3648 &  0.3648 & 0.3056 & 0.6944 \\
         \end{pmatrix}
\]
\end{document}

Or for Barbara:

enter image description here

\documentclass{article}

\usepackage{amsmath, times, amsfonts, mathrsfs, amssymb,dcolumn}


\usepackage{graphicx}
       \usepackage{subfigure}
        \usepackage[labelsep=period]{caption}



\newcommand{\singlespacing}{\renewcommand{\baselinestretch}{1}\selectfont}
\newcommand{\doublespacing}{\renewcommand{\baselinestretch}{1.7}\selectfont}
\newcommand{\tab}{\hspace*{2em}}

\makeatletter
\def\env@matrix{\hskip -\arraycolsep
  \let\@ifnextchar\new@ifnextchar
  \array{*\c@MaxMatrixCols {D{.}{.}{2.4}}}}
\makeatother

\begin{document}

\[
X_1 =     \begin{pmatrix}
           1.0592 & -1.0592  & 0 & 0 & 0 & 0 \\
           -1.0592 &  1.0592  & 0 & 0 & 0 & 0 \\
           0 & 0 &  1.0592 & -1.0592 & 0 & 0 \\
           0 & 0 & -1.0592 & 1.0592 & 0 & 0 \\
           0 & 0& 0.3648 & -1.3648 &  0.6944 & 0.3056 \\
           0 & 0 &  -1.3648 &  0.3648 & 0.3056 & 0.6944 \\
         \end{pmatrix}
\]
\end{document}
| improve this answer | |
  • Thank you very much for your reply. I am using iteration method and given matrix is the outcome of first iterations which shows many zeros after the decimals but same is not the case with the other iterates. I can't squeeze matrix like this. – srijan Apr 21 '13 at 9:50
  • @srijan is your code really numerically accurate to that many decimal places? That seems highly improbable if you are using standard double arithmetic for the iteration. So even if you don't want to lose all those zeros it is highly likely that you should format all your floating point numbers to some reasonable number of significant digits to reflect the numerical accuracy of the data. – David Carlisle Apr 21 '13 at 9:56
  • Calisle I have taken $6 \times 6 $ small order matrix and computing Drazin inverse of the matrix. I am comparing my method with the method published in a good journal where author has explicitly written matrix like this. Thanks for your valuable suggestions. – srijan Apr 21 '13 at 10:10
  • @DavidCarlisle -- i really do recommend aligning the decimal points. – barbara beeton Apr 24 '13 at 21:29
  • @barbarabeeton there's a brilliant(?) package dcolumn for aligning on points, do you have a cunning plan to incorporate that with pmatrix or do you mean that you shouldn't use the ams matrix setting and drop back to the standard array ? – David Carlisle Apr 24 '13 at 21:31

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.