Is is possible to resize a table imported from another table without having to modify the LaTeX code in the file from which the table is imported? I was thinking of something like:
\documentclass[english]{article}
\usepackage{babel}
\usepackage{graphicx}
\usepackage[margin = 1.5 cm, tmargin=1.5 cm]{geometry}
\begin{document}
\scalebox{0.5}{%
\input{DS}
}%
\end{document}
The table in the file DS.tex looks like the following:
\begin{table}[!htpb]
\centering
\begin{tabular}{ccc}
% ...
\end{tabular}
\end{table}
I got as expected the error : ! LaTeX Error: Not in outer par mode.
I would like to know whether it is possible to resize the table in DS file without modifying it.
Best Answer
A floating environment (
table
,figure
, ...) cannot put into an\hbox
or\scalebox
that internally uses\hbox
. However the environment can be redefined locally:\ignorespaces
and\unskip
remove spaces by line ends in the fileDS.tex
that does matter in horizontal mode. An alternative is using\endlinechar=-1\relax
, but this depends on the contents of thetabular
environment, because some line ends might not be unwanted (e.g. space between words).The floating environment can be inserted afterwards, e.g.: