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}
  • As I said, please select Complete source (in the source pane, where it says current paragraph) and copy everything from \documentclass to \end{document}, i.e. the whole thing. – Torbjørn T. Apr 7 '16 at 15:07
  • @ Torbjørn T. sorry – Ahmed M. Hasan Apr 7 '16 at 15:10
  • Hm, your code works fine here, I get Figure 1 twice, with subfigures a,b,c,d. I don't know if this could be the cause, but it could be that you have an older version of a package. Have you got MikTeX installed? If so, find the MikTeX Update manager (see How do I update my TeX distribution?) and use that to update your TeX system. – Torbjørn T. Apr 7 '16 at 15:27
  • @ Torbjørn T. I updated the MikTeX and solved the problem. You were absolutely right relating the problem to update MikTeX. It is really appreciated. – Ahmed M. Hasan Apr 7 '16 at 16:45
  • Good to hear it worked! – Torbjørn T. Apr 7 '16 at 16:50
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

  • The order of the subfoats are correct, however, the order of the floats are way around. – Ahmed M. Hasan Apr 7 '16 at 12:23
  • I need on figure number for all subflaots. – Ahmed M. Hasan Apr 7 '16 at 12:25
  • Have you experienced this issue? – Ahmed M. Hasan Apr 7 '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 7 '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 7 '16 at 13:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.