1

Tried all the forums and questions but could not find one that answered.

I am in latex trying to caption some tables.

I have tables that I have in some instances rotated, and others scaled. They are tables I have imported, not written in latex (they're from python/pandas)

Eg of rotated table code:

\begin{adjustbox}{angle=90}
    \begin{tabular}{ll}
    \input{mytable}
    \end{tabular}
\end{adjustbox}

And here is the one I resize

\resizebox{17cm}{!}{
    \begin{adjustbox}{angle=90}
        \begin{tabular}{ll}
        \input{abs hypothesis tables/firsthypothesistable_a}
        \end{tabular}
    \end{adjustbox}
}

I've tried a handful of things to caption these tables (i.e., 'Table x: table of bla bla'), without success. Any help welcome :(

4
  • Please make your code snippets be compilable, then we do not have to guess what you are doing ...
    – Mensch
    Commented Aug 15, 2022 at 16:29
  • Why don't you use the sidewaystable environment, after you've loaded the rotating package?
    – Bernard
    Commented Aug 15, 2022 at 16:33
  • \caption needs to be inside a minipage, \parbox or \vbox, something with a width. You should probably add \centering before the tabular inside th minipage as well. Commented Aug 15, 2022 at 17:24
  • See also tex.stackexchange.com/questions/399557/… Commented Aug 15, 2022 at 18:23

1 Answer 1

1

IIRC, sidewaystable takes up the whole page.

\documentclass{article} 
\usepackage{adjustbox}
\begin{document}

\begin{table}[ht]
\sbox0{\begin{tabular}{|ccc|}
    \hline
    yada & yada & yada\\
    \hline
  \end{tabular}}% measure width
\centering
\rotatebox{90}{\begin{minipage}{\wd0}% use width of tabular
  \usebox0
  
  \caption{This is the caption}
\end{minipage}}
\end{table}

\end{document}
1
  • John Thanks so much for this!! Really appreciate Commented Aug 26, 2022 at 10:32

You must log in to answer this question.

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