How to decrease the font size of a table in an \input file

This works for me:

{\renewcommand\normalsize{\tiny}%
\normalsize
\input{tables}}

You can use the etoolbox package to tap into the start of the tabular environment and modify the font size. In the MWE below, the tabular font size is set to \Huge:

enter image description here

\documentclass{article}
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\BeforeBeginEnvironment{tabular}{\Huge}% Adjust tabular font size to \Huge

\begin{filecontents*}{table.tex}
\begin{table}[htbp]
  \centering
  \caption{table caption}
  \begin{tabular}{rr}
    $u$ & 0.00  
  \end{tabular}
\end{table}
\end{filecontents*}

\begin{document}
Here is some dummy text.

\input{table}%

Here is some more dummy text.
\end{document}

As the name states, \BeforeBeginEnvironment{<env>}{<stuff>} command inserts <stuff> before the beginning of the environment <env> - tabular in this case.


If you're interested in modifying only the tables that are included using \input, then it would be best to define your own \input command, say \myinput, and combine it with @Boris' answer. Here's an example of how to do just that:

enter image description here

\documentclass{article}

\usepackage{filecontents}% http://ctan.org/pkg/filecontents
\begin{filecontents*}{table.tex}
\begin{table}
  \centering
  \caption{A table included via \texttt{input}}
  \begin{tabular}{rr}
    $u$ & 0.00  
  \end{tabular}
\end{table}
\end{filecontents*}

\newcommand{\myinput}[1]{%
  \begingroup%
  \renewcommand\normalsize{\tiny}% Specify your font modification
  \input{#1}%
  \endgroup%
}
\begin{document}
Here is some dummy text.

\myinput{table}%

Here is some more dummy text.

\begin{table}
  \centering
  \caption{A table in the main document}
  \begin{tabular}{rr}
    $u$ & 0.00  
  \end{tabular}
\end{table}

\end{document}

Grouping within the \myinput{<file>} command (using \begingroup...\endgroup) ensures that the \normalsize redefinition remains local.


In the following example I define a new command \CFTable with one optional argument, which redefines the table and table* environments as defined by the standard document classes; the optional argument will select the font size switch to be applied to the tables (it will not have any effect on the captions); the valid values for the optional argument are tiny, scriptsize, footnotesize, small (default), normalsize, large, Large, LARGE, huge, and Huge:

\RequirePackage{filecontents}
\begin{filecontents*}{testtables.tex}
\begin{table}
  \centering
  \caption{Some test table}
  \begin{tabular}{cc}
  text & text \\
  123 & 234\\
  123 & 234\\
  123 & 234\\
  123 & 234\\
  123 & 234\\
  \end{tabular}
\end{table}
\end{filecontents*}

\documentclass{article}

\makeatletter
\newcommand\CTFont[1][small]{
\renewenvironment{table}
               {\@float{table}\csname#1\endcsname}
               {\end@float}
\renewenvironment{table*}
               {\@dblfloat{table}\csname#1\endcsname}
               {\end@dblfloat}
}
\makeatother
\begin{document}

\begingroup
\CTFont% tables in \small size
\input{testtables}
\endgroup

\begingroup
\CTFont[tiny]% tables in \tiny size
\input{testtables}
\endgroup

\begingroup
\CTFont[Large]% tables in \Large size
\input{testtables}
\endgroup

\end{document}

enter image description here

The filecontents package and the filecontents* environment are only to provide a complete compilable example; you don't need them in your actual code.

With the code above, the change in the font size will only affect the table contents but not the captions; to achieve a simultaneous change to the caption font size, it's enough to load the caption package:

\usepackage{caption}

and change the definition of \CFTable to

\makeatletter
\newcommand\CTFont[1][small]{
\captionsetup[table]{font=#1}
\renewenvironment{table}
               {\@float{table}\csname#1\endcsname}
               {\end@float}
\renewenvironment{table*}
               {\@dblfloat{table}\csname#1\endcsname}
               {\end@dblfloat}
}
\makeatother

now, however, the only valid values for the optional argument are scriptsize, footnotesize, small (default), normalsize, large, and Large.