Graphics, Figures & TablesFigure is not centered on a different-sized page

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
guvenarkilic
Posts: 3
Joined: Sat Apr 30, 2011 3:37 pm

Figure is not centered on a different-sized page

Post by guvenarkilic »

Dear All,

In my report, I have to change the size of a page to a3 instead of a4. I make it with the following code:

Code: Select all

\setlength{\pdfpagewidth}{11.7in}
\setlength{\pdfpageheight}{16.5in}
However, although I center the figure on this page, the figure is not centered. It is centered according to the a4 page, but not to the a3 page (the place of the footer is also wrong).

I hope there is a trick to fix this issue.

Thanks in advance.
Last edited by guvenarkilic on Sat May 07, 2011 3:59 pm, edited 2 times in total.

Recommended reading 2024:

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

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

kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

Figure is not centered on a different-sized page

Post by kaiserkarl13 »

The \pdfpagewidth and \pdfpageheight macros only set the width for the PDF page, not the widths of the text and what LaTeX actually thinks the page size is. The following example might help you get what you want:

Code: Select all

\documentclass{article}

% Set page sizes
\setlength{\paperwidth}{297truemm}
\setlength{\paperheight}{420truemm}
\setlength{\pdfpagewidth}{\paperwidth}
\setlength{\pdfpageheight}{\paperheight}
% Set rest of lengths to compensate for new page size
\setlength{\textwidth}{1.609\textwidth}
\setlength{\textheight}{1.609\textheight}
\setlength{\marginparsep}{1.609\marginparsep}
\setlength{\headheight}{1.609\headheight}
%etc., etc.

\usepackage{layout}   % Used only to define the \layout macro below

\begin{document}
\begin{center}
\rule{5cm}{5cm}
\end{center}
\newpage
\layout   % This should help you decide which lengths to change above.
\end{document}
guvenarkilic
Posts: 3
Joined: Sat Apr 30, 2011 3:37 pm

Re: Figure is not centered on a different-sized page

Post by guvenarkilic »

Dear kaiserkarl13,

First of all, thank you for your response. Your solution works well if I change all the pages to a3.

However, I need to change the dimension of only one page to a3, the remaining ones should be a4.

In this case, with your solution, I still have the same problem.
kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

Figure is not centered on a different-sized page

Post by kaiserkarl13 »

I think this will do what you want:

Code: Select all

%% a3-in-a4.tex
\documentclass{article}
\usepackage[a4paper]{geometry}
\usepackage{pdfpages}

\begin{document}
\begin{center}
\rule{5cm}{5cm}
\end{center}

\includepdf[fitpaper]{a3page}

\newpage
\begin{center}
\rule{5cm}{5cm}
\end{center}

\end{document}

Code: Select all

%% a3page.tex
\documentclass{article}
\usepackage[a3paper]{geometry}
\setcounter{page}{2}
\begin{document}
\begin{center}
\rule{5cm}{5cm}
\end{center}
\end{document}
guvenarkilic
Posts: 3
Joined: Sat Apr 30, 2011 3:37 pm

Re: Figure is not centered on a different-sized page

Post by guvenarkilic »

This worked well. Thanks.
Post Reply