LaTeX forum ⇒ Page LayoutHeader box using Tikzpicture: How to modify / add lines Topic is solved

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
paveheikkinen
Posts: 2
Joined: Mon Oct 20, 2014 9:47 pm

Header box using Tikzpicture: How to modify / add lines

Postby paveheikkinen » Mon Oct 20, 2014 10:04 pm

Hello Latex Community,

I have been working on a CV template to personalize it. Yet, I have not found a way to to modify the header that is originally created with Tikz. The CV concludes from two different files: the actual .tex file and a .cls file. By trying out different combinations I have been able to add a line of text 'randomly' with wrong font and position. What I am trying to do is to add a third lane of text into the header.

The original code:
.cls file
\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}%
      {\thinfont #1}{\bodyfont  #2}
    };
    \node [anchor=north] at (name.south) {%
      \fontsize{14pt}{24pt}\color{header}%
      \thinfont #3%
    };
% This is what I tried adding with unwanted results
%    \node [anchor=south] at (box.south) {%
%     \fontsize{14pt}\color{header}%
%      {\thinfont #4}{\thinfont #5}
%    }; 
  \end{tikzpicture}
  \vspace{2.5cm}
  \vspace{-2\parskip}

And the .tex file
\header{name}{surname}{texline1}
%{text2}{text3} this is what I added to work with the extra code in .cls


So my first question would be the basics about the node. Am I missing some other part of code which influences the number of lines in the header?
Secondly, how can I set the third node position correctly?
All in all, I would truly appreciate help!
As you probably can understand from my text, I am not a professional with Latex. Thus if there are any questions/data missing, feel free to ask/comment!

Best wishes,
paveheikkinen

esdd
Posts: 36
Joined: Sat Jan 25, 2014 9:13 pm

Postby esdd » Wed Oct 22, 2014 5:28 pm

Try something like that in your preamble

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


and in your document

\header{name}{surname}{texline1\\text2\\text3}



Best regards
Elke

paveheikkinen
Posts: 2
Joined: Mon Oct 20, 2014 9:47 pm

Postby paveheikkinen » Thu Oct 23, 2014 6:03 pm

Million thanks Elke!
This worked like a charm!

Bests,
Pave


Return to “Page Layout”

Who is online

Users browsing this forum: No registered users and 5 guests