# How to write an equation into a table without it overflowing?

I am trying to make a table which is embedded with equations, bullet points, and so on. This is what I have right now:

My question is, how do I get the key equation to fit inside nicely, and not overflow? Furthermore, in the disadvantages section, I see that there is a big gap between the words "Sensitive" and "optimization". Also, as you can see, "Integral Loquation Fine-Dining" (this doesnt mean anything), is off-center. How do I solve this? Also, how do I align equations inside \align? Using & in the tabular environment leads to troubles.

I would like for the equations to be nestled inside, and aligned to the left, and the rotated text to be centered appropriately in their boxes.

I would appreciate any advice you have for me. This is the code I have at the moment.

\documentclass[12pt]{article}

\setlength{\oddsidemargin}{0in}  %left margin position, reference is one inch
\setlength{\textwidth}{6.5in}    %width of text=8.5-1in-1in for margin
\setlength{\topmargin}{-0.5in}    %reference is at 1.5in, -.5in gives a start of about 1in from top
\setlength{\textheight}{9in}     %length of text=11in-1in-1in (top and bot. marg.)

\usepackage{amsmath,amssymb, mathtools}
\usepackage{dcolumn}% Align table columns on decimal point
\usepackage{bm}% bold math
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{enumitem}

\begin{document}

\renewcommand{\baselinestretch}{1.0}
\begin{small}
\begin{center}
%\caption{\label{T:Summary}Table 1. Summary of bottom-up parameterization techniques used for polymer coarse-graining.}
\resizebox{\columnwidth}{!}{
\footnotesize
\begin{tabular}{
| m{\dimexpr.06\linewidth-2\tabcolsep-1.3333\arrayrulewidth}
| m{\dimexpr.5\linewidth-2\tabcolsep-1.3333\arrayrulewidth}
| m{\dimexpr.2\linewidth-2\tabcolsep-1.3333\arrayrulewidth}
| m{\dimexpr.22\linewidth-2\tabcolsep-1.3333\arrayrulewidth}
| m{\dimexpr.22\linewidth-2\tabcolsep-1.3333\arrayrulewidth} |}
\cline{2-5}
\multicolumn{1}{c|}{} & \multicolumn{1}{c|}{\textbf{Key Equation(s)}} & \multicolumn{1}{c|}{\textbf{Key Inputs}} &
\cline{2-5}  \hline
\rotatebox[origin=c]{90}{\parbox[c]{1.25in}{ \centering \textbf{Relative \\  Tomfoolery}}} &
\parbox[c]{0.28\linewidth}{
\begin{align*}
T_{\rm rel} = \beta \left\langle A_\text{GG} - B_\text{FF}\right\rangle_\text{FF} -\beta(A_\text{GG} - A_\text{GG}) + \langle T_{\rm map} \rangle  _{AA}
\end{align*}

}&
\begin{itemize}[leftmargin=*]
\item \ldots
\item \ldots
\end{itemize}&
\begin{itemize}[leftmargin=*]
\item \ldots
\item \ldots
\end{itemize}
&
\begin{itemize}[leftmargin=*]
\item Sensitive optimization
\end{itemize} \\
\hline
\rotatebox[origin=c]{90}{\parbox[c]{1.5in}{ \centering \textbf{Integral Loquation Fine-Dining}}}
&
\begin{align*}
\hat{a}_{ee}(k)=  \frac{n_b^2 \hat{q}_{mm}(0) \left[\hat{\mu}_{bm}(k) \right]^2}{1 + v_{m}\rho_{m} \hat{\lambda}_{mm}(0) \hat{\zeta}_{mm}(k)} \\
\hat{\nu}_{bb}(k)=
\frac{\hat{j}_{bb}(k)}{n_{b} \hat{\zeta}_{bh}(k) \left[ n_{b} \hat{\omega}_{bb}(k) + \rho_{b} \hat{y}_{bb}(k) \right] }
\end{align*}\newline&
\begin{itemize}[leftmargin=*]
\item \ldots
\item \ldots
\item \ldots
\end{itemize} &
\begin{itemize}[leftmargin=*]
\item \ldots
\item \ldots
\end{itemize}
&
\begin{itemize}[leftmargin=*]
\item \ldots
\item \ldots
\end{itemize} \\
\hline
\end{tabular} }
\end{center}
\end{small}
\renewcommand{\baselinestretch}{1.5}

\normalsize

\end{document}

• as you have not provided a usable example it is hard to say anything, naturally you could make that column wider and the others thinner but we don't know what goes in those columns. Alternatiovely use a smaller font in those cells eg \small or use more rows for the alignment Aug 30, 2021 at 20:58
• sorry, I will provide it shortly! Aug 30, 2021 at 21:10
• As for the widely spread words and ridiculously large spaces in text that is more than one line long, use \raggedright. Aug 30, 2021 at 21:18
• Even in a \parbox or minipage, there is no way to prevent equations from running off the right side of the text area. Well, you could put it into a tikzpicture or adjustbox and clip it. Aug 30, 2021 at 21:25
• Since you use align*, why don't you introduce a second line. You also may use the multline* environment. Aug 30, 2021 at 21:28

\documentclass[12pt]{article}

\setlength{\oddsidemargin}{0in}  %left margin position, reference is one inch
\setlength{\textwidth}{6.5in}    %width of text=8.5-1in-1in for margin
\setlength{\topmargin}{-0.5in}    %reference is at 1.5in, -.5in gives a start of about 1in from top
\setlength{\textheight}{9in}     %length of text=11in-1in-1in (top and bot. marg.)

\usepackage{amsmath,amssymb, mathtools}
\usepackage{dcolumn}% Align table columns on decimal point
\usepackage{bm}% bold math
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{enumitem}

\begin{document}

\renewcommand{\baselinestretch}{1.0}
% better to use \small (or here \footnotesize as you have already
\begin{center}
%\caption{\label{T:Summary}Table 1. Summary of bottom-up parameterization techniques used for polymer coarse-graining.}
% never scale tables it inroduces inconsistent sizes and invalidates teh previous small and following \footnotesize
%%\resizebox{\columnwidth}{!}{
\footnotesize
\setlength\extrarowheight{2pt}
% 6 vertical rules distributed over 5 columns 1.2 not 1.333
% and this adds up to way more than \linewidth
\begin{tabular}{@{}
| m{\dimexpr.08\linewidth-2\tabcolsep-1.2\arrayrulewidth}
| m{\dimexpr.42\linewidth-2\tabcolsep-1.2\arrayrulewidth}
| m{\dimexpr.17\linewidth-2\tabcolsep-1.2\arrayrulewidth}
| m{\dimexpr.17\linewidth-2\tabcolsep-1.2\arrayrulewidth}
| m{\dimexpr.17\linewidth-2\tabcolsep-1.2\arrayrulewidth} |@{}}
\cline{2-5}
\multicolumn{1}{c|}{} & \multicolumn{1}{c|}{\textbf{Key Equation(s)}} & \multicolumn{1}{c|}{\textbf{Key Inputs}} &
\cline{2-5}  \hline
\rotatebox[origin=c]{90}{\hspace{5pt}\textbf{\begin{tabular}[b]{c}Relative \\  Tomfoolery\end{tabular}}} &
% this parbox is doing nothing useful an m column is already a parbox    \parbox[c]{0.28\linewidth}{
\begin{multline*}
T_{\mathrm{rel}} % \rm has not been defined by default in latex since 1993 {\rm rel}
% use \mathrm not \text in the following as well
= \beta \left\langle A_\mathrm{GG} - B_\mathrm{FF}\right\rangle_\mathrm{FF}\\{} -\beta(A_\mathrm{GG} - A_\mathrm{GG}) + \langle T_{\rm map} \rangle  _{AA}
\end{multline*}

&
\begin{itemize}[leftmargin=*]
\item \ldots
\item \ldots
\end{itemize}&
\begin{itemize}[leftmargin=*]
\item \ldots
\item \ldots
\end{itemize}
&
\begin{itemize}[leftmargin=*]
\item Sensitive optimization
\end{itemize} \\
\hline
\rotatebox[origin=c]{90}{\hspace{5pt}\textbf{\begin{tabular}[b]{c}Integral Loquation\\ Fine-Dining\end{tabular}}}
&
% extra braces to guard th einner alignment (I don't think they should be needed, hmm)
{\begin{align*}
\hat{a}_{ee}(k) &=  \frac{n_b^2 \hat{q}_{mm}(0) \left[\hat{\mu}_{bm}(k) \right]^2}{1 + v_{m}\rho_{m} \hat{\lambda}_{mm}(0) \hat{\zeta}_{mm}(k)} \\
\hat{\nu}_{bb}(k)&=
\frac{\hat{j}_{bb}(k)}{n_{b} \hat{\zeta}_{bh}(k) \left[ n_{b} \hat{\omega}_{bb}(k) + \rho_{b} \hat{y}_{bb}(k) \right] }
\end{align*}}
% never have \newline or \\ after a math display \newline
&
\begin{itemize}[leftmargin=*]
\item \ldots
\item \ldots
\item \ldots
\end{itemize} &
\begin{itemize}[leftmargin=*]
\item \ldots
\item \ldots
\end{itemize}
&
\begin{itemize}[leftmargin=*]
\item \ldots
\item \ldots
\end{itemize} \\
\hline
\end{tabular}
\end{center}

\renewcommand{\baselinestretch}{1.5}

% not needed, already normalsize \normalsize

\end{document}

• A "disadvantage" of your answer is that the item markers are too far to the right in the last column. It would look a lot nicer if they're the same distance from the left edge of the cell in all columns. (You probably did it this way just so I could complain; you got your wish.) Aug 31, 2021 at 0:01
• @barbara I did ask the opto provide more realistic list data. you could use enumitem to see more compact list Aug 31, 2021 at 0:05
• Both of the rotated "headers" are shoved too far to the bottom. I thought that \extrarowheight might be the cause, but it can be only part of it in any event. That really needs to be fixed. (I'm just being particularly fussy this evening, as opposed to helpful.) Aug 31, 2021 at 0:16
• I apologize for not providing more realistic data. I will provide right now. This is from a paper I am writing, and I did not wish to divulge any critical information... Aug 31, 2021 at 3:14
• However @DavidCarlisle, the "Sensitive optimization" term is being cut halfway, and is not being resolved by \raggedright. One of the things I have to add in the advantages columns is $(\mathbf{r}^N, \mathbf{p}^N)$, which does not fit in the given dimensions Aug 31, 2021 at 3:18