# Modify Table to match image

I wanted to get the table generated from the code below to be like:

with the spacing between the lines and also have the colored boxes. This table is extracted from the book Pll Performance, Simulation and Design By Dean Banerjee.

Here is my code:

\documentclass{article}

\usepackage[english]{babel}
\usepackage{amsmath,amsfonts,amssymb,amsthm, bm}

\begin{document}

\begin{center}
\begin{tabular}{ | c | c | c |  c | c |}
\hline
$\rightarrow$ Converting To & Integrated & Signal to Noise & RMS Phase & RMS Jitter\\
$\downarrow$ Converting From & Phase Noise & Ratio & Summary & $(\sigma_{t}$) \\
& (A) & (SNR) & $(\sigma_{\phi(deg)})$ & \\ \hline
A &  & 1/A & $\dfrac{180}{\pi}\sqrt{A}$ & $\dfrac{1}{2\pi f}\sqrt{A}$\\ \hline
SNR & 1/SNR &  & $\dfrac{180}{\pi\sqrt{SNR}}$ & $\dfrac{1}{2\pi f \sqrt{SNR}}$\\ \hline
$(\sigma_{\phi(deg)})$ & $\left( \dfrac{\pi\cdot\sigma_{\phi(deg)}}{180} \right)^{2}$ & $\left( \dfrac{180}{\pi\cdot\sigma_{\phi(deg)}} \right)^{2}$ &  & $\dfrac{1}{f}\dfrac{\sigma_{\phi(deg)}}{360}$  \\ \hline
$\sigma_{t}$ & $\left(2\pi f \cdot \sigma_{t}\right)^{2}$ & $\left( \dfrac{1}{2\pi f \cdot \sigma_{t}}\right)$ & $360\cdot f \cdot \sigma_{t}$ &   \\ \hline
\end{tabular}
\end{center}

\end{document}


## 2 Answers

Something like this:

For above piscture I only add to your MWE \usepackage[table]{xcolor} and in diagonal cells put \cellcolor{gray!10}:

\documentclass{article}
\usepackage[english]{babel}
\usepackage[table]{xcolor}% <-- added
\usepackage{amsmath,amssymb,amsthm, bm}

\begin{document}

\begin{center}
\begin{tabular}{ | c | c | c |  c | c |}
\hline
$\rightarrow$ Converting To  & Integrated  & Signal to Noise & RMS Phase & RMS Jitter\\
$\downarrow$ Converting From & Phase Noise & Ratio           & Summary   & $(\sigma_{t}$) \\
& (A) & (SNR) & $(\sigma_{\phi(deg)})$ & \\ \hline
A   &   \cellcolor{gray!10}% <-- added
&   1/A
&   $\dfrac{180}{\pi}\sqrt{A}$
&   $\dfrac{1}{2\pi f}\sqrt{A}$
\\ \hline
SNR &   1/SNR
&   \cellcolor{gray!10}% <-- added
&   $\dfrac{180}{\pi\sqrt{SNR}}$
&   $\dfrac{1}{2\pi f \sqrt{SNR}}$
\\ \hline
$(\sigma_{\phi(deg)})$
&   $\left( \dfrac{\pi\cdot\sigma_{\phi(deg)}}{180} \right)^{2}$
&   $\left( \dfrac{180}{\pi\cdot\sigma_{\phi(deg)}} \right)^{2}$
&   \cellcolor{gray!10}% <-- added
&   $\dfrac{1}{f}\dfrac{\sigma_{\phi(deg)}}{360}$
\\ \hline
$\sigma_{t}$
&   $\left(2\pi f \cdot \sigma_{t}\right)^{2}$
&   $\left( \dfrac{1}{2\pi f \cdot \sigma_{t}}\right)$
&   $360\cdot f \cdot \sigma_{t}$
&   \cellcolor{gray!10}% <-- added
\\ \hline
\end{tabular}
\end{center}
\end{document}


Addendum: For better looking of your table a additional effort is needed. An example provide Bernard answer, here is another possibilities, which not require additional package:

\documentclass{article}
\usepackage[english]{babel}
\usepackage[table]{xcolor}% <-- added
\usepackage{amsmath,amssymb,amsthm, bm}

\usepackage{makecell}
\renewcommand\theadfont{\bfseries\normalsize}
\begin{document}

\begin{center}
\begin{tabular}{|*{5}{@{\rule[-4ex]{0pt}{9ex}\hspace{6pt}}c|}}%
\hline
\thead{$\to$  Converting To\\
$\downarrow$ Converting From}
&   \thead{Integrated\\Phase Noise\\ $(A)$}
&   \thead{Signal to\\ Noise Ratio\\ $(SNR)$}
&   \thead{RMS Phase\\ Summary\\ $(\sigma_{t})$}
&   \thead{RMS Jitter\\ $(\sigma_{\phi(deg)})$}
\\  \hline
$A$     &   \cellcolor{gray!10}{}% <-- added
&   $1/A$
&   $\dfrac{180}{\pi}\sqrt{A}$
&   $\dfrac{1}{2\pi f}\sqrt{A}$
\\ \hline
$SNR$   &   $1/SNR$
&   \cellcolor{gray!10}% <-- added
&   $\dfrac{180}{\pi\sqrt{SNR}}$
&   $\dfrac{1}{2\pi f \sqrt{SNR}}$
\\ \hline
$(\sigma_{\phi(deg)})$
&   $\left( \dfrac{\pi\cdot\sigma_{\phi(deg)}}{180} \right)^{2}$
&   $\left( \dfrac{180}{\pi\cdot\sigma_{\phi(deg)}} \right)^{2}$
&   \cellcolor{gray!10}% <-- added
&   $\dfrac{1}{f}\dfrac{\sigma_{\phi(deg)}}{360}$
\\ \hline
$\sigma_{t}$
&   $\left(2\pi f \cdot \sigma_{t}\right)^{2}$
&   $\left( \dfrac{1}{2\pi f \cdot \sigma_{t}}\right)$
&   $360\cdot f \cdot \sigma_{t}$
&   \cellcolor{gray!10}% <-- added
\\ \hline
\end{tabular}
\end{center}
\end{document}


The @{\rule[-4ex]{0pt}{9ex}\hspace{6pt} made all cells equal and enough height:

A solution with the makecellpackage (allow for linebreaks and a common formatting and alignment in cells), cellspace (ensures a minimal vertical padding between a cell in a columb and the above and below cells) and colortbl. I also turned deg into the math operator \deg:

\documentclass{article}

\usepackage[english]{babel}
\usepackage{amsmath,amsfonts,amssymb,amsthm, bm}
\usepackage{array, makecell, colortbl,cellspace }
\usepackage[x11names, table]{xcolor}
\renewcommand{\theadfont}{\normalsize\bfseries\boldmath}
\setlength\cellspacetoplimit{4pt}
\setlength\cellspacebottomlimit{4pt}

\begin{document}

\begin{center}
\begin{tabular}{ | *{5} {Sc |}}
\hline
\thead{\itshape$\rightarrow$ Converting To\\[1.5ex]\itshape$\downarrow$ Converting From} & \thead{Integrated\\Phase Noise\\(A)} & \thead{Signal to Noise\\Ratio\\(SNR)} & \thead{RMS Phase\\Summary\\$(\sigma_{\phi(\deg)})$} & \thead{RMS Jitter\\ $(\sigma_{t}$)}\\
\hline
A & \cellcolor{Snow2}& 1/A & $\dfrac{180}{\pi}\sqrt{A}$ & $\dfrac{1}{2\pi f}\sqrt{A}$\\ \hline
SNR & 1/SNR & \cellcolor{Snow2} & $\dfrac{180}{\pi\sqrt{SNR}}$ & $\dfrac{1}{2\pi f \sqrt{SNR}}$\\
\hline
$(\sigma_{\phi(\deg)})$ & $\left( \dfrac{\pi\cdot\sigma_{\phi(\deg)}}{180} \right)^{2}$ & $\left( \dfrac{180}{\pi\cdot\sigma_{\phi(\deg)}} \right)^{2}$ & \cellcolor{Snow2} & $\dfrac{1}{f}\dfrac{\sigma_{\phi(\deg)}}{360}$ \\
\hline
$\sigma_{t}$ & $\left(2\pi f \cdot \sigma_{t}\right)^{2}$ & $\left( \dfrac{1}{2\pi f \cdot \sigma_{t}}\right)$ & $360\cdot f \cdot \sigma_{t}$ & \cellcolor{Snow2} \\
\hline
\end{tabular}
\end{center}

\end{document}