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?
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?
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}
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}
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.
floatpackage and its\newfloatmechanism for creating new floats? – Mico Apr 13 '17 at 10:14floatetc. I can remove my answer if you want to provide a solution of your own. – Apr 13 '17 at 14:28