Adjust caption length to table length in hvFloat environment

I am trying to create a sideways-table with multi-columns. As I want title and table on the same page, I am using the hvfloat package. I'd like to get a caption that is as wide as my table, but it seems as if the hvfloat package does not adjust caption/font size to the table size (as LaTeX does within the "regular" (not using hvfloat) table environment using the option \caption{...}

I had a look at the package pdf and figured that I have to set the length of the caption (?) by using \setlength{}. However, whatever I tried, it would not work.

Is there someone who can help me? Thanks a lot!

Simple working example:

\documentclass[12pt,apa]{article}

\usepackage{hvFloat}
\usepackage{booktabs}

\begin{document}

\hvFloat[%
nonFloat=true,%
capPos=l,%
capAngle=90,%
objectAngle=90,%
]{table}{\tiny%
\begin{tabular}{l cccc}
\toprule
& \multicolumn{4}{c}{XY} \\[0.5ex]
\midrule
& wklrewkwrelwer & werwerwerwer z & werwerwrewera & wrewerwerwerb \\[1ex]
\bottomrule
\end{tabular}%
}%
[]{%
abcdefghijk lmnopq rzstuvwabcdefk gheow9kdsl slwowolslsllsl slslslls}{tab:3}
%

\end{document}

• Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – karlkoeller Sep 2 '13 at 17:43

You have to add the option capWidth=h to the settings of your \hvFloat.

Since you have your table placed vertically, you have to specify h, that stands for the height of the float. Use capWidth=w (w is for width) when your table is placed horizontally, instead.

\documentclass[12pt]{article}

\usepackage{hvfloat}
\usepackage{booktabs}

\begin{document}

\hvFloat[%
nonFloat=true,%
capPos=l,%
capWidth=h,%
capAngle=90,%
objectAngle=90,%
]{table}{\tiny%
\begin{tabular}{l cccc}
\toprule
& \multicolumn{4}{c}{XY} \\[0.5ex]
\midrule
& wklrewkwrelwer & werwerwerwer z & werwerwrewera & wrewerwerwerb \\[1ex]
\bottomrule
\end{tabular}%
}%
[]{%
abcdefghijk lmnopq rzstuvwabcdefk gheow9kdsl slwowolslsllsl slslslls}{tab:3}
%

\end{document}


BTW: the name of the package is hvfloat while the name of the environment is hvFloat.