I'm not sure which table generator you're using, but always having the \resizebox
es is a really bad idea. As you've noticed, you get inconsistent font sizes and distorted rules. You might want to check if there is an option to turn this off in whichever software/web app/etc. you're using for this.
The immediate fix is to comment out the \resizebox
line and its corresponding closing brace, like this:
\begin{table}[h]
%\resizebox{\textwidth}{!}{%
\begin{tabular}{|l|l|r|}
\hline
\multicolumn{3}{|c|}{Item} \\ \hline
Animal & Description & Price (\$) \\ \hline
Gnat & per gram & 13.65 \\ \hline
& very long text & 0.01 \\ \hline
\end{tabular}
%}
\end{table}
This will get rid of the drastic resizing.
If the table ends up being too wide for the text, you can insert \small
or any other font size command inside the tabular
environment. This will allow more controlled adjustment of the font size, so it's at least consistent with other font sizes in your document.
In the full code, I also show some capabilities of the excellent booktabs
package for better layout of tables. Some table code generators support booktabs
natively (excel2latex
and probably others) or you can add the markup manually.
\documentclass{article}
\usepackage{booktabs,multirow}
\setcounter{totalnumber}{4} % just so they all fit on the page
\begin{document}
Example 1:
\begin{table}[h]
%\resizebox{\textwidth}{!}{%
\begin{tabular}{|l|l|r|}
\hline
\multicolumn{3}{|c|}{Item} \\ \hline
Animal & Description & Price (\$) \\ \hline
Gnat & per gram & 13.65 \\ \hline
& very long text & 0.01 \\ \hline
\end{tabular}
%}
\end{table}
Example 2 (also illustrating \verb+\centering+):
\begin{table}[h]
\centering
%\resizebox{\textwidth}{!}{%
\begin{tabular}{|l|l|r|}
\hline
\multicolumn{1}{|c|}{Animal} & Description & Price (\$) \\ \hline
\multirow{2}{*}{Gnat} & per gram & 13.65 \\ \cline{2-3}
& each & 0.01 \\ \hline
Gnu & stuffed & 92.50 \\ \hline
\end{tabular}
%}
\end{table}
After \verb+booktabs+-ification (optional):
\begin{table}[h]
\centering
\begin{tabular}{llr}
\toprule
\multicolumn{3}{c}{Item} \\ \cmidrule(lr){1-3}
Animal & Description & Price (\$) \\ \midrule
Gnat & per gram & 13.65 \\
& very long text & 0.01 \\ \bottomrule
\end{tabular}
\end{table}
\begin{table}[h]
\centering
\begin{tabular}{llr}
\toprule
Animal & Description & Price (\$) \\ \midrule
\multirow{2}{*}{Gnat} & per gram & 13.65 \\
& each & 0.01 \\ \addlinespace
Gnu & stuffed & 92.50 \\ \bottomrule
\end{tabular}
\end{table}
\end{document}

\resizebox
es, replacing with a suitable font size command if necessary (e.g.\small
). The third argument of the\resizebox
(the tabular itself) should be retained.\resizebox{\textwidth}{!}{%
that's a bug:-)csvtools
package. You can also use thepgfplotstable
package.excel2Latex
too.