1

I have this very simple table code. I initially didnt use tabularx, but then the table would run off the right side of the page. So instead i used tabularx. Now, the text within a box seems to overlap with other text, check the photo below.

\begin{center}
\begin{tabularx}{\textwidth}{|X|X|X|X|X|X|X|X|X|X|X|X|}
\hline
n1  & n8 & n3  & n10 & n5 & n12 & n7 & n2  & n9 & n4    & n11 & n6 \\
\hline
1/1 & 2187/2048   & 9/8 &  19683/16384   & 81/64   & 4/3 &  729/512  & 
3/2 &  6561/4096  & 27/16 &  59049/32768   & 243/128  \\
\hline
\end{tabularx}
\end{center}

enter image description here

How could i fix this?

The full page is found below

\documentclass[12pt]{article}
 \usepackage[margin=1in]{geometry} 
\usepackage{amsmath,amsthm,amssymb,amsfonts}
\usepackage[shortlabels]{enumitem}
\usepackage{graphicx}
\usepackage{tabularx}

\newcommand{\NN}{\mathbb{N}}
\newcommand{\ZZ}{\mathbb{Z}}

\newenvironment{problem}[2][Problem]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}\hskip \labelsep {\bfseries #2.}]}{\end{trivlist}}
%If you want to title your bold things something different just make another thing exactly like this but replace "problem" with the name of the thing you want, like theorem or lemma or whatever 

\begin{document}

%\renewcommand{\qedsymbol}{\filledbox}
%Good resources for looking up how to do stuff:
%Binary operators: http://www.access2science.com/latex/Binary.html
%General help: http://en.wikibooks.org/wiki/LaTeX/Mathematics
%Or just google stuff

\title{Homework \#1}
\author{Mataan Peer}
\maketitle

\begin{problem}{2.4}
Give a visual, geometric proof of the fact mentioned in the text
(using ideas similar to those in Figures 2.2 and 2.3) that $8*t_n + 1$ is a
square by showing in a diagram how eight triangular arrays of stones
together with one extra stone can be arranged into a square array of
stones.
\end{problem}
\begin{proof}
\includegraphics[width=4in]{Triangular_Numbers.jpeg}
\end{proof}

\begin{problem}{2.12}
In addition to square and triangular numbers Nicomachus also
discussed other numbers with geometric qualities. The $pentagonal$
numbers are the numbers
$$1, 5, 12, 22, 35, ...$$
and the hexagonal numbers are the numbers
$$1, 6, 15, 28, 45, ...$$
that represent ever larger patterns of pentagons and hexagons,
respectively, analogous to the pattern of triangles shown in
Figure 2.1.
\begin{enumerate}[a]
    \item Draw the patterns of pentagons and hexagons that produce the
first five pentagonal numbers, and the first five hexagonal
numbers.
\item Note that we can write a pentagonal number such as 35 using a
sum of the differences between successive pentagonal numbers:
$$35 = 1 + 4 + 7 + 10 + 13.$$
We can do the same thing for hexagonal numbers:
$$45 = 1 + 5 + 9 + 13 + 17.$$
By the way, it should be easy for you to see what these differences
represent in the patterns you drew in part (a).

Write a formula for the $n$th pentagonal number $p_n$ using a
sum of the differences between the first $n$ pentagonal numbers.
Your formula should look a lot like the formula we know for the
$n$th square number: $1 + 3 + 5 +\dots+ (2n-1$).
\item Write a formula for the $n$th hexagonal number $h_n$ using a sum of
the differences between the first $n$ hexagonal numbers.
\item Find closed formulas for $p_n$ and $h_n$; that is, find formulas similar
to the formula $t_n = \frac{n(n+1)}{2}$. Then use induction to verify these
formulas. For the induction step you will need your formulas
from parts (b) and (c).
\end{enumerate}

Nicomachus extended this idea and also considered septagonal and
octagonal numbers for which there are similar patterns and formulas.
\end{problem}
\begin{proof}[Answer for a]
\includegraphics[angle=-90,width=4in]{Hexagonal and Pentagonal.jpg}
\phantom\qedhere
\end{proof}
\begin{proof}[Answer for b]
\phantom\qedhere
$$p_n = 1+4+7+\dots+(3n-2)$$
\end{proof}
\begin{proof}[Answer for c]
\phantom\qedhere
$$h_n = 1+5+9+\dots+(4n-3)$$
\end{proof}
\begin{proof}[Answer for first part of d]
$$p_n = \frac{3n^2-n}{2}$$
$$h_n = 2n^2 -n $$

\end{proof}
\begin{proof}[Proof By Induction Pentagon]
For the base case we show that the left hand side and the right hand side for $n = 1$ are equivalent. The left hand side is $p_1$ which is 1. The right hand side would be $\frac{3*1^2 -1}{2} $ which is equivalent to 1. 

Next we make the inductive hypothesis that the formula $$p_n = \frac{3n^2-n}{2}$$ is true for n. Now we must show that it is also true for $n+1$
\begin{align*}
    p_{n+1} &= 1+4+7+\dots+(3(n+1)-2)\\
    &=p_n+3(n+1)-2\\
    &= \frac{3n^2 -n}{2} + 3n+1\\
    &= \frac{3n^2 -n +6n +2}{2}\\
    &= \frac{3n^2+5n+2}{2}\\
    &= \frac{(3n^2+5n+2 +(n+1))+n+1}{2}\\
    &= \frac{3n^2 +6n+3 -(n+1)}{2}\\
    &= \frac{3(n+1)^2 -(n+1)}{2}
\end{align*}
Thus we show that the formula is true for $n+1$.

By induction we conclude that the formula is true for all $n$
\end{proof}

\begin{proof}[Proof By Induction Hexagon]
For the base case we show that left hand side and the right hand side for $n=1$ are equivalent. The left hand side is $h_1$ which is 1. The right hand side is $2*1^2 - 1 = 1$. The two sides are equal and thus the equation is true for $n = 1$. 

Next we make the inductive hypothesis that the formula $$h_n =  2n^2 -n$$ is true for n. Now we must show that it is also true for $n+1$.
\begin{align*}
    h_{n+1} &= 1 + 5 + 9+\dots+4(n+1)-3\\
    &= h_n + 4n+1\\
    &= 2n^2 -n +4n+1\\
    &= 2n^2 +3n +1\\
    &= (2n^2+3n+1 + n+1) -(n+1)\\
    &= 2n^2 +4n +2 - (n+1)\\
    &=2(n+1)^2 - (n+1)
\end{align*}
So the formula is true for $n+1$.

By induction we conclude that is also true for all n.
\end{proof}
\begin{problem}{2.16}
Give an alternative proof for Theorem 2.1 by assuming there is a largest
prime $p$ and considering the number $N = p! + 1$. 
\end{problem}
\begin{proof}
Assume there is a largest prime $p$. Now consider the number $N$ where$$N= p!+1.$$
By definition 
\begin{align*}
    p! &= 1*2*3*\dots*(p-1)*(p) \\ &and\\
    N &= 1*2*3*\dots*(p-1)*(p)+1
\end{align*}
By the definition of divisibility $p!$ is divisible by every number between 1 and $p$ inclusive. Also, since $p$ is the largest prime, all primes are included in the list of 1 to $p$. This also means that $N$ is not divisible by any of those numbers except for 1. However $N$ must be able to factor into primes. So there emerges a contradiction that $N$ has to be able to factor into primes that are not contained in the list 1 to $p$ so there must be a larger prime. 

We conclude that there is no largest prime and thus infinite primes. 
\end{proof}

\begin{problem}{2.21}
We saw in the text that if we wanted to have a thirteenth note that was
an F a perfect octave above the original F, then we had a slight problem
with our Pythagorean tuning. One way to deal with this problem is to
tune partway up the scale from the original F, and then tune down the
rest of the scale from this high F. (This doesn’t avoid the problem, of
course; it just moves it somewhere else.)
So, for example, the pitch ratio of that high F should be $\frac{2}{1}$. Therefore,
if we tune down from this note to n12, we need to divide by $\frac{3}{2}$, so the
pitch ratio for $n_{12}$ becomes $\frac{4}{3}$ . Next, we could tune $n_{11}$, and so on. Of course, when tuning down, whenever a note falls below n1, you need to bring it back up an octave.

Use this minor variation in Pythagorean tuning to finish filling in
the pitch ratios for the twelve notes of the scale by working up the scale
for $n_1$,..., $n_9$, and then down the scale for $n_{12}$, $n_{11}$, $n_{10}$:
\begin{center}
\begin{tabularx}{\textwidth}{|X|X|X|X|X|X|X|X|X|X|X|X|}
\hline
  n1  & n8 & n3  & n10 & n5 & n12 & n7 & n2  & n9 & n4    & n11 & n6 \\
\hline
1/1 & 2187/2048   & 9/8 &  19683/16384   & 81/64   & 4/3 &  729/512  & 3/2 &  6561/4096  & 27/16 &  59049/32768   & 243/128  \\
\hline
\end{tabularx}
\end{center}

\end{problem}

\end{document}
  • Welcome to TeX SX! Could you post a complete code, so we know what paper size you use, whether you load geometry, &c.? – Bernard Nov 30 '18 at 0:09
  • @Bernard Done just updated – Mataan P Nov 30 '18 at 0:57
  • Ahem! When Bernard ask for a "complete" code he meant really complilable, i.e, a minimal working example (MWE) enough to reproduce the issue, No need to post a whole thesis with in every question :) – Fran Nov 30 '18 at 11:10
2

Please try the following

\documentclass[UTF8, english]{article}

\usepackage{tabularx}

\begin{document}

\renewcommand{\arraystretch}{2}
\centering
\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|}
\hline
n1  & n8 & n3  & n10 & n5 & n12 & n7 & n2  & n9 & n4    & n11 & n6 \\
\hline
$\frac{1}{1}$ & $\frac{2187}{2048}$ & $\frac{9}{8}$ & $\frac{19683}{16384}$ & $\frac{81}{64}$ & $\frac{4}{3}$ & $\frac{729}{512}$ & $\frac{3}{2}$ & $\frac{6561}{4096}$ & $\frac{27}{16}$ & $\frac{59049}{32768}$ & $\frac{243}{128}$ \\
\hline
\end{tabular}

\end{document}

The output looks like

table

  • @MataanP You are absolutely welcome! – zyy Nov 30 '18 at 2:17
0

"Fix this" is a too open question: As is , one valid solution could be use a tiny font, or rotate the table, or put in a landscape page, or slipt the table, or show instead of fractions their results with two decimals, use vertical or more nice fractions, ... but for heaven's sake, do not show us unfortunate jailed fractions. Free them! :)

mwe

\documentclass[12pt]{article}
\usepackage[margin=1in]{geometry} 
\usepackage{tabulary,booktabs,nicefrac}
\begin{document}
\begin{tabulary}{\textwidth}{@{}CCCCCCCCCCCC@{}}
\toprule
  n1  & n8 & n3  & n10 & n5 & n12 & n7 & n2  & n9 & n4    & n11 & n6 \\
\cmidrule(r){1-1}\cmidrule(rl){2-2}\cmidrule(rl){3-3}\cmidrule(rl){4-4}\cmidrule(rl){5-5}\cmidrule(rl){6-6}\cmidrule(rl){7-7}\cmidrule(rl){8-8}\cmidrule(rl){9-9}\cmidrule(rl){10-10}\cmidrule(rl){11-11}\cmidrule(l){12-12}
\nicefrac{1}{1} & $\nicefrac{2187}{2048}$  & $\nicefrac{9}{8}$ & $\nicefrac{19683}{16384}$ & $\nicefrac{81}{64}$ & $\nicefrac{4}{3}$ & $\nicefrac{729}{512}$ & $\nicefrac{3}{2}$ & $\nicefrac{6561}{4096}$ & $\nicefrac{27}{16}$ & $\nicefrac{59049}{32768}$ & $\nicefrac{243}{128}$ \\
\bottomrule
\end{tabulary}
\end{document}

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.