0

i created a new envirenment that looks the same as subfigures, then i want its label to apear on the liste of graphica like the figure enter image description here

    \documentclass{book}
\usepackage[demo]{graphicx}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage{float}
\usepackage{hyperref}
\usepackage{cleveref}
\usepackage{tocloft}

\newfloat{graphique}{tpbh}{grp}[chapter]
\newcommand{\listofgraphiquesname}{Table des graphiques}

\newcommand{\listofgraphiques}{%
  \listof{graphique}{\listofgraphiquesname}%
}

\cftsetindents{figure}{0em}{6em}% LOF 
\renewcommand\cftfigpresnum{\figurename~}
\begin{document}

\listoffigures
\listofgraphiques

\clearpage

See \cref{grp-lagraphique} or \Cref{grp-lagraphique} or \Cref{grp-lagraphique,grp-lagraphique-encore} for more information. 

\chapter{Alors\dots}

\begin{figure}
  \centering

  \includegraphics[scale=0.5]{ente}
\caption{Foo figure} \label{fig-lafigure}
\end{figure}

\begin{graphique}
  \centering

  \includegraphics[scale=0.5]{ente}
  \caption{C'est bon!}  \label{grp-lagraphique}
\end{graphique}

\chapter{Encore}

\begin{figure}
  \centering

  \includegraphics[scale=0.5]{ente}
\caption{La figure encore} \label{fig-lafigure-encore}
\end{figure}

\begin{graphique}
  \centering

  \includegraphics[scale=0.5]{ente}
  \caption{C'est bon encore!}  \label{grp-lagraphique-encore}
\end{graphique}
\end{document}
2

1 Answer 1

2

I think that usually the tocloft package (which has lots of \cft... macros) is used to change the appearance of the ToC, LoF and LoT lists. However it does not recognise any similar lists generated by the float package; it provides its own methods for providing such lists (see the manual about both of these).

However the following modification of your MWE (for which thank you) might be of some help in what I think you want to do to your "Table des graphiques".

% graphiqueprob.tex  SE 621489

\documentclass{book}

\usepackage[demo]{graphicx}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage{float}
\usepackage{hyperref}
\usepackage{cleveref}

\newfloat{graphique}{tpbh}{grp}[chapter]

\newcommand{\listofgraphiquesname}{Table des graphiques}

\newcommand{\listofgraphiques}{%
  \listof{graphique}{\listofgraphiquesname}%
}

\crefname{graphique}{graphique}{graphiques}
\Crefname{graphique}{Graphique}{Graphiques}

\usepackage{tocloft}  %% PW added
%\renewcommand\cftfigpresnum{\figurename~}%like this one
\newcommand{\cftgrppresnum}{\figurename~}
\makeatletter
\renewcommand{\@cftbsnum}{\hspace{-2.5em}\figurename~}
\renewcommand{\@cftbsnum}{\figurename~}
%\renewcommand{\@cftasnum}{\hspace{2em}}
\renewcommand{\@cftasnumb}{\hspace{2.5em}}
\makeatother
\begin{document}

\listoffigures
\listofgraphiques

\clearpage

See \cref{grp-lagraphique} or \Cref{grp-lagraphique} or \Cref{grp-lagraphique,grp-lagraphique-encore} for more information. 

\chapter{Alors\dots}

\begin{figure}
  \centering

  \includegraphics[scale=0.5]{ente}
\caption{Foo figure} \label{fig-lafigure}
\end{figure}

\begin{graphique}
  \centering

  \includegraphics[scale=0.5]{ente}
  \caption{C'est bon!}  \label{grp-lagraphique}
\end{graphique}

\chapter{Encore}

\begin{figure}
  \centering

  \includegraphics[scale=0.5]{ente}
\caption{La figure encore} \label{fig-lafigure-encore}
\end{figure}

\begin{graphique}
  \centering

  \includegraphics[scale=0.5]{ente}
  \caption{C'est bon encore!}  \label{grp-lagraphique-encore}
\end{graphique}

\end{document}

enter image description here

Please read the tocloft manual to see what I have done. It may be possible to get float and tocloft more closely aligned but not by me. I wrote tocloft but my memory and LaTeX abilities are fading fast.

2
  • It works well for the list of figures, what I want is the same label for the list of graphiques. Nov 6, 2021 at 19:40
  • 1
    @AbdelhakElfengour Then I have no idea what you want as I demonstrated what I thought you were after. Please ask a clearer question and I may, or may not, be inclined to answer. -- GOM Nov 7, 2021 at 19:30

You must log in to answer this question.

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