I have this simple code: I can build the table on landscape orientation, but when I insert the command adjustbox, there are some erros:
Not in outer par mode
undefined conttrol sequence
…
Error package graphics division by 0.
\begin{landscape}
\begin{adjustbox}{width=\textheight,totalheight=\textwidth,keepaspectratio}
\begin{table}
\centering\small
\caption{Summary of analytical expression for $\textrm{PFD}_\textrm{avg}$ Calculations} \label{Summary}
\begin{tabular}{lcccc}
\toprule
\textrm{Analytical Expression} & FPT & FPT with \emph{p}PPT & FPT with \emph{np}PPT & Comments \\
\cmidrule{1-5}
IEC-61508-6 & $ \binom{n}{n-k+1} \lambda_D^{n-k+1} \tau^{n-k} \cdot \frac{\lambda_{DU}}{\lambda_{D}}$ & $\binom{n}{n-k+1} \lambda_D^{n-k+1} \tau^{n-k} \cdot \frac{(TCF)\lambda_{DU}}{\lambda_D}\left(\frac{\tau}{n-k+2}+MRT\right)$ & & \\
&$\left(\frac{\tau}{n-k+2} +MRT\right)+\frac{\lambda_{DD}}{\lambda_{D}}(MTTR) $ & $ +\frac{(1-TCF)\lambda_{DU}}{\lambda_D}\left(\frac{\tau_{OH}}{n-k+2}+MRT\right)+\frac{\lambda_{DD}}{\lambda_D}MTTR $ & & \\
Simplified & $\binom{n}{n-k+1}\frac{(\lambda_{DU}\tau)^{n-k+1}}{n-k+2}$ & & & \\
Formulas & & & & \\
Non-Approximate& $1-\sum_{x=k}^n \left[S(k,n,x) \cdot \frac{1-e^{-x \cdot \lambda \cdot \tau}}{x \cdot \lambda \cdot \tau} \right]$& $1-$ & $1-$ & $S(k,n,x) = \sum_{y=k}^n \left[\binom{n}{x} \cdot \binom{x}{y} \cdot (-1)^{x-y}\right] $ \\
Equations & & $\sum_{x=k}^n \left[S(k,n,x).\frac{1-e^{-x\lambda t_{TD}}}{x\lambda t_{TD}}.\frac{1}{m}.\sum_{i=1}^m\left(e^{-x(1-E)\lambda(i-1)t_{TD}}\right)\right]$&$\sum_{x=k}^n \left[S(k,n,x) \cdot \sum_{i=1}^m \left( e^{x \cdot (1-TCF) \cdot \lambda \cdot t_{i-1}} \cdot \frac{1-e^{-x \cdot \lambda \cdot t_{TDi}}}{x \cdot \lambda \cdot \tau} \right) \right]$ &$ \hspace{5 mm}\textrm{for} \hspace{3 mm} x=k,...,n$ \\
$\Delta$-Testing & $ \frac{n!(\lambda_{DU} \tau)^{n-k+1}}{(n-k+2)!(k-1)!}$ & $\frac{1}{m} \sum_{i=1}^m \sum_{j=0}^{n-k} \binom{n}{j} ((i-1)\lambda_b t_{TD} )^j \frac{(n-j)!(\lambda t_{TD})^{n-j-k+1}}{(n-j-k+2)!(k-1)!} $ & & \\
& & $+ \frac{1}{m} \sum_{i=1}^m \sum_{j=n-k+1}^{n} \binom{n}{j} ((i-1)\lambda_b t_{TD})^j$& & \\
Policy & & & & \\
\bottomrule
\end{tabular}
\end{table}
\end{adjustbox}
\end{landscape}
Best Answer
I don't think you need the
adjustbox
package and its eponymous environment to typeset your table. I would, instead, use the\resizebox{}{}{...}
command of thegraphicx
package. If you set!
as the second argument of the\resizebox
command, the object's aspect ratio will be preserved automatically.Separately, I would recommend that you employ the
sidewaystable
environment of therotating
package instead of using separate, nestedlandscape
andtable
environments. And, since the width of the table is going to be reduced to that of the (rotated) text block, there's no need to provide either a\centering
or a\small
instruction. I would, though, use an instruction such as\renewcommand\arraystretch{2}
to increase the separation between the rows.Addendum: As you've noted in a comment, fitting your table into the available space doesn't look "nice", as the resulting font size is rather small. The main culprit is the formulas in the various cells are very wide. I've taken a stab at improving the look of the table by choosing different line breaks. I've also made a few more changes which, taken together, also contribute to a nicer-looking table. E.g., I've chosen an upright roman font for the variable names, and I allow line breaks in the first column. To keep the math expressions that are now broken across lines nice and compact, I've placed them in separate
array
environment. You can change all this, of course, to suit your needs.