Graphics, Figures & Tables ⇒ Keeping all the figures within a chapter
-
- Posts: 29
- Joined: Thu Feb 19, 2009 3:23 pm
Keeping all the figures within a chapter
What's the best way to force LaTex to keep all of the images together, then start the next chapter on a new page?
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
Keeping all the figures within a chapter
You could divide your thesis into several files, each containing a chapter, and then in the main file (that you compile) use the \include command. This command starts on a new page and all your images are kept together.
Example:
Code: Select all
\documentclass{article}
%this is the preamble with your options
\begin{document}
\include{chap1} %chapter with text
\include{chap2} %chapter with text and images
\include{chap3} %chapter with text
\end{document}
Lucia
-
- Posts: 29
- Joined: Thu Feb 19, 2009 3:23 pm
Re: Keeping all the figures within a chapter
The chapters are already split up in the manner in which you describe. I've tried messing around with \clearpage but it didn't seem to have any effect.
Should splitting them into chapters avoid this problem? I'm not sure how to construct a MWE for this problem.
Thanks,
Amanda
Keeping all the figures within a chapter
But why are you using \clearpage? The command \include is internally defined to use the \clearpage command, so you don't need to use it again. Actually, the \include command is defined as
Code: Select all
\clearpage \input{file} \clearpage
-
- Posts: 29
- Joined: Thu Feb 19, 2009 3:23 pm
Re: Keeping all the figures within a chapter
I read somewhere (can't recall where now) that \clearpage would force LaTex to dump the rest of the figures at the end of the chapter, if they didn't fit on any of the previous pages.
I've split the offending chapter into two chapters and now it doesn't happen. But what I was getting before was a few lines of chapter 6, then a figure from chapter 5, for the first 4 or 5 pages of chapter 6. The figure numbers were right, they were just displayed in the wrong place.
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Keeping all the figures within a chapter
That is wrong. The \clearpage command forces the output of all floats declared at this point. Hence the \include command for the next chapter should have this effect.arwintcher wrote:[...] I read somewhere (can't recall where now) that \clearpage would force LaTex to dump the rest of the figures at the end of the chapter, if they didn't fit on any of the previous pages. [...]
Just declare your floats at the end of each chapter. The key for float placement is the list of optional parameters. You may give the parameter [!p] to place them on a special float page without any text.
Best regards
Thorsten¹
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: Keeping all the figures within a chapter
Following this query, I've a closely related one.
Given that the CTABLE and ENDFLOAT packages are incompatible, I've desisted from using ENDFLOAT (as I want my figs and tables at the end of my thesis)
Now, I was thinking of a workaround for putting my figs and tables at the end of every CHAPTER.
How? I was thinking of using FloatBarrier command from PLACEINS package (inserted at the end of every Chapter), redefining the floating-related parameters (see below), and using placement options [tbp]. So, as in TEXT pages I'm setting bottomnumber, topnumber and totalnumber =0, and topfraction and bottomfractions too small to be able to contain any float, I'm forcing LaTeX to put all my unprocessed Floats at the end of every Chapter as that's where I put my \FloatBarrier commands.
Thxs vm, but I've spent hours and hours trying to make ENDFLOAT work with CTABLES, but .....
Does anyone know of another possible solution to what I'm trying to achieve?
Maybe it'd be better to use normal TABLE environment instead of CTABLES and use ENDFLOAT .....
Thxs vm in advance
Jose
\renewcommand{\topfraction}{0.1}
\renewcommand{\bottomfraction}{0.1}
% Parameters for TEXT pages (not float pages):
\setcounter{topnumber}{0}
\setcounter{bottomnumber}{0}
\setcounter{totalnumber}{0}
\renewcommand{\textfraction}{0.07}
% Parameters for FLOAT pages (not text pages):
\renewcommand{\floatpagefraction}{0.7}
% N.B.: floatpagefraction MUST be less than topfraction !!