0

I'm attempting to fit a TikZ image on a page, and would like to make the image as large as possible, without distorting its dimensions. However, at the same time I would also like to be able to display my name in the header on that same page, without the header being moved in any way by my other manipulations. This is where things get complicated, as I was able to move the image to start from the left edge of the page by practically removing the left margin, but this also moves the headers and footers on that page, as shown in the following image.

SWOT analysis

The source code for the page is here:

\documentclass[12pt,a4paper]{article}

\usepackage[showframe]{geometry}

\usepackage{fancyhdr}
    \pagestyle{fancy}
    \makeatletter
    \let\runchapter\@chapter
    \let\runsection\@thesection
    \makeatother
    \lhead{Full name here}
    \rhead{Course name here}

\usepackage{pgfplots}
  \usetikzlibrary{matrix}
  \colorlet{helpful}{lime!70}
  \colorlet{harmful}{red!30}
  \colorlet{internal}{yellow!20}
  \colorlet{external}{cyan!30}
  \colorlet{S}{helpful!50!internal}
  \colorlet{W}{harmful!50!internal}
  \colorlet{O}{helpful!50!external}
  \colorlet{T}{harmful!50!external}

\begin{document}

\vfill

\newgeometry{left=0cm,right=0cm}

\thispagestyle{fancy}

\begin{figure}[p]


    \centering
    \begin{tikzpicture}[
    any/.style={minimum width=0.475\paperwidth,minimum height=0.475\paperwidth,%
                 text width=7cm,align=center,outer sep=0pt},
    header/.style={any,minimum height=0.05\paperwidth,fill=black!10},
        leftcol/.style={header,rotate=90},
        mycolor/.style={fill=#1, text=#1!60!black}
        ]

        \matrix (SWOT) [matrix of nodes,nodes={any,anchor=center},%
                    column sep=-\pgflinewidth,%
                    row sep=-\pgflinewidth,%
                    row 1/.style={nodes=header},%
                    column 1/.style={nodes=leftcol},
                    inner sep=0pt,
                    outer sep=5em]
        {
            &|[fill=helpful]| {Helpful} & |[fill=harmful]| {Harmful} \\
            |[fill=internal]| {Internal Origin} & |[mycolor=S]| { \fontsize{60}{70}\selectfont S} & |[mycolor=W]| { \fontsize{60}{70}\selectfont W} \\
            |[fill=external]| {External Origin} & |[mycolor=O]| { \fontsize{60}{70}\selectfont O} & |[mycolor=T]| { \fontsize{60}{70}\selectfont T} \\
        };

        \node[any, anchor=center] at (SWOT-2-2) {};
        \node[any, anchor=center] at (SWOT-2-3) {};
        \node[any, anchor=center] at (SWOT-3-2) {};
        \node[any, anchor=center] at (SWOT-3-3) {};

    \end{tikzpicture}
\end{figure}
\vfill

\restoregeometry

\end{document}

The page looks rather ugly, as the header and footer start right at the left side of the page. I would rather the header and footer widths and positions be unchanged by my moving of the left and right margins. How can this be achieved, since the geometry package doesn't seem to differentiate between header/footer and body margins?

0

Adding the lines

  \fancyhfoffset[L]{-0.1\paperwidth}
  \fancyhfoffset[R]{-0.1\paperwidth}

after \usepackage{fancydr} fixed the issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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