1

I tried to rotate a figure and its caption using the adjustbox package. This works fine, until I load the floatrow package too, then the caption isn't rotated.

See my MWE:

\documentclass{article}
\usepackage{adjustbox}
\usepackage{blindtext}
\usepackage{floatrow} 

\begin{document}
\blindtext

\begin{figure}[ht]
  \begin{adjustbox}{addcode={\begin{minipage}{\width}}{\caption{%
      Here is a caption of the figure which is so long that 
      it has to be wrapped over multiple lines, but should 
      not exceed the width (height after the rotation) of the image.
      }\end{minipage}},rotate=90,center}
      \includegraphics[scale=.6]{example-image}%
  \end{adjustbox}
\end{figure}

\blindtext
\end{document}

I checked both package documentations for references to one another, but there doesn't seem to be anything.

Does anybody have an idea how to solve this?

1

The problem here is that floatrow redefines the internal code of the \caption command and hooks into the figure environment code. It then stores the caption text first internally and reinserts it in the configured position, either top or bottom of the figure content. The normal behavior without that package is that the caption is placed immediately.

As it is not placed where the code is written -- inside the adjustbox environment -- then it can't be rotated by that environment! Instead it is reinserted later as mentioned above.

Unfortunately there is no easy way to force floatrow here to just place the caption as normal, as it does not look to be designed for that. Then, adjustbox here can't do anything about it. I would recommend to live with it or to try to change to another float package which gives you the features you want but lets the captions as they are.

However, a complete solution which hacks the internal code of float again and places the rotating code after the floatrow code would be possible I guess, but a little overkill.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.