\textwidth innerhalb von \resizebox

\textwidth innerhalb von \resizebox

Ich möchte, dass in der letzten Zeile einer Tabelle die Notizen angezeigt werden, die sich über alle Spalten erstrecken \multicolumn{#}{p{\textwidth}}{}. Dies funktioniert im Zusammenhang mit der Größenänderung nicht richtig, da textwidthder Wert gleich bleibt, die Messung jedoch nach unten skaliert wird.

Hier ist mein Code:

\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} 

Ausgabe: Bildbeschreibung hier eingeben

Antwort1

Besser zu verwenden threeparttablex, obwohl es nicht perfekt ist (ein wenig zu breit auf der rechten Seite)

\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} 

Antwort2

Sie müssen zunächst dierealBreite des Tisches

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

Dann

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

Vollständiges Beispiel:

\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} 

verwandte Informationen