2

I use the booktabs package and the floatrow package with the float style ruled. For consistency I would like to apply this look (example) to the glossary I use as nomenclature and an amsmath enviornment. So far I use the caption technic described in the floatrow manual, using captionsetup and caption.

I wonder if there is any easy way to trick floatrow into handling a minipage like a float and adding the appropiate rules.

Here is a not so minimal example. It includes a table and a figure that look like I want them too. And a not correctly formated glossary and align environment.

\documentclass{report}
\usepackage{amsmath}
\usepackage{booktabs}
\usepackage[demo]{graphicx}

\usepackage{caption}
\usepackage[list=on]{subcaption}
\usepackage{glossaries}

\usepackage{floatrow}

\floatsetup{style=ruled, footposition=caption, capposition=bottom, heightadjust=object}   %make graphics look like booktables
\floatsetup[table]{style=plain, footposition=bottom}
\captionsetup[table]{labelfont=bf}

\newglossaryentry{demo}{
                    name        =modulo,
                    symbol      =\ensuremath{\protect \bmod},
                    description ={modulo operator}}

\glsaddall

\begin{document}
\chapter{needs work}
\begin{center}%vertical spacing
\begin{minipage}{\linewidth}%group caption and content on same page
    \centering
    \captionsetup{type=table}
    \begin{align}
        1+2=3
    \end{align}
    \caption{Align}
\end{minipage}
\end{center}

\begin{center}%vertical spacing
\begin{minipage}{\linewidth}%group caption and content on same page
    \centering
    \captionsetup{type=table}
    \renewcommand{\glossarysection}[2][]{}
    \printglossary
    \caption{Nomenclature glossary}
\end{minipage}
\end{center}

\chapter{should be look}
\begin{table}
\begin{tabular}{lrrp{5cm}}
    \toprule
    %name & lines per set & sets & pros/cons\\
     & hea &der \\
    \midrule
    con & ten & t \\
    con & ten & t \\
    \bottomrule
\end{tabular}
\caption{Table}
\end{table}

\begin{figure}
\includegraphics[height=2in, width=4in]{}
\caption{Figure}
\end{figure}
\end{document}
Moriambar
  • 11,466
ted
  • 3,377
  • Your table in chapter 2 "should be look" has no rules, so I assume you don't want table captions to have rules. That's exactly what happens to your align and glossary captions since you declared them of type table. What is the problem then? Am I missing something? – Gonzalo Medina Aug 04 '13 at 00:13
  • @GonzaloMedina: yes. I tried \captionsetup{type=table, style=ruled} (inside the minipages where I set the anchor) but this does not have effect. I marked them as tables, since that is the list of x I want them to appear in. – ted Aug 04 '13 at 08:24
  • Additional note: I want those to items to be wrapped like figure (line above top and arround caption), I just turned it off for tables since it looks bad with booktabs. – ted Aug 04 '13 at 08:40
  • Ah, now I see. Please see my answer for a possible solution. – Gonzalo Medina Aug 04 '13 at 15:01

1 Answers1

2

One possible solution is to use a figure environment, but with the H placement specifier and \captionsetup{type=table}; in this way, the objects will receive the desired ruled style, won't float (H means "exactly here") and will have their captions as table captions:

\documentclass{report}
\usepackage{amsmath}
\usepackage{booktabs}
\usepackage[demo]{graphicx}
\usepackage{caption}
\usepackage[list=on]{subcaption}
\usepackage{glossaries}
\usepackage{floatrow}

\makeglossaries

\DeclareFloatVCode{rule}{\vskip2pt\hrule\vskip4pt}
\DeclareFloatVCode{lowrule}{\par\rule{\hsize}{.8pt}\par}

\floatsetup{style=ruled, footposition=caption, capposition=bottom, heightadjust=object}   %make graphics look like booktables
\floatsetup[table]{style=plain, footposition=bottom}
\captionsetup[table]{labelfont=bf}

\newglossaryentry{demo}{
  name=modulo,
  symbol=\ensuremath{\protect \bmod},
  description={modulo operator}}
\newglossaryentry{permutation}{
  name=\ensuremath{(12)},
  description={a permutation}}

\glsaddall

\begin{document}
\chapter{A solution}
\gls{demo}, \gls{permutation}
\begin{figure}[H]
    \centering
    \captionsetup{type=table}
    \begin{align}
        1+2=3
    \end{align}
    \caption{Align}
\end{figure}

\begin{figure}[H]
    \centering
    \captionsetup{type=table}
    \renewcommand{\glossarysection}[2][]{}
    \printglossary
    \caption{Nomenclature glossary}
\end{figure}

\end{document}

enter image description here

I also changed the definitions of rule and lowrule used for the ruled style so that the initial and final rules are thicker than the middle line separating the object and its caption, and providing a better vertical spacing between the rules and the caption.

Gonzalo Medina
  • 505,128
  • now I see my mistake, I tried this with [h!] and latex told me that it changed it to [ht!] which was unacceptable for me, since I do not want the nomenclature float infront of the section heading that reads nomenclature. – ted Aug 04 '13 at 15:29
  • the table headers look much nicer using booktabs (i checked the manual to make sure) -- the text should be vertically centered, or nearly so. so i'm not sure what's happeneng here. perhaps putting the caption at the bottom? – barbara beeton Aug 04 '13 at 16:17
  • @barbarabeeton I've made some adjustments to the rules ans the spacing bettwen the rules and the caption in the default ruled style. Hope it's better now. – Gonzalo Medina Aug 04 '13 at 21:29
  • 1
    @ted I updated my answer introducing some modifications to the rules and the spacing. – Gonzalo Medina Aug 04 '13 at 21:29
  • @GonzaloMedina -- oh, very much nicer! thanks. (i like to see answers that set good examples.) – barbara beeton Aug 04 '13 at 21:45
  • Your adjustment is nice, it made everything look better. It should become a patch for floatrow if the options style=ruled and capposition=bottom are applied together. – ted Aug 06 '13 at 07:30