[Tex/LaTex] Transform Friggeri-CV to A4

friggeri-cvnodestikz-pgf

For some weird reason the otherwise very nice template that can be found here

http://www.latextemplates.com/template/friggeri-resume-cv

is not A4-paper but something else. If, however, I simply add a4paper as an option to the geometry package, it screws up the header, and more important, the spacing between the columns.

My version with a4paper:

what I have

Original:

original

I guess the header part has something to do with this part:

\newcommand{\header}[3]{%
  \begin{tikzpicture}[remember picture,overlay]
    \node [rectangle, fill=fillheader, anchor=north, minimum width=\paperwidth, minimum height=4cm] (box) at (current page.north){};
    \node [anchor=center] (name) at (box) {%
      \fontsize{40pt}{72pt}\color{header}%
      {\thinfont #1}{\bodyfont  #2}
    };
    \node [anchor=north] at (name.south) {%
      \fontsize{14pt}{24pt}\color{header}%
      \thinfont #3%
    };
  \end{tikzpicture}
  \vspace{2.5cm}
  \vspace{-2\parskip}
}

It is done with TikZ, and makes as much sense to me as ancient egyptian glyph language. I tried some hacks with \raisebox and such, but it only screws up more.

So, does anyone have an idea of how to change the format to A4, and keep the name in the header centered vertically and the columns spaced properly?

Best Answer

In my answer I will address both the header concern, and the incorrect column spacing problem separately.

General Requirement

The first thing to do is to modify the .cls file by adding the following lines at the beginning after the main packages are loaded:

\newif\ifafourpaper

\afourpaperfalse


\DeclareOption{a4paper}
   {\setlength\paperheight {297mm}%
    \setlength\paperwidth  {210mm}%
    \afourpapertrue%
  }

\ProcessOptions

This will allow us to create two sets of code within the .cls file that will run depending on whether or not you have selected a4paper as an option when loading the class file.

Fixing the Header

When I change my Friggeri-style resume to a4paper, the header seems correct to me, however, if you want to tweak it you can do the following:

\usetikzlibrary{calc}
\ifafourpaper
    \newcommand{\header}[3]{%
      \begin{tikzpicture}[remember picture,overlay]
        \node [rectangle, fill=fillheader, anchor=north, minimum width=\paperwidth, minimum height=3.5cm] (box) at (current page.north){};
        \path let \p1 = (box) in node[anchor=center] (name) at (\x1-0cm,\y1-0cm) {%
          \fontsize{40pt}{72pt}\color{header}%
          {\headingfonttwo #1}{\kern 0.2cm}{\headingfonttwo #2}
        };
        \node [anchor=north] (title) at (name.south) {%
          \fontsize{14pt}{24pt}\color{header}%
          \headingfonttwo #3%
        };
      \end{tikzpicture}
      \vspace{2.5cm}
      \vspace{-2\parskip}
    }
\else
    \newcommand{\header}[3]{%
      \begin{tikzpicture}[remember picture,overlay]
        \node [rectangle, fill=fillheader, anchor=north, minimum width=\paperwidth, minimum height=3.5cm] (box) at (current page.north){};
        \node [anchor=center] (name) at (box) {%
          \fontsize{40pt}{72pt}\color{header}%
          {\headingfonttwo #1}{\kern 0.2cm}{\headingfonttwo #2}
        };
        \node [anchor=north] (title) at (name.south) {%
          \fontsize{14pt}{24pt}\color{header}%
          \headingfonttwo #3%
        };
      \end{tikzpicture}
      \vspace{2.5cm}
      \vspace{-2\parskip}
    }
\fi

The tikz library calc lets you save node coordinates (\p1 holding the coordinates of the node we defined as box) and recall them using \x1 and \y1.

Within the \ifafourpaper section, you can modify the \x1-0cm and \y1-0cm to shuffle around the name position to wherever you like (for example, shifting it up by 0.1cm would be \x1-0cm and \y1+0.1cm.

Column Spacing

The column spacing definitely does get messed up when switching to a4paper. I have adjusted it as follows:

\ifafourpaper
    \newcommand{\entry}[4]{%
      \parbox[t]{2cm}{\hfill#1}&\parbox[t]{15.5cm}{%
        \textbf{#2}%
        %\hfill%
        {, \normalsize\addfontfeature{Color=gray} \textit{#3}}\\%
        #4\vspace{\parsep}%
      }\\}
\else
    \newcommand{\entry}[4]{%
      \parbox[t]{2cm}{\hfill#1}&\parbox[t]{16cm}{%
        \textbf{#2}%
        %\hfill%
        {, \normalsize\addfontfeature{Color=gray} \textit{#3}}\\%
        #4\vspace{\parsep}%
      }\\}
\fi

Referenced

This question and this question.

Related Question