2

I have got a float:figure including 6 subfloat:figures in LYX. How can I use \ContinuedFloat command in LYX to get the figure showing onto two pages?enter image description here

% Preview source code

%% LyX 2.1.4 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{float}
\usepackage{graphicx}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.


\usepackage{lmodern,mathpazo}
\usepackage[T1]{fontenc}
\usepackage[babel=true]{microtype}
\usepackage{subfig,float}

\@ifundefined{showcaptionsetup}{}{%
 \PassOptionsToPackage{caption=false}{subfig}}
\usepackage{subfig}
\makeatother

\usepackage{babel}
\begin{document}
\begin{figure}[H]
\noindent \begin{centering}
\subfloat[S=0kPa]{\noindent \centering{}\includegraphics[scale=0.88]{\string"../figures/Chapter5/PDF/Al-Sharrad 2013 Anisotropic\string".pdf}}
\par\end{centering}

\noindent \begin{centering}
\subfloat[S=110kPa]{\noindent \centering{}\includegraphics[scale=0.88]{\string"../figures/Chapter5/PDF/Al-Sharrad 2013 Anisotropic\string".pdf}}
\par\end{centering}

\noindent \centering{}\caption{Bender element test results for sample prepared by anisotropic static
compaction in a triaxial cell.\label{fig:-11}}
\end{figure}


\begin{figure}[H]
\noindent \begin{centering}
\ContinuedFloat
\par\end{centering}

\noindent \begin{centering}
\subfloat[S=300kPa\label{fig:-11-1-1}]{\noindent \centering{}\includegraphics[scale=0.88]{\string"../figures/Chapter5/PDF/Al-Sharrad 2013 Anisotropic\string".pdf}}
\par\end{centering}

\noindent \begin{centering}
\subfloat[S=600kPa]{\noindent \centering{}\includegraphics[scale=0.88]{\string"../figures/Chapter5/PDF/Al-Sharrad 2013 Anisotropic\string".pdf}}
\par\end{centering}

\noindent \centering{}\caption{Bender element test results for sample prepared by anisotropic static
compaction in a triaxial cell.\label{fig:-11-4}}
\end{figure}

\end{document}
Torbjørn T.
  • 206,688

1 Answers1

2

You need to make a second float:figure, and move some of the subfloats to this one. In the second figure float, insert a TeX Code box (Ctrl + L) at the top and write \ContinuedFloat in this.

You need to load the caption package as well for this, so if that isn't already loaded either by LyX or yourself, go to Document --> Settings --> LaTeX Preamble and add \usepackage{caption}.

Note that in older versions of the caption package there was a bug that caused the numbering of the figures to be wrong. If you experience this, update your TeX distribution.

Screenshot of appearance in LyX and PDF:

enter image description here

Torbjørn T.
  • 206,688
  • The order of the subfoats are correct, however, the order of the floats are way around. – Ahmed M. Hasan Apr 07 '16 at 12:23
  • I need on figure number for all subflaots. – Ahmed M. Hasan Apr 07 '16 at 12:25
  • Have you experienced this issue? – Ahmed M. Hasan Apr 07 '16 at 12:27
  • @AhmedM.Hasan What do you mean by the 'order of the floats are way around'? When I do what I described with just one subfigure in each figure, I get a subfigure numbered (a) in the first figure, and one numbered (b) in the second. Both figures are numbered 1 (or 1.1, depending on documentclass). – Torbjørn T. Apr 07 '16 at 12:33
  • I did the same you did but still get order wrong for figures, Figure:2 for first group of floats and Figure:1 for the second groups of floats. I could not upload a screenshot. How you do that please? – Ahmed M. Hasan Apr 07 '16 at 13:23
  • @AhmedM.Hasan Edit your question and use the button there for uploading images. Then remove the ! just before the image. That said, a screenshot may not be that helpful. Instead, can you make the smallest document possible that demonstrates the problem (ideally just two figures with one subfigure in each), export the LaTeX code with File --> Export --> LaTeX, and add that code to the question? – Torbjørn T. Apr 07 '16 at 13:28
  • @ Torbjørn T. Just have a look at the screenshot I uploaded, please. – Ahmed M. Hasan Apr 07 '16 at 13:37
  • @AhmedM.Hasan Doesn't really help for figuring out what's wrong, can you add the code as well? Either by exporting, or by opening the source pane (View --> Source pane, select Complete source) and copying everything from \documentclass to \end{document}. – Torbjørn T. Apr 07 '16 at 13:40
  • @AhmedM.Hasan I just remembered having seen something like this before. It could be caused by the hyperref package (see e.g. http://latex-community.org/forum/viewtopic.php?p=85622&sid=7e71a6c6989f3e23e4b779e9a019c794#p85622). – Torbjørn T. Apr 07 '16 at 13:52
  • @ Torbjørn T. I have added the code to my question – Ahmed M. Hasan Apr 07 '16 at 14:52