6

I'm trying to migrate my project from float package to floatrow one (we can't load former with the latter as it is said in documentation for floatrow).

I extensively used ruled style. Most obvious thing after switch to floatrow is broken vertical alignment when caption goes to multiple lines.

enter image description here

Spacing between the caption text and the rules is quite different for some reason. Looks awful.

Second problem is that I can't get working labelsep=period from caption package.

My MWE is as follows.

\documentclass[14pt]{extarticle}
\usepackage[english]{babel}

\usepackage{floatrow}%
\DeclareNewFloatType{LstEnv}{%
placement=htbp,fileext=lol}
\floatsetup[LstEnv]{style=ruled}

\usepackage{caption}
\captionsetup[LstEnv]{labelsep=period}

\begin{document}
\begin{LstEnv}[H]
Abc
\caption{My cap}
\end{LstEnv}

\begin{LstEnv}[H]
Abc
\caption{Very long caption Very long caption 
Very long caption Very long caption Very long caption }
\end{LstEnv}
\end{document}
  • If you insert a caption like \caption{\vrule height30pt}, you will find that captions have a minimal height. So the broken part is when there is only line to show which is too short to prop up the space. – Symbol 1 Aug 17 '15 at 5:55
  • @Symbol1 not really see how this helps. Are you saying that the package has fundamental flaw? – Artem Pelenitsyn Aug 18 '15 at 10:10
  • I would rather call it design. A box having minimal height is not something you can achieve accidentally. – Symbol 1 Aug 18 '15 at 10:20
3

The solution for your issues:

  1. Redefine the definition of the above rule

    \DeclareFloatVCode{thickrule}{\par\rule{\hsize}{.8pt}\strut\par\unskip}
    
  2. Load caption before floatrow

The complete code

\documentclass[14pt]{extarticle}
\usepackage[english]{babel}
\usepackage{caption,xcolor}
\usepackage{calc}
\usepackage{floatrow}%
\DeclareNewFloatType{LstEnv}{%
placement=htbp,fileext=lol}
\DeclareFloatVCode{thickrule}{\par\rule{\hsize}{.8pt}\strut\par\unskip}
\floatsetup[LstEnv]{style=ruled}


\captionsetup[LstEnv]{labelsep=period}

\begin{document}
\begin{LstEnv}
Abc
\caption{My cap}
\end{LstEnv}

\begin{LstEnv}
Abc
\caption{Very long caption Very long caption 
Very long caption Very long caption Very long caption }
\end{LstEnv}
\end{document}

and finally the result

enter image description here

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.