This question is a follow-up on a previous question: positioning of a matrix bigger than margins
That question dealt with positioning a pgf matrix that exceeded the horizontal margins of the page (although I imagine this works for floats as well?), and both answers provide a solution to the problem.
However, none of those solutions work if the matrix is bigger than the margins both horizontally and vertically.
How can I make sure that a matrix that is (slightly) too big for the margins is centered on the text area, both vertically and horizontally?
It seems to me that, out of the answers provided in the previous question, the one based on stackengine might be more up to the task (that's why I chose to use that one below), but this may well not be the case, and of course I'm open to all sorts of suggestions.
This is a sample document using the stackengine solution:
\documentclass{article}
\usepackage{tikz}
\usepackage{pgf}
\usetikzlibrary{matrix}
\usepackage{stackengine}
\newcommand\zerowidth[2][c]{\stackengine{0pt}{}{#2}{O}{#1}{F}{T}{L}}
\begin{document}
\newsavebox\toowide
\setbox0=\hbox{%
\begin{tikzpicture}
\matrix [
matrix of nodes,
nodes={
text depth=4em,
text height=5em,
minimum width=10em,
draw
},
row sep=-\pgflinewidth,
column sep=-\pgflinewidth,
]
{
A & B & C & D \\
A & B & C & D \\
A & B & C & D \\
A & B & C & D \\
A & B & C & D \\
A & B & C & D \\
A & B & C & D \\
A & B & C & D \\
};
\end{tikzpicture}
\unskip}
\sbox\toowide{\box0}
\centering\zerowidth{\usebox{\toowide}}
\noindent\rule{\textwidth}{1ex}
\end{document}
Update
Ok, I guess there are some more details that I should have added to make this question more closely reflect the actual problem. In the actual document the chart is within a table which is much wider than tall, so the table is also inside a landscape environment. This new MWE reflects that, and includes the partial solution by Qrrbrbirlbel:
\documentclass{article}
\usepackage{pdflscape}
\usepackage{tikz}
\usepackage{pgf}
\usetikzlibrary{matrix}
\newenvironment{xycenter}
{\par\setbox0=\hbox\bgroup\ignorespaces}
{\unskip\egroup\noindent\parbox[c][\textheight][c]{\hsize}{\makebox[\hsize]{\box0}}\par}
\begin{document}
\begin{landscape}
\begin{table}
\caption{This is my awesome caption}
\begin{xycenter}
\begin{tikzpicture}
\matrix [matrix of nodes,
nodes={
text depth=3.5em,
text height=4.5em,
minimum width=9em,
draw
},
row sep=-\pgflinewidth,
column sep=-\pgflinewidth,
]
{
A & B & C & D & E & F & G \\
A & B & C & D & E & F & G \\
A & B & C & D & E & F & G \\
A & B & C & D & E & F & G \\
A & B & C & D & E & F & G \\
};
\end{tikzpicture}
\end{xycenter}
\end{table}
\end{landscape}
\end{document}
The size of the matrix in this case might make it look like the caption should really not be on this page at all, but the actual chart is just a bit bigger than the page, so it's not as bad as this.
An alternative solution would be to be able to use scale in the tikzpicture options, but that's the first thing I tried and it didn't seem to change anything. If scaling were possible, then I wouldn't need to fiddle so much with trying to squeeze this into that page. I'm starting to think I should rename this question...




\makebox[0pt]{...}– David Carlisle Aug 21 '13 at 11:05scaledoesn’t affect nodes withouttransform shapebut if you consider scaling, take a look at thetikzscalepackage. – Qrrbrbirlbel Aug 21 '13 at 12:08