5

I'm using floatrow to create a new environment Quadros (it means frames) but despite showing the correct separator within caption the List Of Quadros still displays a empty space instead. Just need the endash after the float number. I did search for similar questions but couldn't find anything that fixed my problem.

Edit 2: To keep up with my thesis layout I'v adpated C. Hupfer solution into this :

\DeclareCaptionListFormat{quadro}{\llap{{#1}}{#2}\hfill\rlap{\textendash}\hfill\hspace{0.5em}}

Displays exactly like the default list of figure, except by a pixel or two but that's probably due to microtype or simply different characters.

Edit: the current solution from C. Hupfer:

\makeatletter
\renewcommand*{\l@quadro}{\@dottedtocline{1}{1.5em}{1.7em}}
\makeatother

Leads me to problems with the double digit floats:

enter image description here

I'v tried to add a \hspace{0.15em} before the \textendash but doesn't work properly either.

Endash after float number

Here is my MWE:

\documentclass{memoir}
\usepackage[T1]{fontenc}
\let\newfloat\relax                     % % % % % % % % % % % % % % % % % % % % % %
\let\tmp\newinsert                      % 
\let\newinsert\newbox                   % This is to fix some bug of floatrow
\usepackage{floatrow}                   %
\let\newinsert\tmp                      % % % % % % % % % % % % % % % % % % % % % %
\floatsetup{objectset=centering,capposition=top}
\usepackage{caption}

\DeclareNewFloatType{quadro}{placement=p,fileext=frm,name=Quadro}
\newcommand*{\quadroautorefname}{quadro}
\captionsetup[quadro]{
   name=Quadro,
   justification=justified,
   position=above,
   skip=\onelineskip,
   width=0.95\linewidth,
   labelsep=endash, %% ABNT thing requires to use dash
   labelfont={small},
   font={footnotesize},
}
\begin{document}

\begingroup
\let\oldnumberline\numberline
\renewcommand{\numberline}{Quadro~\oldnumberline}
\listof{quadro}{ Lista de Quadros}
\endgroup

    \begin{quadro}
\caption{aaa}\label{quad:a}
content...
\end{quadro}
\begin{quadro}
\caption{bbb}\label{quad:b}
content...
\end{quadro}

\begin{quadro}
\caption{aaa}\label{quad:a}
content...
\end{quadro}
\begin{quadro}
\caption{bbb}\label{quad:b}
content...
\end{quadro}
\begin{quadro}
\caption{aaa}\label{quad:a}
content...
\end{quadro}
\begin{quadro}
\caption{bbb}\label{quad:b}
content...
\end{quadro}
\begin{quadro}
\caption{aaa}\label{quad:a}
content...
\end{quadro}
\begin{quadro}
\caption{bbb}\label{quad:b}
content...
\end{quadro}
\begin{quadro}
\caption{aaa}\label{quad:a}
content...
\end{quadro}
\begin{quadro}
\caption{bbb}\label{quad:b}
content...
\end{quadro}
\begin{quadro}
\caption{aaa}\label{quad:a}
content...
\end{quadro}
\end{document}
  • 1
    The endash setup in labelsep is only for printing the caption where the float appears, but not for the List of .... – user31729 Mar 5 '16 at 21:17
4

There's a built-in support for providing specialized list-of formats in caption package with the setup

\DeclareCaptionListFormat{quadro}{#1\textendash\ #2}

and using listformat=quadro in \captionsetup.

The name quadro is arbitrary (as long it's not figure etc. )

Since the spacing after the quadro number may be too wide the \l@quadro macro must be redefined.

\makeatletter
\renewcommand*{\l@quadro}{\@dottedtocline{1}{1.5em}{1.7em}}
\makeatother

The last parameter (the one with 1.7em) contains the numwidth, i.e. the width of the number section. Usually, this is 2.3em, I reduced it to 1.7em.

    \documentclass{memoir}
    \usepackage[T1]{fontenc}
    \let\newfloat\relax                     % % % % % % % % % % % % % % % % % % % % % %
%    \let\tmp\newinsert                      % 
%    \let\newinsert\newbox                   % This is to fix some bug of floatrow
    \usepackage{floatrow}                   %
%    \let\newinsert\tmp                      % % % % % % % % % % % % % % % % % % % % % %
    \floatsetup{objectset=centering,capposition=top}



\usepackage{caption}

\DeclareNewFloatType{quadro}{placement=p,fileext=frm,name=Quadro}
\DeclareCaptionListFormat{quadro}{#1#2 \textendash}

\newcommand*{\quadroautorefname}{quadro}
\captionsetup[quadro]{
   name=Quadro,
   justification=justified,
   position=above,
   skip=\onelineskip,
   width=0.95\linewidth,
   labelsep=endash, %% ABNT thing requires to use dash
   labelfont={small},
   font={footnotesize},
   listformat=quadro
}


\begin{document}

\begingroup
\let\oldnumberline\numberline
\makeatletter
\renewcommand*{\l@quadro}{\@dottedtocline{1}{1.5em}{1.7em}}
\makeatother
\renewcommand{\numberline}{Quadro~\oldnumberline}
\listof{quadro}{ Lista de Quadros}
\endgroup

\begin{quadro}
\caption{aaa}\label{quad:a}
content...
\end{quadro}
\begin{quadro}
\caption{bbb}\label{quad:b}
content...
\end{quadro}
\end{document}

enter image description here

Update

I've added a \llap statement in the definition of the list format. The \renewcommand{\l@quadro}... isn't necessary any longer then, since aligning the quadro number to the right boundary requires more horizontal spacing than 1.7em.

\documentclass{memoir}
\usepackage[T1]{fontenc}
\let\newfloat\relax                     % % % % % % % % % % % % % % % % % % % % % %
\usepackage{floatrow}                   %
\floatsetup{objectset=centering,capposition=top}



\usepackage{caption}

\DeclareNewFloatType{quadro}{placement=p,fileext=frm,name=Quadro}

\DeclareCaptionListFormat{quadro}{\hfill#1\hfill\llap{#2}\hfill\textendash\hfill}

\newcommand*{\quadroautorefname}{quadro}
\captionsetup[quadro]{
   name=Quadro,
   justification=justified,
   position=above,
   skip=\onelineskip,
   width=0.95\linewidth,
   labelsep=endash, %% ABNT thing requires to use dash
   labelfont={small},
   font={footnotesize},
   listformat=quadro
}


\begin{document}

\begingroup
\let\oldnumberline\numberline
\makeatletter
%\renewcommand*{\l@quadro}{\@dottedtocline{1}{1.5em}{2.7em}}
\makeatother
\renewcommand{\numberline}{Quadro~\oldnumberline}
\listof{quadro}{ Lista de Quadros}
\endgroup


\begin{quadro}
\caption{aaa}\label{quad:a}
content...
\end{quadro}
  \begin{quadro}
  \caption{bbb}%\label{quad:\x}
  content...
\end{quadro}

  \begin{quadro}
  \caption{bbb}%\label{quad:\x}
  content...
\end{quadro}

  \begin{quadro}
  \caption{bbb}%\label{quad:\x}
  content...
\end{quadro}

  \begin{quadro}
  \caption{bbb}%\label{quad:\x}
  content...
\end{quadro}

  \begin{quadro}
  \caption{bbb}%\label{quad:\x}
  content...
\end{quadro}

  \begin{quadro}
  \caption{bbb}%\label{quad:\x}
  content...
\end{quadro}

  \begin{quadro}
  \caption{bbb}%\label{quad:\x}
  content...
\end{quadro}

  \begin{quadro}
  \caption{bbb}%\label{quad:\x}
  content...
\end{quadro}

  \begin{quadro}
  \caption{bbb}%\label{quad:\x}
  content...
\end{quadro}

  \begin{quadro}
  \caption{bbb}%\label{quad:\x}
  content...
\end{quadro}

  \begin{quadro}
  \caption{bbb}%\label{quad:\x}
  content...
\end{quadro}

\end{document}

enter image description here

  • 1
    you shouldn't need the newinsert dance with the latest latex (floatrow bug is still there but latex is more forgiving) – David Carlisle Mar 5 '16 at 21:45
  • That was fast! It works quite well, except... it's misplaced, I'm using `\DeclareCaptionListFormat{quadro}{#1#2 \textendash}' ... there is still a extra space after the endash and little space before. – G. Bay Mar 5 '16 at 21:46
  • @DavidCarlisle: I concentrated on the main issue -- not \newinsert ;-) – user31729 Mar 5 '16 at 21:49
  • @ChristianHupfer oh sorry hadn't noticed that came from the question:-) – David Carlisle Mar 5 '16 at 21:49
  • @G.Bay: Sorry, I was misreading the order of -- etc. I'll try to track the cause of the additional space. – user31729 Mar 5 '16 at 22:01

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.