Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

In my large latex document, I have some figures which take a considerable height of the page (80-95%). Latex puts each of these figures alone on a page, aligned on top. I would like to have each figure aligned vertically to center. Is that possible, and if so, how? :)

share|improve this question
    
As the answers tell, centering is the usual behavior; however it's the whole block (figure and caption) that's vertically centered. –  egreg Sep 10 '11 at 21:25

2 Answers 2

up vote 9 down vote accepted

I'm curious which documentclass you're using, as "normal" behavior (as defined in the LaTeX kernel file latex.ltx) is to center the float vertically on a floats-only page.

If you need to get the float to be centered on a floats-only page, you should add the following instructions to your preamble.

\makeatletter
\setlength{\@fptop}{0pt plus 1fil}
\setlength{\@fpbot}{0pt plus 1fil}
\makeatletter

To have the figure/table be aligned at the top, you would delete the plus 1fil after 0pt in the instruction setting the length of the \@fptop variable.

By default, LaTeX will place a large float on a page by itself if the float's height exceeds 50% of the parameter \textheight. To change this threshold to, say, 0.75, you should issue the command \renewcommand\floatpagefraction{0.75}. Happy TeXing!

share|improve this answer
    
This does not answer the OP's question, in my opinion, he/she is only interested in a vertical centered solution (not top-aligned) and there was no mention of horizontal centering. –  Werner Sep 10 '11 at 21:06
    
@Werner -- Yes, I initially misread the question, and have revised it since then. :-) –  Mico Sep 10 '11 at 21:13

The [p] float placement specifier puts the float (figure or table) on a page of its own, vertically centered. The following MWE illustrates that:

\documentclass{article}
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\begin{document}
\lipsum[1-2]
\begin{figure}[p]
  \centering\rule{0.8\linewidth}{0.5\textheight}
  \caption{A big figure}
\end{figure}
\lipsum[3-10]
\end{document}

Vertically centered image on a page

Note that by specifying the optional [p] parameter to your float, only that float will appear on the corresponding page.

share|improve this answer
    
I think the OP's issue is that his/her floats on floats-only pages are aligned along the page's top margin instead of being centered vertically. This must be happening because he/she is using a document class or some package that overrides LaTeX's default setup of centering the float vertically on a floats-only page. Will using the [p] placement specification solve this lack-of-vertical-centering issue? –  Mico Sep 10 '11 at 23:41
    
@Mico: It may if they still include the figure inside a designated float, since they abide by the regular optional parameter for placement convention. However, if the documentclass provides a new environment (not a float), then neither of our solutions will do the trick; your's hooks on float-related spacing. –  Werner Sep 11 '11 at 8:13
    
I'm using "book" documentclass, with a lot of packages, most of them are recommended by our print service. Indeed, after your pointer (fptop) I started looking, and yes, there it was --- forcing top alignment. –  Nikola Knezevic Sep 11 '11 at 12:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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