2

I've been looking for solutions of this problem but I only found solutions that uses small or footnotesize for table font letters, or \setlength\tabcolsep for columns width adjustment. But these solutions doesnt fit automatically the table width into text width and \resizebox doesnt work for longtables enviorment. So, what can I do here?

obs: I also put an table written in table environment fitted by \resizebox for sake of width comparation.

   \documentclass[12pt,a4paper]{article}
   \usepackage[utf8]{inputenc}
   \usepackage[brazilian]{babel}
   \usepackage{float}
   \usepackage{graphicx}
   \usepackage[justification=centering]{caption}
   \usepackage[T1]{fontenc} %CODE
   \usepackage{uarial}% FOR
   \renewcommand{\familydefault}{\sfdefault}% ARIAL FONT
   \usepackage{longtable}
   \usepackage[top=2cm,left=2cm,right=2cm,bottom=2cm]{geometry}
   \parindent=1.5cm
   \newcommand{\specialcell}[2][c]{%
   \begin{tabular}[#1]{@{}c@{}}#2\end{tabular}}
   \usepackage{hyperref}
    \begin{document}
        \newpage
         \begin{table}[H]    
         \begin{center}  

        \caption{Lista dos amortecimentos mínimos para cada ponto de operação em relação diferentes sistemas de controle operando}
        \label{zetas}
        \vspace{-0.2cm}
        \resizebox{\columnwidth}{!}{%
            \begin{tabular}{|c|c|c|c|}
                \hline  \specialcell{ Condição \\ operativa} & \specialcell{ PSSs locais\\ \centering{$\zeta_{min} (\%) $}}  & \specialcell{ PSSs locais + PSS central \\ \centering{$\zeta_{min} (\%) $}}   & \specialcell{ PSSs locais + PSS central ordem reduzida\\  \centering{$\zeta_{min} (\%) $} } \\ 
                \hline Ponto 1& 15.59  & 40.80 & 28.19 \\ 
                \hline Ponto 2& 15.59 & 38.83 &  27.98 \\ 
                \hline Ponto 3& 15.63 & 41.48 &  27.71 \\ 
                \hline Ponto 4& 15.77 & 36.19 &  29.06\\ 
                \hline Ponto 5& 15.71 & 41.47 &  27.26\\ 
                \hline Ponto 6& 15.92 & 36.70 &  27.57\\ 
                \hline Ponto 7& 16.13 & 40.18 &  28.34\\ 
                \hline Ponto 8& 16.21 & 35.80 &  27.34\\ 
                \hline Ponto 9& 15.75 & 40.95 &  27.08\\ 
                \hline Ponto 10& 15.89& 35.21 &  29.18\\ 
                \hline Ponto 11& 16.20 & 33.60 & 29.30 \\ 
                \hline Ponto 12& 15.81 & 40.36 & 26.84 \\ 
                \hline Ponto 13& 16.89 & 34.40 & 26.87 \\ 
                \hline Ponto 14& 18.16 & 43.44 & 34.15 \\ 
                \hline Ponto 15& 23.74 & 37.72 & 30.89 \\ 
                \hline Ponto 16& 17.10 & 38.15 & 28.71 \\ 
                \hline Ponto 17& 19.51 & 30.68 & 25.64 \\ 
                \hline Ponto 18& 15.53 & 26.82 & 23.00 \\ 
                \hline Ponto 19& 12.56 & 34.74 & 26.83 \\ 
                \hline Ponto 20& 19.33 & 37.94 & 31.92 \\ 
                \hline Ponto 21& 20.07 & 37.21 & 35.49 \\ 
                \hline Ponto 22& 15.62 & 38.39 & 28.66 \\ 
                \hline Ponto 23& 15.67 & 37.94 & 25.93 \\ 
                \hline Ponto 24& 15.72 & 37.75 & 25.61 \\ 
                \hline Ponto 25& 15.76 & 37.99 & 25.41 \\ 
                \hline Ponto 26& 15.69 & 31.47 & 26.37 \\ 
                \hline Ponto 27& 17.35 & 29.22 & 25.28 \\ 
                \hline 
            \end{tabular} 
            %
        }   \end{center}

    \end{table} \vspace{-1.4cm}
    \footnotesize
\begin{longtable}{|c|c|c|c|}    
        \caption{Lista dos amortecimentos mínimos para cada ponto de operação em relação diferentes sistemas de controle operando}
        \label{table1}\\
            \hline   \specialcell{ Condição \\ operativa} & \specialcell{ PSSs locais\\ \centering{$\zeta_{min} (\%) $}}  & \specialcell{ PSSs locais + PSS central \\ \centering{$\zeta_{min} (\%) $}}   & \specialcell{ PSSs locais + PSS central ordem reduzida\\  \centering{$\zeta_{min} (\%) $} } \\ 
            \hline Ponto 1& 15.59  & 40.80 & 28.19 \\ 
            \hline Ponto 2& 15.59 & 38.83 &  27.98 \\ 
            \hline Ponto 3& 15.63 & 41.48 &  27.71 \\ 
            \hline Ponto 4& 15.77 & 36.19 &  29.06\\ 
            \hline Ponto 5& 15.71 & 41.47 &  27.26\\ 
            \hline Ponto 6& 15.92 & 36.70 &  27.57\\ 
            \hline Ponto 7& 16.13 & 40.18 &  28.34\\ 
            \hline Ponto 8& 16.21 & 35.80 &  27.34\\ 
            \hline Ponto 9& 15.75 & 40.95 &  27.08\\ 
            \hline Ponto 10& 15.89& 35.21 &  29.18\\ 
            \hline Ponto 11& 16.20 & 33.60 & 29.30 \\ 
            \hline Ponto 12& 15.81 & 40.36 & 26.84 \\ 
            \hline Ponto 13& 16.89 & 34.40 & 26.87 \\ 
            \hline Ponto 14& 18.16 & 43.44 & 34.15 \\ 
            \hline Ponto 15& 23.74 & 37.72 & 30.89 \\ 
            \hline Ponto 16& 17.10 & 38.15 & 28.71 \\ 
            \hline Ponto 17& 19.51 & 30.68 & 25.64 \\ 
            \hline Ponto 18& 15.53 & 26.82 & 23.00 \\ 
            \hline Ponto 19& 12.56 & 34.74 & 26.83 \\ 
            \hline Ponto 20& 19.33 & 37.94 & 31.92 \\ 
            \hline Ponto 21& 20.07 & 37.21 & 35.49 \\ 
            \hline Ponto 22& 15.62 & 38.39 & 28.66 \\ 
            \hline Ponto 23& 15.67 & 37.94 & 25.93 \\ 
            \hline Ponto 24& 15.72 & 37.75 & 25.61 \\ 
            \hline Ponto 25& 15.76 & 37.99 & 25.41 \\ 
            \hline Ponto 26& 15.69 & 31.47 & 26.37 \\ 
            \hline Ponto 27& 17.35 & 29.22 & 25.28 \\ 
            \hline 
\end{longtable} 
 \end{document}
1
  • 1
    You can make the table take the width, but it will not adjust the size of its contents e.g. the font will be \small or \footnotesize or whatever. Is that what you want? Resizing a table with \resizebox is evil anyway, so you shouldn't want to do it that way ;).
    – cfr
    Commented May 24, 2016 at 1:08

1 Answer 1

2

Some suggestions:

  • Never use \resizebox for tables -- unless you want to risk creating major font size changes between the text and table portions of your document and from one table to the next.

  • Instead, provide a bit more structure to the table headers, e.g., through well-chosen line breaks. That way, the overall width of the table won't exceed \textwidth to begin with.

  • Do give your tables a more "open" look by omitting all vertical bars and most horizontal bars. For the few remaining horizontal lines, don't use \hline. Instead, use the line-drawing macros of the booktabs package to generate well-spaced lines.

  • If you still want the width of a longtable environment to equal the width of the text block, use the method explained on p. 7 of the user guide of the longtable package; see also below.

enter image description here

   \documentclass[12pt,a4paper]{article}
   \usepackage[utf8]{inputenc}
   \usepackage[brazilian]{babel}
   \usepackage{booktabs}
   \usepackage{graphicx}
   \usepackage[justification=centering]{caption}
   \usepackage[T1]{fontenc} %CODE
   \usepackage{helvet}% FOR
   \renewcommand{\familydefault}{\sfdefault}% ARIAL FONT
   \usepackage{longtable}
   \usepackage[margin=2cm]{geometry}
   \parindent=1.5cm
   \newcommand{\specialcell}[2][t]{%
      \begin{tabular}[#1]{@{}c@{}}#2\end{tabular}}
   \usepackage{hyperref}
   \begin{document}

\setlength\LTleft{0pt} % see p. 7 of longtable package user guide
\setlength\LTright{0pt}
\begin{longtable}{@{} l @{\extracolsep{\fill}} ccc @{}}    
\caption{Lista dos amortecimentos mínimos para cada ponto de operação em relação diferentes sistemas de controle operando}
\label{table1}\\
\toprule
\specialcell{Condição \\ operativa} & 
\specialcell{PSSs locais\\ \\ $\zeta_{\min}$ (\%) }  & 
\specialcell{PSSs locais + \\ PSS central \\ $\zeta_{\min}$ (\%) }   & 
\specialcell{PSSs locais + \\ PSS central ordem reduzida \\ $\zeta_{\min}$ (\%) } \\ 
\midrule
\endhead
\bottomrule
\endfoot
Ponto 1& 15.59  & 40.80 & 28.19 \\ 
Ponto 2& 15.59 & 38.83 &  27.98 \\ 
Ponto 3& 15.63 & 41.48 &  27.71 \\ 
Ponto 4& 15.77 & 36.19 &  29.06\\ 
Ponto 5& 15.71 & 41.47 &  27.26\\ \addlinespace
Ponto 6& 15.92 & 36.70 &  27.57\\ 
Ponto 7& 16.13 & 40.18 &  28.34\\ 
Ponto 8& 16.21 & 35.80 &  27.34\\ 
Ponto 9& 15.75 & 40.95 &  27.08\\ 
Ponto 10& 15.89& 35.21 &  29.18\\ \addlinespace
Ponto 11& 16.20 & 33.60 & 29.30 \\ 
Ponto 12& 15.81 & 40.36 & 26.84 \\ 
Ponto 13& 16.89 & 34.40 & 26.87 \\ 
Ponto 14& 18.16 & 43.44 & 34.15 \\ 
Ponto 15& 23.74 & 37.72 & 30.89 \\ \addlinespace
Ponto 16& 17.10 & 38.15 & 28.71 \\ 
Ponto 17& 19.51 & 30.68 & 25.64 \\ 
Ponto 18& 15.53 & 26.82 & 23.00 \\ 
Ponto 19& 12.56 & 34.74 & 26.83 \\ 
Ponto 20& 19.33 & 37.94 & 31.92 \\ \addlinespace
Ponto 21& 20.07 & 37.21 & 35.49 \\ 
Ponto 22& 15.62 & 38.39 & 28.66 \\ 
Ponto 23& 15.67 & 37.94 & 25.93 \\ 
Ponto 24& 15.72 & 37.75 & 25.61 \\ 
Ponto 25& 15.76 & 37.99 & 25.41 \\ \addlinespace
Ponto 26& 15.69 & 31.47 & 26.37 \\ 
Ponto 27& 17.35 & 29.22 & 25.28 \\ 
\end{longtable} 
\end{document}

You must log in to answer this question.

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