Graphics, Figures & TablesSubfig-ContinuedFloat-Wrapfigure problem

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Tobias_Denmark
Posts: 18
Joined: Sun Jun 06, 2010 1:59 pm

Subfig-ContinuedFloat-Wrapfigure problem

Post by Tobias_Denmark »

Hello every one.. Hope you can help with my problem..

I'm creating a report where several figures are presented.

One place are 6 figures place like this using continuedfloat and subfig:

2X1 one page with caption (a),(b) and fig:1
2X2 next page with caption (c),(d),(e) and (f) and fig:1

Now I want a wrapfigure placed on the next page like this:

1X3 on one page and caption (a),(b) and (c) and fig:2..

But the letters are (g),(h) and (i) and fig:2!!!

So figure number is correct, but letters are not!!!

What to do?
Binder1.pdf
TEXT PAGE
(223.41 KiB) Downloaded 403 times

Code: Select all

\documentclass[a4paper,10pt,twoside]{report}
%
%----------------------- start of the preamble ------------------
%
\usepackage{graphicx}					
\usepackage[T1]{fontenc}
\usepackage{float}										
\usepackage[english]{babel}							
\usepackage[small,bf]{caption}						
\usepackage{wrapfig}
\usepackage{subfig}	

\begin{document}
%
\begin{figure}[H]
  \centering
  \subfloat[$Z_{p2} N1$]{\includegraphics[width=0.5\textwidth]{5_Constrains/Figures/a/Figure_Cumsum_Acoustic_N1.png}}
  \subfloat[$Z_{s2} N1$]{\includegraphics[width=0.5\textwidth]{5_Constrains/Figures/a/Figure_Cumsum_Shear_N1.png}}
  \caption{TEXT1.}
  \label{fig:known_Impedance}
\end{figure}
%
\newpage
%
\begin{figure}[H]
  \ContinuedFloat
  \centering
  \subfloat[$Z_{p2} N2$]{\includegraphics[width=0.5\textwidth]{5_Constrains/Figures/a/Figure_Cumsum_Acoustic_N2.png}}
  \subfloat[$Z_{s2} N2$]{\includegraphics[width=0.5\textwidth]{5_Constrains/Figures/a/Figure_Cumsum_Shear_N2.png}}\\
  \subfloat[$Z_{p2} N3$]{\includegraphics[width=0.5\textwidth]{5_Constrains/Figures/a/Figure_Cumsum_Acoustic_N3.png}}
  \subfloat[$Z_{s2} N3$]{\includegraphics[width=0.5\textwidth]{5_Constrains/Figures/a/Figure_Cumsum_Shear_N3.png}}
  \caption{TEXT2.}
  \label{fig:known_Impedance2}
\end{figure}
%
TEXT
%
\newpage
%
\begin{wrapfigure}{i}{0.5\textwidth}
  \vspace{-20pt}
  \centering
  \subfloat[$v_{p2}$]{\includegraphics[width=0.5\textwidth]{5_Constrains/Figures/c/Figure_Omre_known_vp2_N2.png}}\\
  \subfloat[$v_{s2}$]{\includegraphics[width=0.5\textwidth]{5_Constrains/Figures/c/Figure_Omre_known_vs2_N2.png}}\\
  \subfloat[$\rho_2$]{\includegraphics[width=0.5\textwidth]{5_Constrains/Figures/c/Figure_Omre_known_rho2_N2.png}}
  \vspace{-5pt}
  \caption{TEXT3}
  \label{fig:Omre_known_n2_elastic}
  \vspace{-80pt}
\end{wrapfigure}
%
\end{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
sommerfee
Posts: 503
Joined: Mon Apr 09, 2007 4:20 pm

Re: Subfig-ContinuedFloat-Wrapfigure problem

Post by sommerfee »

This is a (known) bug of the subfig package and one of the many reasons why I wrote a replacement for the subfig package on my own - the subcaption package which is part of my caption package bundle.

So if you replace \usepackage{subfig} with \usepackage{subcaption} the sub-captions should be labeled correct.

Axel
Tobias_Denmark
Posts: 18
Joined: Sun Jun 06, 2010 1:59 pm

Subfig-ContinuedFloat-Wrapfigure problem

Post by Tobias_Denmark »

Okay, thank you....

Have tried to use the package and getting this result:

Code: Select all

\documentclass[12pt]{article}
\usepackage{caption}
\usepackage[skip=0.5cm]{subcaption}

\begin{document}

\begin{figure}
  \begin{subfigure}{.49\linewidth}
    \centering
    \rule{5cm}{5cm}
    \caption{First subfigure}\label{fig:suba}
  \end{subfigure}
  \begin{subfigure}{.49\linewidth}
    \centering
    \rule{5cm}{5cm}
    \caption{Second subfigure}\label{fig:subb}
  \end{subfigure}

\begin{subfigure}{.49\linewidth}
    \centering
    \rule{5cm}{5cm}
    \caption{Third subfigure}\label{fig:subc}
  \end{subfigure}
  \begin{subfigure}{.49\linewidth}
    \centering
    \rule{5cm}{5cm}
    \caption{Third subfigure}\label{fig:subd}
  \end{subfigure}

  \caption{A figure with three subfigures}\label{fig:test figure}
\end{figure}

\end{document}
But now the problem is the spacing inbetween the top and bottom figure.. It is to small.


What can i do to change it?
User avatar
sommerfee
Posts: 503
Joined: Mon Apr 09, 2007 4:20 pm

Subfig-ContinuedFloat-Wrapfigure problem

Post by sommerfee »

Tobias_Denmark wrote:\begin{subfigure}{.49\linewidth}
No need to change your code using the subfigure environment, you can keep using \subfloat (or use \subcaptionbox instead which is basically the same as \subfloat) when using the subcaption package.
But now the problem is the spacing inbetween the top and bottom figure.. It is to small.
As opposite to the subfig package the subcaption package does not insert (or remove) any extra space (yet). So if you want some space vertical between those figures, you have to create it for yourself, e.g. with \vspace{0.5in}, \smallskip, \medskip, \bigskip, or something similar.

(The floatrow package offers more features.)

Code: Select all

\documentclass[a4paper,10pt,twoside]{report}
%
%----------------------- start of the preamble ------------------
%
\usepackage[demo]{graphicx}               
\usepackage[T1]{fontenc}
\usepackage{float}                              
\usepackage[english]{babel}                     
\usepackage[small,bf]{caption}                  
\usepackage{wrapfig}
\usepackage{subcaption}   

\begin{document}
%
\begin{figure}[H]
  \centering
  \subfloat[$Z_{p2} N1$]{\includegraphics[width=0.5\textwidth]{5_Constrains/Figures/a/Figure_Cumsum_Acoustic_N1.png}}%
  \subfloat[$Z_{s2} N1$]{\includegraphics[width=0.5\textwidth]{5_Constrains/Figures/a/Figure_Cumsum_Shear_N1.png}}
  \caption{TEXT1.}
  \label{fig:known_Impedance}
\end{figure}
%
\newpage
%
\begin{figure}[H]
  \ContinuedFloat
  \centering
  \subfloat[$Z_{p2} N2$]{\includegraphics[width=0.5\textwidth]{5_Constrains/Figures/a/Figure_Cumsum_Acoustic_N2.png}}%
  \subfloat[$Z_{s2} N2$]{\includegraphics[width=0.5\textwidth]{5_Constrains/Figures/a/Figure_Cumsum_Shear_N2.png}}
  \par\medskip
  \subfloat[$Z_{p2} N3$]{\includegraphics[width=0.5\textwidth]{5_Constrains/Figures/a/Figure_Cumsum_Acoustic_N3.png}}%
  \subfloat[$Z_{s2} N3$]{\includegraphics[width=0.5\textwidth]{5_Constrains/Figures/a/Figure_Cumsum_Shear_N3.png}}
  \caption{TEXT2.}
  \label{fig:known_Impedance2}
\end{figure}
%
TEXT
%
\newpage
%
\begin{wrapfigure}{i}{0.5\textwidth}
  \vspace{-20pt}
  \centering
  \subfloat[$v_{p2}$]{\includegraphics[width=0.5\textwidth]{5_Constrains/Figures/c/Figure_Omre_known_vp2_N2.png}}
  \par\medskip
  \subfloat[$v_{s2}$]{\includegraphics[width=0.5\textwidth]{5_Constrains/Figures/c/Figure_Omre_known_vs2_N2.png}}
  \par\medskip
  \subfloat[$\rho_2$]{\includegraphics[width=0.5\textwidth]{5_Constrains/Figures/c/Figure_Omre_known_rho2_N2.png}}
  \vspace{-5pt}
  \caption{TEXT3}
  \label{fig:Omre_known_n2_elastic}
  \vspace{-80pt}
\end{wrapfigure}
%
\end{document}
HTH,
Axel
Tobias_Denmark
Posts: 18
Joined: Sun Jun 06, 2010 1:59 pm

Re: Subfig-ContinuedFloat-Wrapfigure problem

Post by Tobias_Denmark »

8-)

Thanks you Axel..

All in order now..

/Tobias
Post Reply