我已经为这个(简单的)问题苦苦挣扎了好几个小时。在决定更新我的简历后,我想用 latex 来完成。问题是,我对此不是很有经验,现在我陷入困境。
我似乎无法将我的个人资料图片放在我想要的位置。图片应该放在不高于“我的名字”的位置,并且位于右侧。这就是我现在的位置:
这是我的文件:
简历.tex
\documentclass{resume}
\usepackage{comment}
\usepackage{tabularx}
\usepackage{fontspec}
\usepackage{setspace}
\usepackage{graphicx} % Required for figures
\usepackage[export]{adjustbox}
\usepackage{changepage}
\name{My name}
\jobtitle{Student}
\born{xx.xx.xxxx}
\address{Some street, some city}
\phone{0123456789}
\email{[email protected]}
\newcommand{\userinformation}[1]{\renewcommand{\userinformation}{#1}} %
\userinformation{
\begin{figure}
\hfill
\includegraphics[width=.4\textwidth,right]{photo.jpg} % Your photo
\end{figure}
}
\begin{document}
\begin{adjustwidth}{}{-8cm}
\userinformation
\end{adjustwidth}
%----------------------------------------------------------------------------------------
% EDUCATION SECTION
%----------------------------------------------------------------------------------------
\begin{rSection}{Utdanning}
{\bf Some university} \hfill {Year - Year} \\
University
\item Some text
\end{rSection}
\end{document}
简历.cls
\ProvidesClass{resume}[2010/09/17 v0.1 Resume class]
\LoadClass[11pt,letterpaper]{article} % Font size and paper type
\usepackage[left=0.5in,top=0.3in,right=0.5in,bottom=0.5in]{geometry} % Document margins
\usepackage[parfill]{parskip} % Remove paragraph indentation
\usepackage[usenames,dvipsnames]{xcolor} % Colorize
\usepackage{hyperref} % Clickable links
\usepackage{xhfill} % Customizable hrulefill
\usepackage{array} % Required for boldface (\bf and \bfseries) tabular columns
\usepackage{ifthen} % Required for ifthenelse statements
\usepackage{fontspec}
\pagestyle{empty} % Suppress page numbers
\definecolor{accentColor}{RGB}{72,105,24}
\definecolor{titleColor}{RGB}{132,129,129}
\definecolor{textColor}{RGB}{90,91,94}
\definecolor{linkColor}{RGB}{49,117,194}
\hypersetup{
colorlinks=true,
urlcolor=linkColor
}
% New command for the blue bullets
\newcommand{\bluebullet}{\textcolor{accentColor}{$\circ$}~~}
%----------------------------------------------------------------------------------------
% HEADING
%----------------------------------------------------------------------------------------
\newcommand{\name}[1]{
\def\@name{#1}
}
\def\@name{} % Sets \@name to empty by default
\newcommand{\jobtitle}[1] {
\def\@jobtitle{#1} % Defines the \jobtitle command to set name
}
\newcommand{\address}[1]{\def\@address{#1}}
\newcommand{\phone}[1]{\def\@phone{#1}}
\newcommand{\website}[1]{\def\@website{#1}}
\newcommand{\email}[1]{\def\@email{#1}}
\newcommand{\born}[1]{\def\@born{#1}}
% \printname is used to print the name as a page header
\newcommand{\printname} {
\begingroup
\Large\bf\textcolor{accentColor}{\@name}\hfil
\smallskip\break
\endgroup
}
% \printjobtitle is used to print the name as a page header
\newcommand{\printjobtitle} {
\begingroup
\large\bf\textcolor{textColor}{\@jobtitle}\hfil
\smallskip\break
\endgroup
}
% \printjobtitle is used to print the name as a page header
\let\contactsize\normalsize
\let\contactskip\smallskip
\newcommand{\printcontact} {
\begin{tabular}{ l l }
\@ifundefined{@born}{}{\contactsize\textcolor{accentColor}{Født:} & \contactsize\bf\textcolor{textColor}{\@born} \\ \noalign{\contactskip}}
\@ifundefined{@phone}{}{\contactsize\textcolor{accentColor}{Telefon:} & \contactsize\bf\textcolor{textColor}{\@phone} \\ \noalign{\contactskip}}
\@ifundefined{@address}{}{\contactsize\textcolor{accentColor}{Adresse:} & \contactsize\bf\textcolor{textColor}{\@address} \\ \noalign{\contactskip}}
\@ifundefined{@website}{}{\contactsize\textcolor{accentColor}{Website:} & \contactsize\bf\href{\@website}{\@website} \\ \noalign{\contactskip}}
\@ifundefined{@email}{}{\contactsize\textcolor{accentColor}{Mail:} & \contactsize\bf\href{mailto:\@email}{\@email} \\}
\end{tabular}
}
%----------------------------------------------------------------------------------------
% PRINT THE HEADING LINES
%----------------------------------------------------------------------------------------
\let\ori@document=\document
\renewcommand{\document}{
\ori@document % Begin document
\printname % Print the name specified with \name
\@ifundefined{@jobtitle}{}{\printjobtitle}
\printcontact
}
%------------------------------------------------------------------------------- ---------
% SECTION FORMATTING
%----------------------------------------------------------------------------------------
% Defines the rSection environment for the large sections within the CV
\newenvironment{rSection}[1]{ % 1 input argument - section name
\smallskip
\textcolor{accentColor}{\rule{1cm} {.4mm}\quad\hbox{\MakeUppercase{\bf{\textit{#1}}}}\quad\xhrulefill{accentColor} {.4mm}}
\smallskip
\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
}
感谢所有帮助!
答案1
我删除了与 相关的所有内容\userinformation
。相反,我直接将图像放在名称中,类似于 Steven B. Segletes,但使用了\raisebox
och stackengine
。
更改的代码:
\usepackage{calc}%% New
\name{My name%
\sbox0{\includegraphics[height=7em]{example-image}}
\hfill \raisebox{-\ht0+0.7\baselineskip}[0pt][0pt]{\usebox0}% Your photo
}
\jobtitle{Student}
\born{xx.xx.xxxx}
\address{Some street, some city}
\phone{0123456789}
\email{[email protected]}
%\newcommand{\userinformation}[1]{\renewcommand{\userinformation}{#1}} %
%\userinformation{%
% \begin{figure}
% \hfill
% \includegraphics[height=7em,right]{example-image}% Your photo
% \end{figure}
%}
\begin{document}
%\begin{adjustwidth}{}{-8cm}
% \userinformation
%\end{adjustwidth}
答案2
这当然可以进行进一步的改进,但我做了一些事情。我去掉了adjustbox
,我制作了\userinformation
部分\name
并将其高度限制为与学生详细信息相同。重要的是,图像不应成为figure
环境的一部分,环境是一个浮动实体。
\documentclass{resume}
\usepackage{comment}
\usepackage{tabularx}
\usepackage{fontspec}
\usepackage{setspace}
\usepackage{graphicx} % Required for figures
\usepackage[export]{adjustbox}
\usepackage{changepage}
\usepackage{stackengine}
\name{My name\hfill \smash{\userinformation}}
\jobtitle{Student}
\born{xx.xx.xxxx}
\address{Some street, some city}
\phone{0123456789}
\email{[email protected]}
\newcommand{\userinformation}[1]{\renewcommand{\userinformation}{#1}} %
\userinformation{%
\belowbaseline[-\ht\strutbox]{%
\includegraphics[height=6\baselineskip]{example-image}}% Your photo
}
\begin{document}
%----------------------------------------------------------------------------------------
% EDUCATION SECTION
%----------------------------------------------------------------------------------------
\begin{rSection}{Utdanning}
{\bf Some university} \hfill {Year - Year} \\
University
\item Some text
\end{rSection}
\end{document}