0

I have a large tikz flow diagram that spans multiple pages. I broke it up into an 'a' and 'b' figure. It would be nice if the caption would state 'Figure 1a:' and 'Figure 1b:' automatically (instead of just 'Figure 1:' for both). Also, I would like the references in the text to work automatically as well (as 1a and 1b without have to state 'a' and 'b' explicitly as I did below). I have tried the subfigure and subcaption packages but to no avail. Each should have 1 unique caption. Here is a MWE.

\documentclass{report}
\usepackage{caption,tikz}
\begin{document}

Would like this to automatically be listed as
Figures~\ref{fig1a}a and~\ref{fig1b}b in text and caption.

\begin{figure}
  \begin{tikzpicture}
    \draw (0, 0) -- (10,  0) -- (10,-12) -- (0,-12) -- (0,0);
    \draw (0, 0) -- (10,-12);
    \draw (10,0) -- ( 0,-12);
  \end{tikzpicture}
  \caption{Figure 1a}
  \label{fig1a}
\end{figure}

\begin{figure}
  \ContinuedFloat
  \begin{tikzpicture}
    \draw (0, 0) -- (10,  0) -- (10,-12) -- (0,-12) -- (0,0);
    \draw (0, 0) -- (10,-12);
    \draw (10,0) -- ( 0,-12);
  \end{tikzpicture}
  \caption{Figure 1b}
  \label{fig1b}
\end{figure}

\end{document}

A second question, probably should be a separate question, what should I be using: figure, caption, subfigure, or subcaption? I have read on other threads that all but subcaption are deprecated, but when I use subcaption with the required document class (not included), I get the following.

Package caption Warning: Unsupported document class (or package) detected, (caption) usage of the caption package is not recommended. See the caption package documentation for explanation.

Does my document class need too be updated? Can anyone clear this up? Thanks in advance.

4
  • Which problem are you referring to @Zarko? I assume the warning, but how is that related to graphics.sty?
    – Lopes8070
    Dec 2, 2019 at 16:48
  • Ups, i misread your example, sorry. Anyway, I can't reproduce your problem,
    – Zarko
    Dec 2, 2019 at 16:58
  • If I correctly understood your question, than it is duplicate to tex.stackexchange.com/questions/278727/…
    – Zarko
    Dec 3, 2019 at 13:49
  • @Zerko, that's not exactly what I would like. The solution in that link has a caption for the first 2 subfigures and a subcaption for each, plus a caption for the second two subfigures and a caption for that two. I would like 1 caption for the first 'subfigure' on the first page (labeled as Fig 1a), and a caption for the second subfigure on the second page (labeled as Fig. 1b). If I use the solution there, I get one figure on the first page labeled only as (a) and the second figure labeled as (b). If I turn the subcaptions into captions, they are both 1, and 1 only.
    – Lopes8070
    Dec 3, 2019 at 14:47

1 Answer 1

0

Note that the a and b are already in the labels.

\documentclass{report}
\usepackage{caption,tikz}
\begin{document}

Would like this to automatically be listed as
Figures~\ref{fig1a} and~\ref{fig1b} in text and caption.

\begin{figure}
  \begin{tikzpicture}
    \draw (0, 0) -- (10,  0) -- (10,-12) -- (0,-12) -- (0,0);
    \draw (0, 0) -- (10,-12);
    \draw (10,0) -- ( 0,-12);
  \end{tikzpicture}
  \def\thefigure{\arabic{figure}a}
  \caption{Figure 1a}
  \label{fig1a}
\end{figure}

\begin{figure}
  \ContinuedFloat
  \begin{tikzpicture}
    \draw (0, 0) -- (10,  0) -- (10,-12) -- (0,-12) -- (0,0);
    \draw (0, 0) -- (10,-12);
    \draw (10,0) -- ( 0,-12);
  \end{tikzpicture}
  \def\thefigure{\arabic{figure}b}
  \caption{Figure 1b}
  \label{fig1b}
\end{figure}

\end{document}
2
  • Yes but because of the \ContinuedFloat, they are both references at Fig.1
    – Lopes8070
    Dec 2, 2019 at 19:40
  • I only just now noticed the '\def\thefigure' line. That worked perfectly!
    – Lopes8070
    Dec 3, 2019 at 14:49

You must log in to answer this question.

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