0

I have this large table and wish to squash it to fit the default margins, is a solution please?

\documentclass[12pt, a4paper]{report}
\usepackage[utf8]{inputenc} 
\usepackage[T1]{fontenc} 
\usepackage{bm}
\usepackage{nccmath}
\usepackage{amsfonts, graphicx, verbatim, mathtools,amssymb, amsthm, mathrsfs}
\usepackage{array}
    \usepackage{enumitem}
\usepackage{lipsum}
\usepackage{floatrow}

\begin{document}

\[
\setlength\arraycolsep{3pt} % default:5pt
\renewcommand\arraystretch{1.2}
\begin{array}{@{} c | *{8}{c} @{}}
        & (0,(0,0)) & (0,(0,1)) & (0,(1,0)) & (0,(1,1)) & (1,(0,0)) & (1,(0,1)) & (1,(1,0)) & (1,(1,1))\\
 \hline
 (0,(0,0)) & (0,(0,0)) & (0,(0,1)) & (0,(1,0)) & (0,(1,1)) & (1,(0,0)) & (1,(0,1)) & (1,(1,0)) & (1,(1,1))\\
 (0,(0,1)) & (0,(0,1)) & (0,(0,0)) & (0,(1,1)) & (0,(1,0)) & (1,(0,1)) & (1,(0,0)) & (1,(1,1)) & (1,(1,0))\\
 (0,(1,0)) & (0,(1,0)) & (0,(1,1)) & (0,(0,0)) & (0,(0,1)) & (1,(1,0)) & (1,(1,1)) & (1,(0,0)) & (1,(0,1))\\
 (0,(1,1)) & (0,(1,1)) & (0,(1,0)) & (0,(0,1)) & (0,(0,0)) & (1,(1,1)) & (1,(1,0)) & (1,(0,1)) & (1,(0,0))\\
 (1,(0,0)) & (1,(0,0)) & (1,(1,0)) & (1,(0,1)) & (1,(1,1)) & (0,(0,0)) & (0,(1,0)) & (0,(0,1)) & (0,(1,1))\\
 (1,(0,1)) & (1,(0,1)) & (1,(1,1)) & (1,(0,0)) & (1,(1,0)) & (0,(0,1)) & (0,(1,1)) & (0,(0,0)) & (0,(1,0))\\
 (1,(1,0)) & (1,(1,0)) & (1,(0,0)) & (1,(1,1)) & (1,(0,1)) & (0,(1,0)) & (0,(0,0)) & (0,(1,1)) & (0,(0,1))\\
 (1,(1,1)) & (1,(1,1)) & (1,(0,1)) & (1,(1,0)) & (1,(0,0)) & (0,(1,1)) & (0,(0,1)) & (0,(1,0)) & (0,(0,0))\\
\end{array}
\]

\[ % no need for an 'align*' env.
\setlength\arraycolsep{3pt} % default:5pt
\renewcommand\arraystretch{1.2}
\begin{array}{@{} c | *{8}{c} @{}}
    & (0,(0,0)) & (0,(0,1)) & (0,(1,0)) & (0,(1,1)) & (1,(0,0)) & (1,(0,1)) & (1,(1,0)) & (1,(1,1))\\
\hline
\chi_{(0,(0,0))} &1 & \phantom{-}1 & \phantom{-}1 & \phantom{-}1 & \phantom{-}1 & \phantom{-}1 & \phantom{-}1 & \phantom{-}1 \\
\chi_{(0,(0,1))} &1 & \phantom{-}1 & \phantom{-}1 & \phantom{-}1 & -1 & -1 & -1 & -1\\
\chi_{(0,(1,0))} &1 & \phantom{-}1 & -1 & -1 & \phantom{-}1 & \phantom{-}1 & -1 & -1\\
\chi_{(0,(1,1))} &1 & \phantom{-}1 & -1 & -1 & -1 & -1 & \phantom{-}1 & \phantom{-}1 \\
\chi_{(1,(0,0))} &1 &-1 & \phantom{-}1 &-1 & \phantom{-}1 &-1 & \phantom{-}1 &-1\\
\chi_{(1,(0,1))} &1 &-1 & \phantom{-}1 &-1 & -1 & \phantom{-}1 &-1 & \phantom{-}1 \\
\chi_{(1,(1,0))} &1 &-1 & -1 & \phantom{-}1 & \phantom{-}1 & -1 & -1 & \phantom{-}1 \\
\chi_{(1,(1,1))} &1 &-1 & -1 & \phantom{-}1 &-1 & \phantom{-}1 & \phantom{-}1 & -1\\
\end{array}
\]

\end{document}

Edit:

This is a similar table that fits perfectly with the default margins which is what I want with my table:

\begin{align*}
\setlength\arraycolsep{3pt} % default:5pt
\renewcommand\arraystretch{1.2}
\begin{array}{@{} c | *{8}{c} @{}}
  +  & $(0,0,0)$ & $(0,0,1)$ & $(0,1,0)$ & $(0,1,1)$ & $(1,0,0)$ & $(1,0,1)$ & $(1,1,0)$ & $(1,1,1)$\\
    \cline{1-9}
   $(0,0,0)$ & $(0,0,0)$ & $(0,0,1)$ & $(0,1,0)$ & $(0,1,1)$ & $(1,0,0)$ & $(1,0,1)$ & $(1,1,0)$ & $(1,1,1)$\\
    $(0,0,1)$ & $(0,0,1)$ & $(0,0,0)$ & $(0,1,1)$ & $(0,1,0)$ & $(1,0,1)$ & $(1,0,0)$ & $(1,1,1)$ & $(1,1,0)$\\
    $(0,1,0)$ & $(0,1,0)$ & $(0,1,1)$ & $(0,0,0)$ & $(0,0,1)$ & $(1,1,0)$ & $(1,1,1)$ & $(1,0,0)$ & $(1,0,1)$\\
    $(0,1,1)$ & $(0,1,1)$ & $(0,1,0)$ & $(0,0,1)$ & $(0,0,0)$ & $(1,1,1)$ & $(1,1,0)$ & $(1,0,1)$ & $(1,0,0)$\\
    $(1,0,0)$ & $(1,0,0)$ & $(1,0,1)$ & $(1,1,0)$ & $(1,1,1)$ & $(0,0,0)$ & $(0,0,1)$ & $(0,1,0)$ & $(0,1,1)$\\
    $(1,0,1)$ & $(1,0,1)$ & $(1,0,0)$ & $(1,1,1)$ & $(1,1,0)$ & $(0,0,1)$ & $(0,0,0)$ & $(0,1,1)$ & $(0,1,0)$\\
    $(1,1,0)$ & $(1,1,0)$ & $(1,1,1)$ & $(1,0,0)$ & $(1,0,1)$ & $(0,1,0)$ & $(0,1,1)$ & $(0,0,0)$ & $(0,0,1)$\\
    $(1,1,1)$ & $(1,1,1)$ & $(1,1,0)$ & $(1,0,1)$ & $(1,0,0)$ & $(0,1,1)$ & $(0,1,0)$ & $(0,0,1)$ & $(0,0,0)$\\
\end{array}
\end{align*}

The character table:

\[ 
\setlength\arraycolsep{3pt} % default:5pt
\renewcommand\arraystretch{1.2}
\begin{array}{@{} c | *{8}{c} @{}}
  +  & (0,0,0) & (0,0,1) & (0,1,0) & (0,1,1) & (1,0,0) & (1,0,1) & (1,1,0) & (1,1,1)\\
\hline
\chi_{(0,0,0)} &1 & \phantom{-}1 & \phantom{-}1 & \phantom{-}1 & \phantom{-}1 & \phantom{-}1 & \phantom{-}1 & \phantom{-}1 \\
\chi_{(0,0,1)} &1 & \phantom{-}1 & \phantom{-}1 & \phantom{-}1 & -1 & -1 & -1 & -1\\
\chi_{(0,1,0)} &1 & \phantom{-}1 & -1 & -1 & \phantom{-}1 & \phantom{-}1 & -1 & -1\\
\chi_{(0,1,1)} &1 & \phantom{-}1 & -1 & -1 & -1 & -1 & \phantom{-}1 & \phantom{-}1 \\
\chi_{(1,0,0)} &1 &-1 & \phantom{-}1 &-1 & \phantom{-}1 &-1 & \phantom{-}1 &-1\\
\chi_{(1,0,1)} &1 &-1 & \phantom{-}1 &-1 & -1 & \phantom{-}1 &-1 & \phantom{-}1 \\
\chi_{(1,1,0)} &1 &-1 & -1 & \phantom{-}1 & \phantom{-}1 & -1 & -1 & \phantom{-}1 \\
\chi_{(1,1,1)} &1 &-1 & -1 & \phantom{-}1 &-1 & \phantom{-}1 & \phantom{-}1 & -1\\
\end{array}
\]
  • 1
    Please, make your MWE really minimal. Remove all what is not relevant to your table and definition of the page layout. – Zarko Jul 16 '19 at 12:09
  • I need it as its part of a much bigger document which could hinder other things. well I don't know what is necessary and what isn't as im new to latex. this was a template given to me – johnny Jul 16 '19 at 12:11
  • 1
    Remove all your definition which are not used in table, also all package which are not used in it. And please test reduced table. We need to know only a MWE (Minimal Working Example) which show/demonstrate your problem. – Zarko Jul 16 '19 at 12:15
  • Is that okay now? – johnny Jul 16 '19 at 12:19
  • Much better :-) – Zarko Jul 16 '19 at 12:24
2

I delayed my answer due to lunch :-)

I would try the following:

\documentclass[12pt, a4paper]{report}
\usepackage{bm}
\usepackage{mathrsfs}
\usepackage{amssymb, amsthm,
            mathtools,
            nccmath}
\usepackage{siunitx}

%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}

\begin{document}

\begin{center}
    \footnotesize%\small
    \setlength\tabcolsep{0pt} % default:5pt
    \renewcommand\arraystretch{1.2}
\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}
                             >{$}l<{$} @{\;} | *{8}{c} @{}}
        & (0,(0,0)) & (0,(0,1)) & (0,(1,0)) & (0,(1,1))
        & (1,(0,0)) & (1,(0,1)) & (1,(1,0)) & (1,(1,1)) \\
 \hline
 (0,(0,0)) & (0,(0,0)) & (0,(0,1)) & (0,(1,0)) & (0,(1,1)) & (1,(0,0)) & (1,(0,1)) & (1,(1,0)) & (1,(1,1))\\
 (0,(0,1)) & (0,(0,1)) & (0,(0,0)) & (0,(1,1)) & (0,(1,0)) & (1,(0,1)) & (1,(0,0)) & (1,(1,1)) & (1,(1,0))\\
 (0,(1,0)) & (0,(1,0)) & (0,(1,1)) & (0,(0,0)) & (0,(0,1)) & (1,(1,0)) & (1,(1,1)) & (1,(0,0)) & (1,(0,1))\\
 (0,(1,1)) & (0,(1,1)) & (0,(1,0)) & (0,(0,1)) & (0,(0,0)) & (1,(1,1)) & (1,(1,0)) & (1,(0,1)) & (1,(0,0))\\
 (1,(0,0)) & (1,(0,0)) & (1,(1,0)) & (1,(0,1)) & (1,(1,1)) & (0,(0,0)) & (0,(1,0)) & (0,(0,1)) & (0,(1,1))\\
 (1,(0,1)) & (1,(0,1)) & (1,(1,1)) & (1,(0,0)) & (1,(1,0)) & (0,(0,1)) & (0,(1,1)) & (0,(0,0)) & (0,(1,0))\\
 (1,(1,0)) & (1,(1,0)) & (1,(0,0)) & (1,(1,1)) & (1,(0,1)) & (0,(1,0)) & (0,(0,0)) & (0,(1,1)) & (0,(0,1))\\
 (1,(1,1)) & (1,(1,1)) & (1,(0,1)) & (1,(1,0)) & (1,(0,0)) & (0,(1,1)) & (0,(0,1)) & (0,(1,0)) & (0,(0,0))\\
\end{tabular*}
\end{center}

\begin{center}
    \footnotesize%\small
    \setlength\tabcolsep{0pt} % default:5pt
    \renewcommand\arraystretch{1.2}
\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}} 
                             >{$}l<{$} @{\;}| *{8}{S[table-format=-1.0]}}
        & {(0,(0,0))} & {(0,(0,1))} & {(0,(1,0))} & {(0,(1,1))}
        & {(1,(0,0))} & {(1,(0,1))} & {(1,(1,0))} & {(1,(1,1))} \\
\hline
\chi_{(0,(0,0))}    & 1 &  1 &  1 &  1 &  1 &  1 &  1 &  1  \\
\chi_{(0,(0,1))}    & 1 &  1 &  1 &  1 & -1 & -1 & -1 & -1  \\
\chi_{(0,(1,0))}    & 1 &  1 & -1 & -1 &  1 &  1 & -1 & -1  \\
\chi_{(0,(1,1))}    & 1 &  1 & -1 & -1 & -1 & -1 &  1 &  1  \\
\chi_{(1,(0,0))}    & 1 & -1 &  1 & -1 &  1 & -1 &  1 & -1  \\
\chi_{(1,(0,1))}    & 1 & -1 &  1 & -1 & -1 &  1 & -1 &  1  \\
\chi_{(1,(1,0))}    & 1 & -1 & -1 &  1 &  1 & -1 & -1 &  1  \\
\chi_{(1,(1,1))}    & 1 & -1 & -1 &  1 & -1 &  1 &  1 & -1  \\
\end{tabular*}
\end{center}

\end{document}

it also work if you use \small font size.

|improve this answer|||||
  • Perfecto! I appreciate it greatly :) – johnny Jul 16 '19 at 13:00
  • You must have a pretty long lunch hour. :-) – Mico Jul 16 '19 at 13:16
  • 1
    @Mico, well my wife is very strict about lunch, specially with my help at dish washing after then :-) – Zarko Jul 16 '19 at 13:31
1

With footnotesize and a bit less space between the columns the table fits inside the margins:

\documentclass[12pt, a4paper]{report}
\usepackage[utf8]{inputenc} 
\usepackage[T1]{fontenc} 
\usepackage{bm}
\usepackage{nccmath}
\usepackage{amsfonts, graphicx, verbatim, mathtools,amssymb, amsthm, mathrsfs}
\usepackage{array}
\usepackage{enumitem}
\usepackage{lipsum}
\usepackage{floatrow}

\begin{document}

{
\footnotesize
\[
\setlength\arraycolsep{2pt} % default:5pt
\renewcommand\arraystretch{1.2}
\begin{array}{@{} c | *{8}{c} @{}}
        & (0,(0,0)) & (0,(0,1)) & (0,(1,0)) & (0,(1,1)) & (1,(0,0)) & (1,(0,1)) & (1,(1,0)) & (1,(1,1))\\
 \hline
 (0,(0,0)) & (0,(0,0)) & (0,(0,1)) & (0,(1,0)) & (0,(1,1)) & (1,(0,0)) & (1,(0,1)) & (1,(1,0)) & (1,(1,1))\\
 (0,(0,1)) & (0,(0,1)) & (0,(0,0)) & (0,(1,1)) & (0,(1,0)) & (1,(0,1)) & (1,(0,0)) & (1,(1,1)) & (1,(1,0))\\
 (0,(1,0)) & (0,(1,0)) & (0,(1,1)) & (0,(0,0)) & (0,(0,1)) & (1,(1,0)) & (1,(1,1)) & (1,(0,0)) & (1,(0,1))\\
 (0,(1,1)) & (0,(1,1)) & (0,(1,0)) & (0,(0,1)) & (0,(0,0)) & (1,(1,1)) & (1,(1,0)) & (1,(0,1)) & (1,(0,0))\\
 (1,(0,0)) & (1,(0,0)) & (1,(1,0)) & (1,(0,1)) & (1,(1,1)) & (0,(0,0)) & (0,(1,0)) & (0,(0,1)) & (0,(1,1))\\
 (1,(0,1)) & (1,(0,1)) & (1,(1,1)) & (1,(0,0)) & (1,(1,0)) & (0,(0,1)) & (0,(1,1)) & (0,(0,0)) & (0,(1,0))\\
 (1,(1,0)) & (1,(1,0)) & (1,(0,0)) & (1,(1,1)) & (1,(0,1)) & (0,(1,0)) & (0,(0,0)) & (0,(1,1)) & (0,(0,1))\\
 (1,(1,1)) & (1,(1,1)) & (1,(0,1)) & (1,(1,0)) & (1,(0,0)) & (0,(1,1)) & (0,(0,1)) & (0,(1,0)) & (0,(0,0))\\
\end{array}
\]
}

{
\footnotesize
\[ % no need for an 'align*' env.
\setlength\arraycolsep{2pt} % default:5pt
\renewcommand\arraystretch{1.2}
\begin{array}{@{} c | *{8}{c} @{}}
    & (0,(0,0)) & (0,(0,1)) & (0,(1,0)) & (0,(1,1)) & (1,(0,0)) & (1,(0,1)) & (1,(1,0)) & (1,(1,1))\\
\hline
\chi_{(0,(0,0))} &1 & \phantom{-}1 & \phantom{-}1 & \phantom{-}1 & \phantom{-}1 & \phantom{-}1 & \phantom{-}1 & \phantom{-}1 \\
\chi_{(0,(0,1))} &1 & \phantom{-}1 & \phantom{-}1 & \phantom{-}1 & -1 & -1 & -1 & -1\\
\chi_{(0,(1,0))} &1 & \phantom{-}1 & -1 & -1 & \phantom{-}1 & \phantom{-}1 & -1 & -1\\
\chi_{(0,(1,1))} &1 & \phantom{-}1 & -1 & -1 & -1 & -1 & \phantom{-}1 & \phantom{-}1 \\
\chi_{(1,(0,0))} &1 &-1 & \phantom{-}1 &-1 & \phantom{-}1 &-1 & \phantom{-}1 &-1\\
\chi_{(1,(0,1))} &1 &-1 & \phantom{-}1 &-1 & -1 & \phantom{-}1 &-1 & \phantom{-}1 \\
\chi_{(1,(1,0))} &1 &-1 & -1 & \phantom{-}1 & \phantom{-}1 & -1 & -1 & \phantom{-}1 \\
\chi_{(1,(1,1))} &1 &-1 & -1 & \phantom{-}1 &-1 & \phantom{-}1 & \phantom{-}1 & -1\\
\end{array}
\]
}

\end{document}
|improve this answer|||||
0

this link might help you: How do I properly resize an array?

Also, I tried to follow the link to modify your code and this is what I got:

\documentclass[12pt, a4paper]{report}
\def\A{A}
\def\B{B}
\def\false{\ne}
\def\true{=}
\usepackage{graphicx,amsmath}
\usepackage[utf8]{inputenc} 
\usepackage[T1]{fontenc} 
\usepackage{bm}
\usepackage{nccmath}
\usepackage{amsfonts, graphicx, verbatim, mathtools,amssymb, amsthm, mathrsfs}
\usepackage{array}
    \usepackage{enumitem}
\usepackage{lipsum}
\usepackage{floatrow}


\begin{document}


\setlength\arraycolsep{3pt} % default:5pt
\renewcommand\arraystretch{1.2}
\begin{itemize}
\item \resizebox{\textwidth}{!}{$\displaystyle

\begin{array}{@{} c | *{8}{c} @{}}
        & (0,(0,0)) & (0,(0,1)) & (0,(1,0)) & (0,(1,1)) & (1,(0,0)) & (1,(0,1)) & (1,(1,0)) & (1,(1,1))\\
 \hline
 (0,(0,0)) & (0,(0,0)) & (0,(0,1)) & (0,(1,0)) & (0,(1,1)) & (1,(0,0)) & (1,(0,1)) & (1,(1,0)) & (1,(1,1))\\
 (0,(0,1)) & (0,(0,1)) & (0,(0,0)) & (0,(1,1)) & (0,(1,0)) & (1,(0,1)) & (1,(0,0)) & (1,(1,1)) & (1,(1,0))\\
 (0,(1,0)) & (0,(1,0)) & (0,(1,1)) & (0,(0,0)) & (0,(0,1)) & (1,(1,0)) & (1,(1,1)) & (1,(0,0)) & (1,(0,1))\\
 (0,(1,1)) & (0,(1,1)) & (0,(1,0)) & (0,(0,1)) & (0,(0,0)) & (1,(1,1)) & (1,(1,0)) & (1,(0,1)) & (1,(0,0))\\
 (1,(0,0)) & (1,(0,0)) & (1,(1,0)) & (1,(0,1)) & (1,(1,1)) & (0,(0,0)) & (0,(1,0)) & (0,(0,1)) & (0,(1,1))\\
 (1,(0,1)) & (1,(0,1)) & (1,(1,1)) & (1,(0,0)) & (1,(1,0)) & (0,(0,1)) & (0,(1,1)) & (0,(0,0)) & (0,(1,0))\\
 (1,(1,0)) & (1,(1,0)) & (1,(0,0)) & (1,(1,1)) & (1,(0,1)) & (0,(1,0)) & (0,(0,0)) & (0,(1,1)) & (0,(0,1))\\
 (1,(1,1)) & (1,(1,1)) & (1,(0,1)) & (1,(1,0)) & (1,(0,0)) & (0,(1,1)) & (0,(0,1)) & (0,(1,0)) & (0,(0,0))\\
\end{array}$

 }
    \end{itemize}




\setlength\arraycolsep{3pt} % default:5pt
\renewcommand\arraystretch{1.2}
\begin{itemize}
\item \resizebox{\textwidth}{!}{$\displaystyle
\begin{array}{@{} c | *{8}{c} @{}}
    & (0,(0,0)) & (0,(0,1)) & (0,(1,0)) & (0,(1,1)) & (1,(0,0)) & (1,(0,1)) & (1,(1,0)) & (1,(1,1))\\
\hline
\chi_{(0,(0,0))} &1 & \phantom{-}1 & \phantom{-}1 & \phantom{-}1 & \phantom{-}1 & \phantom{-}1 & \phantom{-}1 & \phantom{-}1 \\
\chi_{(0,(0,1))} &1 & \phantom{-}1 & \phantom{-}1 & \phantom{-}1 & -1 & -1 & -1 & -1\\
\chi_{(0,(1,0))} &1 & \phantom{-}1 & -1 & -1 & \phantom{-}1 & \phantom{-}1 & -1 & -1\\
\chi_{(0,(1,1))} &1 & \phantom{-}1 & -1 & -1 & -1 & -1 & \phantom{-}1 & \phantom{-}1 \\
\chi_{(1,(0,0))} &1 &-1 & \phantom{-}1 &-1 & \phantom{-}1 &-1 & \phantom{-}1 &-1\\
\chi_{(1,(0,1))} &1 &-1 & \phantom{-}1 &-1 & -1 & \phantom{-}1 &-1 & \phantom{-}1 \\
\chi_{(1,(1,0))} &1 &-1 & -1 & \phantom{-}1 & \phantom{-}1 & -1 & -1 & \phantom{-}1 \\
\chi_{(1,(1,1))} &1 &-1 & -1 & \phantom{-}1 &-1 & \phantom{-}1 & \phantom{-}1 & -1\\
\end{array}$
 }
    \end{itemize}

\end{document}

Try it! and I'm not sure if this will satisfy you or not.

Regards,

|improve this answer|||||
  • I am getting errors as I defined A as something else and also getting errors before the first 'end{itemize}' – johnny Jul 16 '19 at 12:46
  • I don't have any errors! did you copy and paste my code as it is? I removed from your code "[" and "]". – Sara Alshamsi Jul 16 '19 at 12:51
  • I opened a new document, copied your code and still got errors! no worries though. – johnny Jul 16 '19 at 12:55

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.