Page LayoutHeader box using Tikzpicture: How to modify / add lines

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

Header box using Tikzpicture: How to modify / add lines

Post by paveheikkinen »

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

Code: Select all

\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

Code: Select all

\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

Recommended reading 2024:

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

NEW: TikZ book now 40% off at Amazon.com for a short time.

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

Header box using Tikzpicture: How to modify / add lines

Post by esdd »

Try something like that in your preamble

Code: Select all

\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

Code: Select all

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

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

Re: Header box using Tikzpicture: How to modify / add lines

Post by paveheikkinen »

Million thanks Elke!
This worked like a charm!

Bests,
Pave
Post Reply