3

I am writing a dissertation. The images I have are varying between charts and regular images. I want them to be listed under :

Table des figures and Tables des graphiques.

I can only make one using figure, how can I generate the second?

12
  • 2
    Have you looked into the float package and its \newfloat mechanism for creating new floats? – Mico Apr 13 '17 at 10:14
  • 2
    @ChristianHupfer -- No! Do keep your answer. It's just fine. In fact, I just upvoted it. :-) – Mico Apr 13 '17 at 14:55
  • 2
    @Mico: Ok, thanks, but that was not the purpose of my comment... :D – user31729 Apr 13 '17 at 14:59
  • 1
    @ChristianHupfer - I know. [Get the Star Wars reference? :-) ] – Mico Apr 13 '17 at 16:11
  • 1
    @ChristianHupfer - Hint: What does Han Solo say to Princess Leia after she says that she loves him? (Ok, I can already here you groan...) – Mico Apr 14 '17 at 2:27
5

Using the float package and its \newfloat command it is possible to add new floating environments such as graphique, which defines a new counter of the same name then.

I've chosen the grp extension for the relevant List of... file and the counter should be reset within chapter, for example.

The \listofgraphiques is a wrapper command for \listof{graphique}{Some title}.

Additionally, some \crefname statements are used, just in case they are needed.

\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}

\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

With Graphique in caps:

\documentclass{book}

\usepackage[demo]{graphicx}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage{float}
\usepackage{caption}
\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}


\DeclareCaptionLabelFormat{graph}{#1~#2}
\captionsetup[graphique]{name={Graphique},labelformat=graph}


\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

4
  • 1
    As you can guess from my post: My knowledge of French language is legendary ;-) – user31729 Apr 13 '17 at 14:38
  • Thank you so much! I got it ! I just have a minor issue, in the caption, the word graphique starts with small caps, while I want it to be like Graphique, how can do that ? Thanks! – user105139 Apr 14 '17 at 9:06
  • 1
    @user105139: See the update please – user31729 Apr 14 '17 at 10:14
  • @user105139: There is a 'gray' hook' at the left side of my answer, at the top, click on it and it should turn into a green hook. See also tex.stackexchange.com/help/someone-answers – user31729 Apr 17 '17 at 15:56
3

Instead of package float (see Christian's answer) you can use package newfloat. It's part of the caption bundle and has a very easy understandable command \DeclareFloatingEnvironment to declare new floats.

\documentclass{book}

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

\newcommand{\listofgraphiquesname}{List of Graphics}
\addto\captionsfrench{% Switch name by language
  \def\listofgraphiquesname{Table des graphiques}%
}
\DeclareFloatingEnvironment[%
  fileext=grp,
  listname=\listofgraphiquesname,
  name=Graphique,
  placement=tpbh,
  within=chapter,
  chapterlistsgaps=on
]{graphique}

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

\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}

If you have a single language document, you even don't need to define \listofgraphiquesname but can simply use listname={List of Graphics}. I've added it to show how language dependent definitions could be done.


The KOMA-Script bundle provides a package tocbasic that provides \DeclareNewTOC. The command is similar to newfloat's \DeclareFloatEnvironment but provides additional features to configure the list entries. And the package loads KOMA-Script package scrbase, that provides an alternative interface to make language depending names:

\documentclass{book}

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

% Define language depending names using scrbase
\newcommand*{\listofgraphiquesname}{List of Graphics}
\newcaptionname{french}{\listofgraphiquesname}{Table des graphiques}
\newcommand*{\graphiquename}{Graphic}
\newcaptionname{french}{\graphiquename}{Graphique}
\DeclareNewTOC[%
  type=graphique,
  name=\graphiquename,
  float,
  floatpos=tpbh,
  counterwithin=chapter,
  listname=\listofgraphiquesname,
  tocentrynumwidth=2.3em,% hanging indent of the entries to the list of …
  tocentryindent=1.5em,% indent of entries to the list of …
]{gpo}

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

\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}

As you can see, these package does not need to use a KOMA-Script class but also work with several other classes like the standard book class.

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.