GeneralPlace images on single page, without text

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
DrSnuggels
Posts: 4
Joined: Sat Nov 29, 2008 9:39 pm

Place images on single page, without text

Post by DrSnuggels »

Hi!

I'm writing a paper for university using LaTeX and the KOMA-script. Throughout the paper I want to place images. I'm looking for a way that each image automatically gets the whole page, so that no text is placed above and below it.

The images are of different size, some already use the whole page. Yet, some are smaller, and it would look nice if they, too, have no text above or below them. I thought about putting all on a appropriately sized white canvas, but right now I'm letting LaTeX draw a 2pt border around each image. I'd have to do that in photoshop before putting the image on a canvas, but as the original images differ in size and resolution, I'm scaling them in LaTex, and as a result the border would get scaled, too, so the borders wouldn't look the same anymore. In addition, the caption's width is adjusted to the image width, which wouldn't work any more in this case, too.

I found no hint on the web, yet, I find it hard to formulate a search query for this problem. Maybe some guys around here have an idea.

Cheers!
Marius

Recommended reading 2024:

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

NEW: TikZ book now 40% off at Amazon.com for a short time.

phi
Posts: 577
Joined: Tue Oct 21, 2008 8:10 pm

Place images on single page, without text

Post by phi »

Hello,

one possibility is to use the float mechanism:

Code: Select all

\documentclass{scrartcl}

\usepackage{lipsum}

\makeatletter
\renewcommand*\fps@figure{p}
\@fpsep\textheight
\makeatother

\begin{document}

\lipsum[3-6]

\begin{figure}
	\lipsum[1]
\end{figure}

\begin{figure}
	\lipsum[2]
\end{figure}

\lipsum[7-10]

\end{document}
The reassignment of @fpsep is necessary to inhibit more than one float per page.

If you don't need floating figures, you can also use explicit page breaks:

Code: Select all

\clearpage\lipsum[1]\clearpage
DrSnuggels
Posts: 4
Joined: Sat Nov 29, 2008 9:39 pm

Place images on single page, without text

Post by DrSnuggels »

Hi and thanks for your fast answer. I inserted the reassignment, but when I place the figure (with the code for the modified caption and the border) somewhere inside the text

Code: Select all

\begin{figure}[htbp]
\linethickness{2pt}
	\centering%
	\Abbildung{\frame{
		\includegraphics[width=1.00\textwidth]{../Bilder/Dear-grandfather-65431936.pdf}}}%
	\caption[...]{...}
	\label{fig:Dear-grandfather-65431936}
\end{figure}
in the output it's placed somewhere in the middle of a page, with text above and below. Just a \begin{figure} without the [htbp] makes the image go to the end of the chapter, which is about 70 pages after the position it was inserted. I'd like to avoid hard page breaks and would like LaTeX to do the placing, while reserving the whole space on a page for a single figure.

Cheers!
phi
Posts: 577
Joined: Tue Oct 21, 2008 8:10 pm

Place images on single page, without text

Post by phi »

Try to decrease \floatpagefraction:

Code: Select all

\documentclass{scrartcl}

\usepackage{lipsum}

\renewcommand\floatpagefraction{0.1}

\makeatletter
\renewcommand*\fps@figure{p}
\@fpsep\textheight
\makeatother

\begin{document}

\lipsum[10-40]

\begin{figure}
	\lipsum[1]
\end{figure}

\lipsum[50-80]

\begin{figure}
	\lipsum[2]
\end{figure}

\lipsum[90-120]

\end{document}
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Place images on single page, without text

Post by localghost »

Try a slight modification of the code that phi suggested.

Code: Select all

\makeatletter
\renewcommand*\fps@figure{!p}
\@fpsep\textheight
\makeatother
If that alone doesn't help, add the \clearpage (or \cleardoublepage) command right after every float environment to force its output.


Best regards and welcome to the board
Thorsten¹
DrSnuggels
Posts: 4
Joined: Sat Nov 29, 2008 9:39 pm

Place images on single page, without text

Post by DrSnuggels »

Hi and thanks for your VERY fast answers, what a coll place. That comes close to real-time support. 8-)

I did the modification, and inserted it after the last \usepackage (so it won't get redefined accidently). Inserting a \clearpage after the figure helps, but only for half of the problem

screenshot: Image

I tried several variations of the [htbp], also completely without, but the text always flows until it hits the image. Putting a \clearpage before it is nasty, then the pagebreak comes exactly there, no matter how much text is on the page before the picture-page.

For completeness, here's my list of packages and definitions, maybe that's of relevance:

Code: Select all

\documentclass[a4paper,12pt,footsepline,plainfootsepline,footinclude,titlepage,oneside,pointlessnumbers,noappendixprefix]{scrbook}

%% Standardpakete
\usepackage{amsmath}%
\usepackage{amsfonts}%
\usepackage{amssymb}%
\usepackage{graphicx}
\usepackage[ngerman]{babel}		
\usepackage[T1]{fontenc}							
\usepackage[latin1]{inputenc}
\usepackage{lipsum}
\usepackage{ifthen}
\usepackage{apager}
\usepackage{scrpage2}
\usepackage{tocloft}

% Hurenkinder und Schusterjungen vermeiden
\clubpenalty = 10000
\widowpenalty = 10000 
\displaywidowpenalty = 10000
\hbadness = 10000
\setlength{\emergencystretch}{3em}

% Warnungen für underfull boxes deaktivieren
\hbadness = 10000

% Schmerzgrenze für die Vermeidung von overfull boxes erweitern
\setlength{\emergencystretch}{3em}

% Überschriftengröße
\setkomafont{section}{\LARGE}
\setkomafont{subsection}{\Large}
\setkomafont{subsubsection}{\large}

\renewcommand*{\chapterheadstartvskip}{\vspace*{5.5\baselineskip}}


% TOC
\setcounter{tocdepth}{3}
\renewcommand{\cftchapfont}{ \bfseries \large}
\renewcommand{\cftsecfont}{ \bfseries }

% Bildtextformatierung
\addtokomafont{caption}{\small}
\renewcommand*{\figureformat}{(\thefigure)}
\newlength{\Abbildungsbreite}
\newcommand{\Abbildung}[1]{%
\settowidth{\Abbildungsbreite}{#1}%
\setcapwidth[c]{\Abbildungsbreite}%
#1%
}

\usepackage{url}
\makeatletter 
\def\url@leostyle{%
\@ifundefined{selectfont}{\def\UrlFont{\sf}}{\def\UrlFont{\small\ttfamily}}} 
\makeatother 
\urlstyle{leo}

\usepackage{array}
\usepackage{soul}
\usepackage{enumerate}

\makeatletter
\renewcommand*\fps@figure{!p}
\@fpsep\textheight
\makeatother
phi
Posts: 577
Joined: Tue Oct 21, 2008 8:10 pm

Place images on single page, without text

Post by phi »

If you want to use localghost's or my code, you have to leave out the float placement specifications like [htpb] everywhere. \renewcommand*\fps@figure{!p} basically means that all floats are placed on float pages and that parameters like \topfraction are ignored by default. If you supply an explicit placement specification, this default simply gets overridden. Furthermore, if you don't want explicit page breaks, then don't use \clearpage. Anyway, have you tried my second suggestion? This works at least for my example document, while localghost's suggestion unfortunately doesn't work.
DrSnuggels
Posts: 4
Joined: Sat Nov 29, 2008 9:39 pm

Re: Place images on single page, without text

Post by DrSnuggels »

Great, now it works! Thanks a lot!

When I tried localghosts' suggestion, I accidentaly over-pasted the \renewcommand\floatpagefraction{0.1}-part in my header, which gave me quite a lot of unsuccessful runs--until I noticed.

Thanks again for the fast and efficient support!
Marius
Post Reply