3

i defined a new float in memoir class. everything works fine, except i can't manage to change the caption font style. if i declare \captionnamefont{\bfseries}, the font changes only for default float types, but not for the newly defined ones. see the image.

enter image description here

i used to achieve the desired result using 'caption' package. but i don't want to use it anymore, because i got several errors in memoir class.

thanks for your assistance.

edit: minimal example

\documentclass[a4paper]{memoir} 

\usepackage{float}

\captionnamefont{\bfseries}

\newcommand{\newfloatname}{NewFloat}
\newfloat{NewFloat}{nwf}{\newfloatname}[chapter]
\newlistentry{newfloat}{nwf}{0}


\begin{document}

    \begin{figure}[h]
        \caption{Caption of original float.}
    \end{figure}

    \begin{NewFloat}[h]
        \caption{Caption of newly defined float}
    \end{NewFloat}

\end{document}
  • 1
    Welcome to TeX.SE! Could you provide the code of a small but complete document that reproduces this problem? So it this case \documentclass{memoir}, any language options, the code you use for defining the new float type, code for setting the caption, \begin{document}, two example floats, \end{document}. That way it is much easier to reproduce the problem, to be sure what the problem is, and to start trying to find a solution. – Marijn Sep 2 at 16:03
  • 1
    The caption package works fine with memoir. So as Marjin says, please provide a full (but minimal l self contained example we can work with, so we can get a idea of what you are doing. – daleif Sep 2 at 16:12
  • 1
    thanks for your help. it seems that the issue is caused by the float package. i managed to reproduce the error with just this package loaded. the minimal example in main post. – user195690 Sep 2 at 16:39
  • @user195690 that is another reason why we ask for minimal examples: often, in the process of making the example, the asker finds out what the problem is and many times also what the solution to that problem can be. It's a useful debugging technique as you have found out :) – Marijn Sep 2 at 21:52
3

As you mentioned, the float package is causing the issue. Remove it and change the syntax to match that provided by memoir natively; it's similar, but different.

enter image description here

\documentclass{memoir} 

\newcommand{\newfloatname}{NewFloat}
\newfloat[chapter]{NewFloat}{nwf}{\newfloatname}

\captionnamefont{\bfseries}

\begin{document}

\begin{figure}[h]
  \caption{Caption of original float.}
\end{figure}

\begin{NewFloat}[h]
  \caption{Caption of newly defined float}
\end{NewFloat}

\end{document}
  • great, thank you very much! i will just have to figure out, whether i am able to live without "H" placement specifier defined in float package. – user195690 Sep 2 at 17:37
  • @user195690: You can make your own [H] float. Here's a manual implementation: code – Werner Sep 2 at 20:23

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.