I have the following code :
\NewDocumentCommand\splitpage{O{0.5} m m O{0.05}}
{ \FPeval\otherlen{1-#1} \FPeval\adjustedlen{\otherlen+#4}
\adjustbox{valign=t}
{\begin{minipage}{#1\textwidth} #2 \end{minipage}\hfill }
\adjustbox{valign=t,right=\adjustedlen\textwidth}
{\begin{minipage}{\otherlen\textwidth}#3\end{minipage}} \bigskip}
Which basically splits a page in half, and uses optional parameters (xparse) and adjustbox to get what is in the two minipages to vertically align.
It works very well when I use text, equations, plots (TikZ), etc., and it also works fine with tabular, but it just spits out reams of overflow warnings, even when it looks fine visually :
\begin{example}{
\splitpage[0.35]{
Given the information on the right. Is there a correlation between
preferences for vegetables between the husband and wife? That is to say do
they like or dislike similar vegetables?
}
{
\begin{tabular}{@{}c|cccc@{}}
& Husband & Wife & D & $D^2$ \\
Brocolli & 4 & 3 & 1 & 1 \\
Cauliflower & 3 & 1 & 2 & 4 \\
Brussel Sprouts & 6 & 7 & -1 & 1 \\
Okra & 1 & 2 & -1 & 1 \\
Cabbage & 5 & 5 & 0 & 0 \\
Spinach & 2 & 4 & -2 & 4 \\
Turnips & 7 & 6 & 1 & 1 \\
\end{tabular}
}[0.1]
}
\vspace{-0.5cm}
\begin{mstep}{Calculate $r_s$}
r_s &=&1-\dfrac{6\sum D^2}{N(N^2-1)} \\
&=&1-\dfrac{6 * 12}{7(48-1)} \\
&=&0.79
\end{mstep}
\begin{istep}{Compare to critical values}
As 0.79 is equal to the critical value (0.786, Appendix C)
the null hypothesis $H_0$ that $\rho=0$ is rejected and there is
a strong positive correlation between the husband and wife's preferences.
\end{istep}
\end{example}
With some definitions :
\newcounter{stepnumber}
\NewDocumentEnvironment{example}{m}
{ \begin{tcolorbox} \setcounter{stepnumber}{1} \textbf{Example} : #1\\smallskip }
{\end{tcolorbox}}
\NewDocumentEnvironment{mstep}{m}
{\noindent Step # \thestepnumber : #1\begin{eqnarray}}
{\end{eqnarray}\stepcounter{stepnumber}\vspace{-0.5cm}}
\NewDocumentEnvironment{istep}{m}
{\noindent Step # \thestepnumber : #1\begin{adjustwidth}{1cm}{1cm}}
{\end{adjustwidth} \stepcounter{stepnumber}}
I have tried a number of the solutions here :
Overfull \hbox warning when using tabular
-use the @{} in the tabular setup -setting the width in adjustbox, etc. -using resizebox around the tabular (and even miniage) to shrink them to barely visible and it still generates the same warnings
But it looks like tabular has a bunch of floating space around it I can't see which is going outside the margins or width inside the mini-page.
If there are better solutions to to the hacky editing above, aside from somehow getting rid of the overfull issues, suggestions are appreciated.
Here is a stripped down example where I deconstructed the \splitpage :
\documentclass{report}
\usepackage[left=2cm,right=1cm,top=1cm,bottom=2cm]{geometry}
\usepackage{adjustbox,xparse}
\setlength{\parindent}{0mm}
\begin{document}
\begin{minipage}{0.5\textwidth}
Given the following data listing 183 children with ODD and ADHD, is
there a correlation?
\end{minipage}\hfill
\begin{minipage}{0.5\textwidth}
{\begin{tabular}{@{}ccc@{}}
& \multicolumn{2}{c}{ODD}\
& No & Yes \
\hline
ADHD & $110^a$ & $19^b$\
& $22^c$ & $32^d$\
\end{tabular}}
\end{minipage}
\vspace{3.0cm}
\adjustbox{valign=t}{
\begin{minipage}{0.5\textwidth}
Given the following data listing 183 children with ODD and ADHD, is
there a correlation?
\end{minipage}\hfill
}
\adjustbox{valign=t,width=0.5\textwidth, right=0.8\textwidth}{
\begin{minipage}{0.5\textwidth}
\begin{tabular}{@{}ccc@{}}
& \multicolumn{2}{c}{ODD}\
& No & Yes \
\hline
ADHD & $110^a$ & $19^b$\
& $22^c$ & $32^d$\
\end{tabular}
\end{minipage}
}
\end{document}
The first one is fine, the second is what is generating the warnings, the \adjustbox which is used to right align the tabular. This works fine with images, equations, etc. but not with tabular.


\setlength\overfullrule{2pt}so overfull boxes will be visibly flagged in the output. Use\showboxdepth=3 \showboxbreadth=30to identify which boxes are overfull from the log file. – Donald Arseneau Aug 18 '20 at 00:08