0

Consider the following code for the creation of two new floats in an article:

\documentclass{article}

\usepackage{graphicx,float}
% The First Float Type
\floatstyle{boxed} 
\newfloat{BoxImage}{htpb}{csv}[section] 
\floatname{BoxImage}{Boxed Image}
% The Second Float Type
\floatstyle{ruled}
\newfloat{FloatEqn}{htpb}{csv}[section]
\floatname{FloatEqn}{Float Equation}

\begin{document}
    \listof{BoxImage}{List of Boxed Images}
    \listof{FloatEqn}{List of Floating Equations} 
    \section{New Float Types}
    \begin{BoxImage}
        \includegraphics{example-image}
        \caption{This is an image with the new float.}
    \end{BoxImage}
    \begin{FloatEqn}
        \[ E = mc^2 \]
        \caption{Mass-Energy Equivalence.}
    \end{FloatEqn}
\end{document}

the problem is with the list of objects it appears like this:


enter image description here


The list of the second object is behaving in an odd way, and I don't know why. So, if you can help I would be grateful.

Thanks in advance.

3
  • please provide a small but complete test file that makes the output shown, you have posed two fragments but there is no documenclass and it is much better to post a sigle complete example. Apr 3, 2022 at 22:20
  • Ok, I will edit the question now.
    – Ammar Taha
    Apr 3, 2022 at 22:23
  • actually I see it just need \documntclass{article} and changing image to example-image then it shows he probelm Apr 3, 2022 at 22:25

1 Answer 1

1

If you specify the same toc file (csv here you can't hav independent lists, the ouput is a little odd and I didn't trace what it is doing but you can use two exensions, csv and csw say and get

enter image description here

\documentclass{article}
\usepackage{graphicx,float}
% The First Float Type
\floatstyle{boxed} 
\newfloat{BoxImage}{htpb}{csv}[section] 
\floatname{BoxImage}{Boxed Image}
% The Second Float Type
\floatstyle{ruled}
\newfloat{FloatEqn}{htpb}{csw}[section]
\floatname{FloatEqn}{Float Equation}

\begin{document}
    \listof{BoxImage}{List of Boxed Images}

    \listof{FloatEqn}{List of Floating Equations} 

    \section{New Float Types}
    \begin{BoxImage}
        \includegraphics{example-image}
        \caption{This is an image with the new float.}
    \end{BoxImage}
    \begin{FloatEqn}
        \[ E = mc^2 \]
        \caption{Mass-Energy Equivalence.}
    \end{FloatEqn}
\end{document}
1
  • Thanks a lot, I tried it and it worked.
    – Ammar Taha
    Apr 3, 2022 at 22:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .