0

I am trying to adjust the table to the \textwidth but it changes the size of the font and becomes too big. Is there any way to fix the width of the table to the margins (1\textwidth) without changing automatically the fontsize? Using \tiny seems not to work. Thank you very much any help is appreciate it

\begin{table}[!htb]

\centering
\begin{adjustbox}{width=1\textwidth}    
    \tiny           
    \begin{tabular}{|c|ccc|}            
        \hline
        \cellcolor{azultabla}{\textbf{\tiny{Range}}}& 
        \multicolumn{3}{c|}{\cellcolor{azultabla}{\textbf{\tiny{Return }}}}                                                                 
        \\ 
        \hline
        & 
        \multicolumn{1}{c|}{\tiny{Spec.}}& 
        \multicolumn{1}{c|}{\tiny{Meas.}}& 
        \tiny{Pass / Fail}        
        \\ 
        \hline
        \tiny{RF}& 
        \multicolumn{1}{c|}{\tiny{\textgreater 10}}& 
        \multicolumn{1}{c|}{\tiny{xxxx}}& 
        \tiny{xxxx}                    
        \\ 
        \hline
        \tiny{IF}& 
        \multicolumn{1}{c|}{\tiny{\textgreater 10.9}}& 
        \multicolumn{1}{c|}{\tiny{xxxx}}& 
        \tiny{xxxx}                    
        \\ 
        \hline
    \end{tabular}
\end{adjustbox}

\end{table}

9
  • Not quite understood. Are you trying to create a table that is as wide as the text, but the current one is too small and thus adjustbox scales it up?
    – daleif
    Commented Nov 29, 2022 at 13:21
  • 6
    never use adjustbox or resizebox on tables it forces inconsistent fonts as you show Commented Nov 29, 2022 at 13:21
  • 2
    It is hard to understand your code as you did not provide a full minimal example so others cannot just copy and test your code.
    – daleif
    Commented Nov 29, 2022 at 13:21
  • 2
    \tiny does not take an argument use \tiny abc not \tiny{ABC} Commented Nov 29, 2022 at 13:23
  • 1
    Perhaps you should have a look at the tabularx package instead
    – daleif
    Commented Nov 29, 2022 at 13:28

1 Answer 1

1

Never scale tables it just produces inconsistent font sizes. If you do want small text the syntax is \tiny xxx not \tiny{xxx} it does not take an argument.

You can specify a full width table in various ways, I use tabularx here, although the unstretched table is easier to read. I also removed the \multicolumn{1} as they were not doing anything.

enter image description here

\documentclass{article}
\usepackage[tables]{xcolor}
\usepackage{tabularx,colortbl}
\definecolor{azultabla}{rgb}{1,0,0}
\begin{document}

\begin{table}[!htb]

\centering
    \begin{tabular}{|c|c|c|c|}            
        \hline
        \cellcolor{azultabla}{\textbf{Range}}& 
        \multicolumn{3}{c|}{\cellcolor{azultabla}{\textbf{Return}}}                                                                 
        \\ 
        \hline
        & 
        Spec.& 
        Meas.& 
        Pass / Fail       
        \\ 
        \hline
        RF& 
        \textgreater 10& 
        xxxx& 
        xxxx                   
        \\ 
        \hline
        IF& 
        \textgreater 10.9& 
        xxxx& 
        xxxx                   
        \\ 
        \hline
    \end{tabular}

\bigskip
    \newcolumntype{C}{>{\centering\arraybackslash}X}
    \begin{tabularx}{\textwidth}{@{}|C|C|C|C|@{}}            
        \hline
        \cellcolor{azultabla}{\textbf{Range}}& 
        \multicolumn{3}{c|}{\cellcolor{azultabla}{\textbf{Return}}}                                                                 
        \\ 
        \hline
        & 
        Spec.& 
        Meas.& 
        Pass / Fail       
        \\ 
        \hline
        RF& 
        \textgreater 10& 
        xxxx& 
        xxxx                   
        \\ 
        \hline
        IF& 
        \textgreater 10.9& 
        xxxx& 
        xxxx                   
        \\ 
        \hline
    \end{tabularx}

\end{table}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .