Problemas ao ajustar a tabela gerada à largura

Problemas ao ajustar a tabela gerada à largura

Eu revi alguns posts aqui, mas tudo parece estar quebrando minha mesa, então resolvi postar meu problema e pedir ajuda. Eu gerei uma tabela usandohttps://www.tablesgenerator.com

Estou tendo problemas para ajustar minha tabela à largura da página sem reduzir o texto:

\documentclass[acmsmall]{acmart}
 \usepackage{graphicx}
   \usepackage[table,xcdraw]{xcolor}
      \begin{table}[]
        \resizebox{\textwidth}{!}{%
        \begin{tabular}{lcccccccccccc}
        \hline
        \rowcolor[HTML]{EFEFEF} 
        \multicolumn{13}{c}{\cellcolor[HTML]{EFEFEF}\textbf{Title}} \\ \hline
        \textit{\textbf{Hashtag}} & \multicolumn{3}{c}
        {\textit{\textbf{Service1}}} & \multicolumn{3}{c}
        {\textit{\textbf{Service2}}} & \multicolumn{3}{c}
        {\textit{\textbf{Service3}}} & \multicolumn{3}{c}
        {\textit{\textbf{Service4}}} \\ \hline
        \rowcolor[HTML]{EFEFEF} 
          \textit{} & \textit{True} & \textit{False} & \textit{Accuracy} & 
          \textit{True} & \textit{False} & \textit{Accuracy} & \textit{True} & 
          \textit{False} & \textit{Accuracy} & \textit{True} & \textit{False} & 
          \textit{Accuracy} \\ \hline
          \textit{\#1} & n & n & n\% & x & x & x & n & n & n\% & n & 
           n & n\% \\ \hline
        \rowcolor[HTML]{EFEFEF} 
          \textit{\#2} & n & n & n\% & x & x & x & n & n & n\% & n & 
           n & n\% \\ \hline
          \textit{\#3} & n & n & n\% & x & x & x & n & n & n\% & n & 
           n & n\% \\ \hline
        \rowcolor[HTML]{EFEFEF} 
          \textit{\#4} & n & n & n\% & x & x & x & n& 100 & n\% & n
          & n & n\% \\ \hline
          \begin{tabular}[c]{@{}l@{}}\#5, \\ \#6, \\ \#7\end{tabular} & n & n & 
          n\% & n & n & n\% & n & n & n\% & n & n & n\% \\ \hline
      \end{tabular}%
      }
 \end{table}

Responder1

Aqui estão mais duas soluções possíveis usando \tabcolsepcabeçalhos de coluna menores ou abreviados:

insira a descrição da imagem aqui

\documentclass[acmsmall]{acmart}
\usepackage{graphicx}
\usepackage{colortbl}

\begin{document}

      \begin{table}
      \setlength{\tabcolsep}{4pt}
        \begin{tabular}{lcccccccccccc}
        \hline
        \rowcolor[HTML]{EFEFEF} 
        \multicolumn{13}{c}{\cellcolor[HTML]{EFEFEF}\textbf{Title}} \\ \hline
        \textit{\textbf{Hashtag}} & \multicolumn{3}{c}
        {\textit{\textbf{Service1}}} & \multicolumn{3}{c}
        {\textit{\textbf{Service2}}} & \multicolumn{3}{c}
        {\textit{\textbf{Service3}}} & \multicolumn{3}{c}
        {\textit{\textbf{Service4}}} \\ \hline
        \rowcolor[HTML]{EFEFEF} 
          \textit{} & \textit{True} & \textit{False} & \textit{Acc.} & 
          \textit{True} & \textit{False} & \textit{Acc.} & \textit{True} & 
          \textit{False} & \textit{Accuracy} & \textit{True} & \textit{False} & 
          \textit{Acc.} \\ \hline
          \textit{\#1} & n & n & n\% & x & x & x & n & n & n\% & n & 
           n & n\% \\ \hline
        \rowcolor[HTML]{EFEFEF} 
          \textit{\#2} & n & n & n\% & x & x & x & n & n & n\% & n & 
           n & n\% \\ \hline
          \textit{\#3} & n & n & n\% & x & x & x & n & n & n\% & n & 
           n & n\% \\ \hline
        \rowcolor[HTML]{EFEFEF} 
          \textit{\#4} & n & n & n\% & x & x & x & n& 100 & n\% & n
          & n & n\% \\ \hline
        \#5  &&&&&&&&&&&&\\                   
        \#6, & n & n & 
          n\% & n & n & n\% & n & n & n\% & n & n & n\% \\ 
        \#7  &&&&&&&&&&&&\\   
          \hline
          \end{tabular}
 \end{table}


      \begin{table}
        \begin{tabular}{lcccccccccccc}
        \hline
        \rowcolor[HTML]{EFEFEF} 
        \multicolumn{13}{c}{\cellcolor[HTML]{EFEFEF}\textbf{Title}} \\ \hline
        \textit{\textbf{Hashtag}} & \multicolumn{3}{c}
        {\textit{\textbf{Service1}}} & \multicolumn{3}{c}
        {\textit{\textbf{Service2}}} & \multicolumn{3}{c}
        {\textit{\textbf{Service3}}} & \multicolumn{3}{c}
        {\textit{\textbf{Service4}}} \\ \hline
        \rowcolor[HTML]{EFEFEF} 
          \textit{} & \textit{T} & \textit{F} & \textit{Acc.} & 
          \textit{T} & \textit{F} & \textit{Acc.} & \textit{T} & 
          \textit{F} & \textit{Acc.} & \textit{T} & \textit{F} & 
          \textit{Acc.} \\ \hline
          \textit{\#1} & n & n & n\% & x & x & x & n & n & n\% & n & 
           n & n\% \\ \hline
        \rowcolor[HTML]{EFEFEF} 
          \textit{\#2} & n & n & n\% & x & x & x & n & n & n\% & n & 
           n & n\% \\ \hline
          \textit{\#3} & n & n & n\% & x & x & x & n & n & n\% & n & 
           n & n\% \\ \hline
        \rowcolor[HTML]{EFEFEF} 
          \textit{\#4} & n & n & n\% & x & x & x & n& 100 & n\% & n
          & n & n\% \\ \hline
          \begin{tabular}[c]{@{}l@{}}\#5, \\ \#6, \\ \#7\end{tabular} & n & n & 
          n\% & n & n & n\% & n & n & n\% & n & n & n\% \\ \hline
          \multicolumn{13}{l}{T: True, F: False, Acc.: Accuracy}
      \end{tabular}%
 \end{table}

\end{document}

Responder2

A tabela tem muitas colunas para caber na largura do texto disponível em seu tamanho normal, mas em vez de usar \resizeboxvocê pode selecionar manualmente um tamanho de fonte menor, por exemplo \small, isso lhe dará formatos de letras mais apropriados para o tamanho da fonte.

Além disso, você pode economizar espaço abreviando algumas das palavras longas no cabeçalho.

\PassOptionsToPackage{table,xcdraw}{xcolor}
\PassOptionsToPackage{showframe}{geometry}
\documentclass[acmsmall]{acmart}
 \usepackage{graphicx}


%   \usepackage[table,xcdraw]{xcolor}

\begin{document}

      \begin{table}[]
%        \resizebox{\textwidth}{!}{%
\small
        \begin{tabular}{lcccccccccccc}
        \hline
        \rowcolor[HTML]{EFEFEF} 
        \multicolumn{13}{c}{\cellcolor[HTML]{EFEFEF}\textbf{Title}} \\ \hline
        \textit{\textbf{Hashtag}} & \multicolumn{3}{c}
        {\textit{\textbf{Service1}}} & \multicolumn{3}{c}
        {\textit{\textbf{Service2}}} & \multicolumn{3}{c}
        {\textit{\textbf{Service3}}} & \multicolumn{3}{c}
        {\textit{\textbf{Service4}}} \\ \hline
        \rowcolor[HTML]{EFEFEF} 
          \textit{} & \textit{True} & \textit{False} & \textit{Acc.} & 
          \textit{True} & \textit{False} & \textit{Acc.} & \textit{True} & 
          \textit{False} & \textit{Accuracy} & \textit{True} & \textit{False} & 
          \textit{Acc.} \\ \hline
          \textit{\#1} & n & n & n\% & x & x & x & n & n & n\% & n & 
           n & n\% \\ \hline
        \rowcolor[HTML]{EFEFEF} 
          \textit{\#2} & n & n & n\% & x & x & x & n & n & n\% & n & 
           n & n\% \\ \hline
          \textit{\#3} & n & n & n\% & x & x & x & n & n & n\% & n & 
           n & n\% \\ \hline
        \rowcolor[HTML]{EFEFEF} 
          \textit{\#4} & n & n & n\% & x & x & x & n& 100 & n\% & n
          & n & n\% \\ \hline
        \#5  &&&&&&&&&&&&\\                   
        \#6, & n & n & 
          n\% & n & n & n\% & n & n & n\% & n & n & n\% \\ 
        \#7  &&&&&&&&&&&&\\   
          \hline
      \end{tabular}%
%      }
 \end{table}

 \end{document}

informação relacionada