Curricula Vitae / RésumésAdd a picture on the top right

ModernCV, Friggeri, Plasmati, Classicthesis-CV, and more
templateuser
Posts: 679
Joined: Tue Mar 03, 2015 4:01 pm

Add a picture on the top right

Post by templateuser »

Hi,

I would like to add a picture on the top right beside the header. I could place a picture up there, but its way to far on the right. Here is what I tried:

Code: Select all

\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%
    };
    \node at (current page.north east) [anchore=north east] {\includegraphics[width=2cm]{./unilog4c.eps}}
  \end{tikzpicture}
  \vspace{2.5cm}
  \vspace{-2\parskip}
}
can anybody tell me what I'm doing wrong, please! :)

Supersonic600

Recommended reading 2024:

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

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

User avatar
Vel
Site Moderator
Posts: 463
Joined: Fri Jun 29, 2012 1:20 am

Add a picture on the top right

Post by Vel »

Hey,

Your solution is correct, but you have 2 small mistakes in the line you added! The first is "anchore" instead of "anchor" and the second is that you didn't put a semicolon at the end of the line. This is what the line should be (worked for me):

Code: Select all

\node at (current page.north east) [anchor=north east] 
      {\includegraphics[width=2cm]{placeholder.jpg}};
Cheers,
Vel
Founder and administrator of LaTeXTemplates.com and LaTeXTypesetting.com
templateuser
Posts: 679
Joined: Tue Mar 03, 2015 4:01 pm

Add a picture on the top right

Post by templateuser »

Hello,

i know that this post is a little old but i would like to ask in which part i should paste this code to add picture to my cv. When i paste this right after header I'm getting error:

Code: Select all

! LaTeX Error: Command \header already defined.

Or name \end... illegal, see p.192 of the manual.

See the LaTeX manual or LaTeX Companion for explanation.

Type H <return> for immediate help.
Aithhh
User avatar
Vel
Site Moderator
Posts: 463
Joined: Fri Jun 29, 2012 1:20 am

Add a picture on the top right

Post by Vel »

Hey,

Open up friggeri-cv.cls and find the line \newcommand{\header}[3]{%. Within this block you need to paste:

\node at (current page.north east) [anchor=north east] {\includegraphics[width=2cm]{placeholder.jpg}};

just before:

\end{tikzpicture}

It should be on line 85 in v1.0 of the template.

Cheers,
Vel
Founder and administrator of LaTeXTemplates.com and LaTeXTypesetting.com
templateuser
Posts: 679
Joined: Tue Mar 03, 2015 4:01 pm

Re: Add a picture on the top right

Post by templateuser »

Hi Vel.
I would like to know how can I manipulate photo to put it with 1cm top margin and 1cm right margin (using syntax decribed above)?

Cheer,
zdenek
User avatar
Vel
Site Moderator
Posts: 463
Joined: Fri Jun 29, 2012 1:20 am

Add a picture on the top right

Post by Vel »

Hi,

You'll need to enclose the picture node in another node which is 1cm larger on all sides, here's some example code:

Code: Select all

    \node [rectangle, anchor=north east, minimum width=3cm] (box)
          at (current page.north east) (node1) {};
    \node [rectangle, anchor=north, minimum width=2cm] (box)
          at (current page.north east) at (node1.south)
          {\includegraphics[width=2cm]{placeholder.jpg}};
Cheers,
Vel
Founder and administrator of LaTeXTemplates.com and LaTeXTypesetting.com
templateuser
Posts: 679
Joined: Tue Mar 03, 2015 4:01 pm

Re: Add a picture on the top right

Post by templateuser »

Hi Vel.

I would like to know how can I align the header to the right as i have added a picture on the left

Cheers,
Alvaro
User avatar
Vel
Site Moderator
Posts: 463
Joined: Fri Jun 29, 2012 1:20 am

Add a picture on the top right

Post by Vel »

Hi Alvaro,

You just need to anchor the node with the text in it "west" like so:

Code: Select all

    \node [[color=#FF0000]anchor=west[/color]] (name) at (box) {%
      \fontsize{40pt}{72pt}\color{header}%
      {\thinfont #1}{\bodyfont  #2}
    };
Cheers,
Vel
Founder and administrator of LaTeXTemplates.com and LaTeXTypesetting.com
templateuser
Posts: 679
Joined: Tue Mar 03, 2015 4:01 pm

Re: Add a picture on the top right

Post by templateuser »

Hi Vel.

I tried that before, and half of my name is not showing, it seems like is center to the west

Cheers,
Alvaro
User avatar
Vel
Site Moderator
Posts: 463
Joined: Fri Jun 29, 2012 1:20 am

Add a picture on the top right

Post by Vel »

Hi Alvaro,

Try something like this:

\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 [[color=#FF0000]anchor=west,xshift=-3cm[/color]] (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%
};
[color=#FF0000] \node [rectangle, anchor=north west, minimum width=3cm] (box) at (current page.north west) (node1) {};
\node [rectangle, anchor=north, minimum width=2cm] (box) at (current page.north west) at (node1.south) {\includegraphics[width=2cm]{placeholder.jpg}};[/color]
\end{tikzpicture}
\vspace{2.5cm}
\vspace{-2\parskip}
}


I've highlighted my changes from the default in red. Note the xshift=<negative value> which moves that node to the left, this should mean your name fits!

Cheers,
Vel
Founder and administrator of LaTeXTemplates.com and LaTeXTypesetting.com
Post Reply