TransWikia.com

Can I insert a image in the same line space as my header?

TeX - LaTeX Asked by jessirocha on January 17, 2021

I would like to insert a photo in the right side of the page but at the same direction of the header (name).
I inserted this code in my txt file and was able to put the photo in the right top corner, but it is up the header, which leaves too much blank space…

begin{figure}
  includegraphics[width=3cm,height=4cm, right]{jessphoto.jpg}
end{figure}

Would it be possible to create a function in the cls file and then just call it in the txt file to do this?

This is part of my cls file configuration:

ProvidesClass{resume}[2010/07/10 v0.9 Resume class]

LoadClass[11pt,letterpaper]{article} % Font size and paper type

usepackage[parfill]{parskip} % Remove paragraph indentation
usepackage{array} % Required for boldface (bf and bfseries) tabular columns
usepackage{ifthen} % Required for ifthenelse statements


pagestyle{empty} % Suppress page numbers

%----------------------------------------------------------------------------------------
%   HEADINGS COMMANDS: Commands for printing name and address
%----------------------------------------------------------------------------------------

def name#1{def@name{#1}} % Defines the name command to set name
def @name {} % Sets @name to empty by default


def addressSep {$diamond$} % Set default address separator to a diamond

% One, two or three address lines can be specified 
let @addressone relax
let @addresstwo relax
let @addressthree relax

% address command can be used to set the first, second, and third address (last 2 optional)
def address #1{
  @ifundefined{@addresstwo}{
    def @addresstwo {#1}
  }{
  @ifundefined{@addressthree}{
  def @addressthree {#1}
  }{
     def @addressone {#1}
  }}
}

% printaddress is used to style an address line (given as input)
def printaddress #1{
  begingroup
    def  {addressSep }
    centerline{#1}
  endgroup
  par
  addressskip
}

% printname is used to print the name as a page header
def printname {
  begingroup
    %hfil{MakeUppercase{namesizebf @name}}hfil
    hfil{namesizebf @name}hfil
    nameskipbreak
  endgroup
}


%----------------------------------------------------------------------------------------
%   PRINT THE HEADING LINES
%----------------------------------------------------------------------------------------

letori@document=document
renewcommand{document}{
  ori@document  % Begin document
  printname % Print the name specified with name
  printcvtitle
  @ifundefined{@addressone}{}{ % Print the first address if specified
    printaddress{@addressone}}
  @ifundefined{@addresstwo}{}{ % Print the second address if specified
    printaddress{@addresstwo}}
     @ifundefined{@addressthree}{}{ % Print the third address if specified
    printaddress{@addressthree}}
}

%----------------------------------------------------------------------------------------
%   SECTION FORMATTING
%----------------------------------------------------------------------------------------

% Defines the rSection environment for the large sections within the CV
newenvironment{rSection}[1]{ % 1 input argument - section name
  sectionskip
  MakeUppercase{bf #1} % Section title
  sectionlineskip
  hrule % Horizontal line
  begin{list}{}{ % List for each individual item in the section
    setlength{leftmargin}{1.5em} % Margin within the section
  }
  item[]
}{
  end{list}
}

%----------------------------------------------------------------------------------------
%   WORK EXPERIENCE FORMATTING
%----------------------------------------------------------------------------------------

newenvironment{rSubsection}[4]{ % 4 input arguments - company name, year(s) employed, job title and location
 {bf #1} hfill {#2} % Bold company name and date on the right
 ifthenelse{equal{#3}{}}{}{ % If the third argument is not specified, don't print the job title and location line
  
  {em #3} hfill {em #4} % Italic job title and location
  }smallskip
  begin{list}{$cdot$}{leftmargin=0em} % cdot used for bullets, no indentation
   itemsep -0.5em vspace{-0.5em} % Compress items in list together for aesthetics
  }{
  end{list}
  vspace{0.5em} % Some space after the list of bullet points
}

% The below commands define the whitespace after certain things in the document - they can be smallskip, medskip or bigskip
defnamesize{huge} % Size of the name at the top of the document
defaddressskip{smallskip} % The space between the two address (or phone/email) lines
defsectionlineskip{medskip} % The space above the horizontal line for each section 
defnameskip{bigskip} % The space after your name at the top
defsectionskip{medskip} % The space after the heading section

This is a part of my txt file:

documentclass{resume} % Use the custom resume.cls style

usepackage{graphicx}
usepackage[export]{adjustbox}
usepackage[left=0.75in,top=0.6in,right=0.75in,bottom=0.6in]{geometry} % Document margins
usepackage[dvipsnames]{xcolor}
usepackage{hyperref}
hypersetup{
    colorlinks=true,
    urlcolor=RoyalBlue
    }

newcommand{tab}[1]{hspace{.2667textwidth}rlap{#1}}
newcommand{itab}[1]{hspace{0em}rlap{#1}}
name{your name} 
address{your address} 
address{ phone  email 
href{linkedIn link}{linkedIn label} } 

begin{document}

%this is my attemptive to include the photo
begin{figure}
  includegraphics[width=3cm,height=4cm, right]{jessphoto.jpg}
end{figure}


%----------------------------------------------------------------------------------------
%    ABOUT ME
%-----------------------------------------------------------------------------------------
begin{rSection}{About Me}

Right here about youvspace{7pt}


end{rSection}

%----------------------------------------------------------------------------------------
%   WORK EXPERIENCE SECTION
%----------------------------------------------------------------------------------------
begin{rSection}{Work Experience}

begin{rSubsection}{Company}{date}{Position)}{}
item description
item description
end{rSubsection}

%----------------------------------------------------------------------------------------
%    Projects And Seminars
%-----------------------------------------------------------------------------------------
begin{rSection}{Projects}

{bf Project Title}
descriptionvspace{7pt}
{bf Project Title}
descriptionvspace{7pt}

end{rSection}

%----------------------------------------------------------------------------------------
%   EDUCATION SECTION
%----------------------------------------------------------------------------------------
begin{rSection}{Education}

{bf University} hfill {date} 
 Course hfill 
vspace{7pt}
{bf University} hfill {date} 
 Course hfill 
vspace{7pt}
end{rSection}

%----------------------------------------------------------------------------------------
%   TECHNICAL SKILLS SECTION
%----------------------------------------------------------------------------------------

begin{rSection}{Technical Skills}

begin{tabular}{ @{} >{bfseries}l @{hspace{6ex}} l }
cathegory1  & number1, number2 and number3 
cathegory2  & number1, number2 and number3 
vspace{7pt}
end{tabular}
end{rSection}

end{document}

One Answer

Probably not the best solution, but this works:

raisebox{-.2totalheight}[0pt][.3totalheight]{includegraphics[width=3cm,height=4cm, right]{jessphoto.jpg}}

Answered by jessirocha on January 17, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP