# How to reduce font size automatically to prevent new line in cell

I use tabularx environment, where \begin{tabularx}{\linewidth}{XXXXXXXXXXXXXXX}. When I inserted in every tabulars long numbers, cell splits for two lines and my table looks like very ugly. This long numbers will be inserted automatically. Is it possible to recalculate font size automatically If cell value is longer and doesn't fit ?

Here my source

\begin{tabularx}{\linewidth}{XXXXXXXXXXX}
0&1 &2 &3 &4 &5 &6 &7 &8 &9 &10\\
\hline
4444444 &4444444 &4444444 &4444444 &4444444 &4444444 &4444444 &4444444 &4444444 &4444444\\
\hline
4444444 &4444444 &4444444 &4444444 &4444444 &4444444 &4444444 &4444444 &4444444 &4444444\\
\hline
4444444 &4444444 &4444444 &4444444 &4444444 &4444444 &4444444 &4444444 &4444444 &4444444\\
\end{tabularx}
• Welcome to TeX.sx! Usually, we don't put a greeting or a “thank you” in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Accepting and upvoting answers is the preferred way here to say “thank you” to users who helped you. – masu Nov 19 '13 at 10:51
• The fitbox I've created might help you to do that (but you only need to resize, if the content is too large). Although the "cell by cell automatization" is a tough nut to crack - I don't if it's even possible. – masu Nov 19 '13 at 10:53
• Do you really want to shrink or if these are output from an arbitrary precision integer package or similar, you could allow linebreaking between digits (either way tabularx isn't really helping, it is designed for paragraphs of text with multiple potential linebreaking points) – David Carlisle Nov 19 '13 at 11:26
• No, I need in shrink of font, because system, which output my template table, inserts ready value like format xx.xx – Lopes Nov 19 '13 at 11:47

It's generally a bad idea to apply scaling to text as it leads to inconsistent font sizes but if you must, you must:

Don't use tabularx just set the table natural size then scale it (graphicx package).

\noindent\resizebox{\textwidth}{!}{%
\begin{tabular}{*{11}{l}}
0&1 &2 &3 &4 &5 &6 &7 &8 &9 &10\\
\hline
4444444 &4444444 &4444444 &4444444 &4444444 &4444444 &4444444 &4444444 &4444444 &4444444\\
\hline
4444444 &4444444 &4444444 &4444444 &4444444 &4444444 &4444444 &4444444 &4444444 &4444444\\
\hline
4444444 &4444444 &4444444 &4444444 &4444444 &4444444 &4444444 &4444444 &4444444 &4444444\\
\end{tabular}}