\textwidth dentro de \resizebox

\textwidth dentro de \resizebox

Quero que a linha final de uma tabela exiba as notas, abrangendo todas as colunas, usando \multicolumn{#}{p{\textwidth}}{}. Isto não funciona corretamente em conexão com o redimensionamento, porque textwidthmantém o mesmo valor, mas a medida é reduzida.

Aqui está o meu código:

\documentclass{article}%
\usepackage{graphicx}
\begin{document}
\resizebox{\textwidth}{!}{%
\begin{tabular}{rrrrrrrrr} \hline
aaaaaaaa & aaaaaaaa & aaaaaaaa & aaaaaaaa & aaaaaaaa & aaaaaaaa & aaaaaaaa & aaaaaaaa & aaaaaaaa\\ \hline
\multicolumn{9}{p{\textwidth}}{Notes: Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et.}
\end{tabular}%
}
\end{document} 

Saída: insira a descrição da imagem aqui

Responder1

Melhor usar threeparttablex, embora não seja perfeito (um pouco largo à direita)

\documentclass{article}%
\usepackage{graphicx}
\usepackage[referable]{threeparttablex}
\begin{document}

\noindent
\rule{\textwidth}{1mm}

\noindent
\resizebox{\textwidth}{!}{%
  \begin{threeparttable}
    \begin{tabular}{rrrrrrrrr} \hline aaaaaaaa & aaaaaaaa & aaaaaaaa &
      aaaaaaaa & aaaaaaaa & aaaaaaaa & aaaaaaaa & aaaaaaaa &
      aaaaaaaa\\ \hline 
    \end{tabular}%
    \begin{tablenotes}
      \note Lorem ipsum dolor sit amet, consetetur sadipscing elitr,
      sed diam nonumy eirmod tempor invidunt ut labore et.
    \end{tablenotes}
  \end{threeparttable}
}
\end{document} 

Responder2

Você primeiro precisa salvar/calcular oreallargura da mesa

\newsavebox\tableBox
\sbox\tableBox{\begin{tabular}{rrrr...}...\end{tabular}} % without the \multicolumn line

então

\resizebox{\textwidth}{!}{%
  \begin{tabular}{rrrr...}
    ...
    \multicolumn{9}{p{\wd\tableBox}}{...}
  \end{tabular}%
}

Exemplo completo:

\documentclass{article}%
\usepackage{graphicx}
\begin{document}

\newsavebox\tableBox
\sbox\tableBox{%
\begin{tabular}{rrrrrrrrr} \hline
aaaaaaaa & aaaaaaaa & aaaaaaaa & aaaaaaaa & aaaaaaaa & aaaaaaaa & aaaaaaaa & aaaaaaaa & aaaaaaaa\\ \hline
\end{tabular}%
}

\resizebox{\textwidth}{!}{%
\begin{tabular}{rrrrrrrrr} \hline
aaaaaaaa & aaaaaaaa & aaaaaaaa & aaaaaaaa & aaaaaaaa & aaaaaaaa & aaaaaaaa & aaaaaaaa & aaaaaaaa\\ \hline
\multicolumn{9}{p{\wd\tableBox}}{Notes: Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et.}
\end{tabular}%
}
\end{document} 

informação relacionada