1

I would like to add 2 types of figures in my document (with different counters)

  1. Figures
  2. Plates (if general, would be possible to differentiate between B&W, Color plates...)

I don't understand which environment I have to customize (figures? refs? labels?).

Reason: All drawings should be named fig. XX and are in the text. Photos should be placed at the end and referenced as pl. XX. [For curiosity] it would be nice to distinguish B&W photos pl. XX from color c. pl. XX.

An example of rendered text could be:

From the diagram (fig. 1, p. 1), the X-Ray imagery (pl. 1, p. 32)
or the colored tomography (c. pl. 1, p. 104), we deduce that ....

fig. 1, pl. 1 and c. pl. 1 are three different images included with

\begin{figure}
\includegraphics[width=10mm]{fig_1}
\label{fig_1}
\end{figure}

\begin{figure} \includegraphics[width=10mm]{pl_1} \label{pl_1} \end{figure}

\begin{figure} \includegraphics[width=10mm]{c_pl_1} \label{c_pl_1} \end{figure}

I use xelatex and the packages varioref, hyperref, cleveref in this order (as specified in cleverref manual, 12.1, p. 23). My document use different languages (English, French, German) but all the references should be "fig/pl." (i.e. no translation into "Abb.").

nebi
  • 782
  • 1
    Your labels won't do what you intend them to do without a \caption, correct would be \caption{<text>\label{fig_1}} for example. – Skillmon Sep 17 '20 at 09:19
  • Let me make sure I understand your objectives: (a) you want to create a new float type called, say, plate, and the plate counter should be separate from and independent of the figure counter. (b) The plate float type may need to consist of two subtypes, one for B&W images, the other for color images. (c) Cross-references to these objects should use the prefixes fig. and pl., repectively. Please advise if I missed something. – Mico Sep 17 '20 at 09:20
  • @Mico 3 independent different types – nebi Sep 17 '20 at 10:18

1 Answers1

3

As you want separate and independent counters for figures and two types of "plates", I think you should employ the machinery of the newfloat package to create two new floating environments, called (say) bwplate and clrplate. Then, use \crefname directives to inform cleveref which prefix labels to use when running \cref.

enter image description here

\documentclass[11pt]{scrartcl}
\usepackage[ngerman,french,english]{babel}
\usepackage[a4paper,vmargin=1cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[demo]{graphicx} % remove 'demo' option in real doc.

\usepackage{newfloat} % for '\DeclareFloatingEnvironment' macro \usepackage{varioref} \usepackage[colorlinks,allcolors=blue]{hyperref} \usepackage[nameinlink]{cleveref}

\DeclareFloatingEnvironment[name=Plate]{bwplate} % or 'name=B&amp;W Plate' %% declare labels for use with \cref: \crefname{bwplate}{b&amp;w pl.}{b&amp;w pls.} \Crefname{bwplate}{B&amp;W Plate}{B&amp;W Plates}

\DeclareFloatingEnvironment[name=Color Plate]{clrplate} %% declare labels for use with \cref: \crefname{clrplate}{clr. pl.}{clr. pls.} \Crefname{clrplate}{Color Plate}{Color Plates}

\begin{document}

Cross-references to \cref{fig:1,pl:1,cpl:1,pl:2,cpl:2}.

\Cref{fig:1}. \Cref{pl:1,pl:2}. \Cref{cpl:1,cpl:2}.

\begin{figure}[h!] \centering \includegraphics[width=0.4\textwidth]{fig_1} \caption{A graphic}\label{fig:1} \end{figure} \begin{bwplate}[h!] \centering \includegraphics[width=0.4\textwidth]{pl_1} \caption{A first B&amp;W image}\label{pl:1} \end{bwplate} \begin{clrplate}[h!] \centering \includegraphics[width=0.4\textwidth]{c_pl_1} \caption{A first color image}\label{cpl:1} \end{clrplate} \begin{bwplate}[h!] \centering \includegraphics[width=0.4\textwidth]{pl_2} \caption{A second B&amp;W image}\label{pl:2} \end{bwplate} \begin{clrplate}[h!] \centering \includegraphics[width=0.4\textwidth]{c_pl_2} \caption{A second color image}\label{cpl:2} \end{clrplate}

\end{document}

Mico
  • 506,678