0

I have been using the following code:

\begin{tabular}{>{$n=}l<{$\hspace{20pt}}*{21}{c}}
0 &&&&&&&&&&&1&&&&&&&&&&\\
1 &&&&&&&&&&1&&1&&&&&&&&&\\
2 &&&&&&&&&1&&2&&2&&&&&&&&\\
3 &&&&&&&&1&&3&&6&&6&&&&&&&\\
4 &&&&&&&1&&4&&12&&24&&24&&&&&&\\
5 &&&&&&1&&5&&20&&60&&120&&120&&&&&\\
6 &&&&&1&&6&&30&&120&&360&&720&&720&&&&\\
7 &&&&1&&7&&42&&210&&840&&2520&&5040&&5040&&&\\
8 &&&1&&8&&56&&336&&1660&&6770&&20160&&40320&&40320&&\\
9 &&1&&9&&72&&504&&3024&&15120&&60480&&181440&&362880&&362880&\\
10 &1&&10&&90&&720&&5040&&30240&&151200&&604800&&1814400&&3628800&&3628800
\end{tabular}

The package I used is Array of course. I get no error but the output is following: enter image description here

Is there a way to align the numbers inside the page?

Edit: Used fullpage and thought it as a solution. Faithfully it didn't work.

  • 1
    Please write a minimal working example. See link for more details what it means. – user202729 Jul 02 '22 at 15:43
  • Do you mean by alignement that it doesn't appear to be bend? – MS-SPO Jul 02 '22 at 15:52
  • Hey @user202729 thanks :D, but the answers are more complicated to me, I have a one week deadline for the work and would take me one week to understand that first. Also, the answer stress each time to minimize your design. Unfortunately that's not possible in my scenario. I need the exact design and numbers in their way. –  Jul 02 '22 at 15:53
  • @MS-SPO I think so, but if you see the code, some of the numbers are misprinted and not showing. Yep, the alignment is not correct, how can I fit everything inside. –  Jul 02 '22 at 15:54
  • You might play with the value of \tabcolsep and also use locally a slightly smaller font size. – Bernard Jul 02 '22 at 16:26
  • @Bernard Thanks for the answer , however I needed to understand that function as well, I contacted my proffessor for a solution, he allowed me to cut the table into halve, using the first five rows, problem solved for me now –  Jul 02 '22 at 16:33
  • @AitzazImtiaz: Fine! I've just tested what could be done, and it seemed hard to make this array fit the page, even loading geometry to have more decent margins and using the lscape environment. – Bernard Jul 02 '22 at 16:40
  • Thanks , I don't understand this wierd stuff, never mind. Thanks for the commitment. –  Jul 02 '22 at 16:42

1 Answers1

1

Assuming you want the binomial coefficients, here is one way to do it. I changed:

  • the tables formatting (it certainly can be written more compact, but this is safe)
  • recalculated the numbers (unless I did some mistaker there)
  • put some horizontal lines for better overview

This table has the unique properties:

  • 1 at top, and 1 both outmost left and right
  • all others are the sum of the two numbers above, left and right
  • example: line 5 ... 10 = 4 + 6
  • it's symmetrical

Suggestion: Try making each line more self-evident, as there are simply too many "&" needed

Hint: TeX and LaTeX many times take away the burden of alignement. That's why I relied on the tabular mechanism as a start, i.e. the \hspace was not needed. See e.g. here for more details: https://en.wikibooks.org/wiki/LaTeX/Tables#The_tabular_environment .

table

\documentclass[10pt, border=3mm]{standalone}

\begin{document} \begin{tabular}{c c c c c c c c c c c c c c c c c c c c c c } %>% all this did not compile, so I replaced it %{$n=}l<{$ %\hspace{20pt}}*{21}{c} %} 0 &&& &&& &&& &&1& &&& &&& &&&\ 1 &&&&&&&&&&1&&1&&&&&&&&&\ 2 &&&&&&&&&1&&2&&1&&&&&&&&\ \hline 3 &&&&&&&&1&&3&&3&&1&&&&&&&\ 4 &&&&&&&1&&4&&6&&4&&1&&&&&&\ 5 &&&&&&1&&5&&10&&10&&5&&1&&&&&\ \hline 6 &&&&&1&&6&&15&&20&&15&&6&&1&&&&\ 7 &&&&1&&7&&21&&35&&35&&21&&7&&1&&&\ 8 &&&1&&8&&28&&56&&70&&56&&28&&8&&1&&\ \hline 9 &&1&&9&&36&&84&&126&&126&&84&&36&&9&&1&\ 10 & 1&& 10&& 45&& 120&& 210&& 252&& 210&& 120&& 45&& 10&& 1 \end{tabular} \end{document}

MS-SPO
  • 11,519