moderncv中如何控制图片的位置?

moderncv中如何控制图片的位置?

在此处输入图片描述

我想将信息文本推送到 moderncv 类经典主题中的图片下方。可以吗?如何实现?

\documentclass[11pt,a4paper,sans,english]{moderncv}        % possible options include font size ('10pt', '11pt' and '12pt'), paper size ('a4paper', 'letterpaper', 'a5paper', 'legalpaper', 'executivepaper' and 'landscape') and font family ('sans' and 'roman')
\moderncvstyle{classic}                             % style options are 'casual' (default), 'classic', 'oldstyle' and 'banking'
\moderncvcolor{blue}                               % color options 'blue' (default), 'orange', 'green', 'red', 'purple', 'grey' and 'black'
%\nopagenumbers{}                                  % uncomment to suppress automatic page numbering for CVs longer than one page
\usepackage[utf8]{inputenc}                       % if you are not using xelatex ou lualatex, replace by the encoding you are using
\usepackage[scale=0.75,a4paper]{geometry}
\usepackage{babel}
%----------------------------------------------------------------------------------
%            personal data
%----------------------------------------------------------------------------------
\firstname{first name}
\familyname{family name}
\title{Resumé title}                               % optional, remove/comment the line if not wanted
\address{street and number}{postcode city}{country}         % optional, remove/comment the line if not wanted; the "country" arguments can be omitted or provided empty
\mobile{mobile number}                          % optional, remove/comment the line if not wanted
\phone{phone number}                           % optional, remove/comment the line if not wanted
\fax{fax number}                             % optional, remove/comment the line if not wanted
\email{email}                               % optional, remove/comment the line if not wanted
\homepage{home page}                         % optional, remove/comment the line if not wanted
\extrainfo{additional information}                 % optional, remove/comment the line if not wanted
% \photo[64pt][0.4pt]{picture}                       % optional, uncomment the line if wanted; '64pt' is the height the picture must be resized to, 0.4pt is the thickness of the frame around it (put it to 0pt for no frame) and 'picture' is the name of the picture file
\quote{some quote}                                 % optional, remove/comment the line if not wanted
%
\begin{document}
%-----       resume       ---------------------------------------------------------
\makecvtitle
\section{Education}
\cventry{year--year}{Degree}{Institution}{City}{Grade}{Description}  % arguments 3 to 6 can be left empty
\cventry{year--year}{Degree}{Institution}{City}{Grade}{Description}
\section{Master thesis}
\cvitem{title}{Title}
\cvitem{supervisors}{Supervisors}
\cvitem{description}{Short thesis abstract}
\section{Experience}
\subsection{Vocational}
\cventry{year--year}{Job title}{Employer}{City}{}{General description no longer than 1--2 lines}
\cventry{year--year}{Job title}{Employer}{City}{}{General description no longer than 1--2 lines}
\subsection{Miscellaneous}
\cventry{year--year}{Job title}{Employer}{City}{}{General description no longer than 1--2 lines}
\section{Languages}
\cvitemwithcomment{Language 1}{Skill level}{Comment}
\cvitemwithcomment{Language 2}{Skill level}{Comment}
\cvitemwithcomment{Language 3}{Skill level}{Comment}
\section{Computer skills}
\cvdoubleitem{Category 1}{Comment}{Category 4}{Comment}
\cvdoubleitem{Category 2}{Comment}{Category 5}{Comment}
\cvdoubleitem{Category 3}{Comment}{Category 6}{Comment}
\section{Interests}
\cvitem{Hobby 1}{Description}
\cvitem{Hobby 2}{Description}
\cvitem{Hobby 3}{Description}
\section{Extra 1}
\cvlistitem{Item 1}
\cvlistitem{Item 2}
\cvlistitem{Item 3}
\section{Extra 2}
\cvlistdoubleitem{Item 1}{Item 4}
\cvlistdoubleitem{Item 2}{Item 5}
\cvlistdoubleitem{Item 3}{Item 6}
\section{References}
\begin{cvcolumns}
  \cvcolumn{Category 1}{Comment}
  \cvcolumn{Category 2}{Comment}
  \cvcolumn{Category 3}{Comment}
\end{cvcolumns}
\clearpage
%-----       letter       ---------------------------------------------------------
% recipient data
\recipient{Company Recruitment team}{Company's name\\Street address\\Zip Code City}
\date{Date}
\opening{Dear Sir or Madam,}
\closing{Yours faithfully,}
\enclosure{enclosures}          % use an optional argument to use a string other than "Enclosure", or redefine \enclname
\makelettertitle
\makeletterclosing
\end{document}

非常感谢。

答案1

好吧,你必须重写用于创建简历标题的表格。为了做到这一点,我将课堂上的几行代码复制moderncv到简历中(命令\makeatletter和之间的代码\makeatother)。

请注意,以下代码仅适用于类版本 2.0.0。如果类版本号发生变化,则可能需要重写代码...

请参阅以下 MWE(代码的重要部分以 标记<=======):

\documentclass[11pt,a4paper,sans,english]{moderncv}
\moderncvstyle{classic}
\moderncvcolor{blue}
%\nopagenumbers{}
\usepackage[utf8]{inputenc}
\usepackage[scale=0.75,a4paper]{geometry}
\usepackage{babel}

\makeatletter  % <======================================================
\renewcommand*{\makecvhead}{%
  % recompute lengths (in case we are switching from letter to resume, or vice versa)
  \recomputecvlengths%
  % optional detailed information (pre-rendering)
  \@initializebox{\makecvheaddetailsbox}%
  \if@details%
    \def\phonesdetails{}%
    \collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number
      \protected@edef\phonesdetails{\phonesdetails\protect\makenewline\csname\collectionloopkey phonesymbol\endcsname\collectionloopitem}}%
    \def\socialsdetails{}%
    \collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link
      \protected@edef\socialsdetails{\socialsdetails\protect\makenewline\csname\collectionloopkey socialsymbol\endcsname\collectionloopitem}}%
    \savebox{\makecvheaddetailsbox}{%
      \addressfont\color{color2}%
      \if@left\begin{tabular}[b]{@{}r@{}}\fi%
      \if@right\begin{tabular}[b]{@{}l@{}}\fi%
        \ifthenelse{\isundefined{\@photo}}{}{\makenewline % <===========
           \setlength{\fboxrule}{\@photoframewidth}%        <===========
          \ifdim\@photoframewidth=0pt%                      <===========
            \setlength{\fboxsep}{0pt}\fi%                   <===========
          \framebox{\includegraphics[width=\@photowidth]{\@photo}}% <===
        }%                                                  <===========
        \ifthenelse{\isundefined{\@addressstreet}}{}{\makenewline\addresssymbol\@addressstreet%
          \ifthenelse{\equal{\@addresscity}{}}{}{\makenewline\@addresscity}% if \addresstreet is defined, \addresscity and addresscountry will always be defined but could be empty
          \ifthenelse{\equal{\@addresscountry}{}}{}{\makenewline\@addresscountry}}%
        \phonesdetails% needs to be pre-rendered as loops and tabulars seem to conflict
        \ifthenelse{\isundefined{\@email}}{}{\makenewline\emailsymbol\emaillink{\@email}}%
        \ifthenelse{\isundefined{\@homepage}}{}{\makenewline\homepagesymbol\httplink{\@homepage}}%
        \socialsdetails% needs to be pre-rendered as loops and tabulars seem to conflict
        \ifthenelse{\isundefined{\@extrainfo}}{}{\makenewline\@extrainfo}%
      \end{tabular}
    }\fi%
  % optional photo (pre-rendering)
  \@initializebox{\makecvheadpicturebox}%
  \savebox{\makecvheadpicturebox}{%
    \ifthenelse{\isundefined{\@photo}}%
      {}%
      {%
        %\if@left%                                        <=============
          %\hspace*{\separatorcolumnwidth}\fi%
        %\color{color1}%
        %\setlength{\fboxrule}{\@photoframewidth}%
        %\ifdim\@photoframewidth=0pt%
          %\setlength{\fboxsep}{0pt}\fi%
        %\framebox{\includegraphics[width=\@photowidth]{\@photo}}%
      }%
        %\if@right%
          %\hspace*{\separatorcolumnwidth}\fi %           <=============
  }%
  % name and title (pre-rendering)
  \@initializelength{\makecvheaddetailswidth}\settowidth{\makecvheaddetailswidth}{\usebox{\makecvheaddetailsbox}}%
  \@initializelength{\makecvheadpicturewidth}\settowidth{\makecvheadpicturewidth}{\usebox{\makecvheadpicturebox}}%
  \ifthenelse{\lengthtest{\makecvheadnamewidth=0pt}}% check for dummy value (equivalent to \ifdim\makecvheadnamewidth=0pt)
    {\setlength{\makecvheadnamewidth}{\textwidth-\makecvheaddetailswidth-\makecvheadpicturewidth}}%
    {}%
  \@initializebox{\makecvheadnamebox}%
  \savebox{\makecvheadnamebox}{%
    \begin{minipage}[b]{\makecvheadnamewidth}%
      \if@left\raggedright\fi%
      \if@right\raggedleft\fi%
      \namestyle{\@firstname\ \@lastname}%
      \ifthenelse{\equal{\@title}{}}{}{\\[1.25em]\titlestyle{\@title}}%
    \end{minipage}}%
  % rendering
  \if@left%
    \usebox{\makecvheadnamebox}%
    \hfill%
    \llap{\usebox{\makecvheaddetailsbox}}% \llap is used to suppress the width of the box, allowing overlap if the value of makecvheadnamewidth is forced
    \usebox{\makecvheadpicturebox}\fi%
  \if@right%
    \usebox{\makecvheadpicturebox}%
    \rlap{\usebox{\makecvheaddetailsbox}}% \llap is used to suppress the width of the box, allowing overlap if the value of makecvheadnamewidth is forced
    \hfill%
    \usebox{\makecvheadnamebox}\fi%
  \\[2.5em]%
  % optional quote
  \ifthenelse{\isundefined{\@quote}}%
    {}%
    {{\centering\begin{minipage}{\quotewidth}\centering\quotestyle{\@quote}\end{minipage}\\[2.5em]}}%
  \par}% to avoid weird spacing bug at the first section if no blank line is left after \makecvhead

\makeatother      % <===================================================


%----------------------------------------------------------------------------------
%            personal data
%----------------------------------------------------------------------------------
\firstname{first name}
\familyname{family name}
\title{Resumé title}                               % optional, remove/comment the line if not wanted
\address{street and number}{postcode city}{country}         % optional, remove/comment the line if not wanted; the "country" arguments can be omitted or provided empty
\mobile{mobile number}                          % optional, remove/comment the line if not wanted
\phone{phone number}                           % optional, remove/comment the line if not wanted
\fax{fax number}                             % optional, remove/comment the line if not wanted
\email{email}                               % optional, remove/comment the line if not wanted
\homepage{home page}                         % optional, remove/comment the line if not wanted
\extrainfo{additional information}                 % optional, remove/comment the line if not wanted
 \photo[64pt][0.4pt]{example-image-a}       % optional, uncomment the line if wanted; '64pt' is the height the picture must be resized to, 0.4pt is the thickness of the frame around it (put it to 0pt for no frame) and 'picture' is the name of the picture file
\quote{some quote}                                 % optional, remove/comment the line if not wanted
%
\begin{document}
%-----       resume       ---------------------------------------------------------
\makecvtitle
\section{Education}
\cventry{year--year}{Degree}{Institution}{City}{Grade}{Description}  % arguments 3 to 6 can be left empty
\cventry{year--year}{Degree}{Institution}{City}{Grade}{Description}
\section{Master thesis}
\cvitem{title}{Title}
\cvitem{supervisors}{Supervisors}
\cvitem{description}{Short thesis abstract}
\section{Experience}
\subsection{Vocational}
\cventry{year--year}{Job title}{Employer}{City}{}{General description no longer than 1--2 lines}
\cventry{year--year}{Job title}{Employer}{City}{}{General description no longer than 1--2 lines}
\subsection{Miscellaneous}
\cventry{year--year}{Job title}{Employer}{City}{}{General description no longer than 1--2 lines}
\section{Languages}
\cvitemwithcomment{Language 1}{Skill level}{Comment}
\cvitemwithcomment{Language 2}{Skill level}{Comment}
\cvitemwithcomment{Language 3}{Skill level}{Comment}
\section{Computer skills}
\cvdoubleitem{Category 1}{Comment}{Category 4}{Comment}
\cvdoubleitem{Category 2}{Comment}{Category 5}{Comment}
\cvdoubleitem{Category 3}{Comment}{Category 6}{Comment}
\section{Interests}
\cvitem{Hobby 1}{Description}
\cvitem{Hobby 2}{Description}
\cvitem{Hobby 3}{Description}
\section{Extra 1}
\cvlistitem{Item 1}
\cvlistitem{Item 2}
\cvlistitem{Item 3}
\section{Extra 2}
\cvlistdoubleitem{Item 1}{Item 4}
\cvlistdoubleitem{Item 2}{Item 5}
\cvlistdoubleitem{Item 3}{Item 6}
\section{References}
\begin{cvcolumns}
  \cvcolumn{Category 1}{Comment}
  \cvcolumn{Category 2}{Comment}
  \cvcolumn{Category 3}{Comment}
\end{cvcolumns}
\clearpage
%-----       letter       ---------------------------------------------------------
% recipient data
\recipient{Company Recruitment team}{Company's name\\Street address\\Zip Code City}
\date{Date}
\opening{Dear Sir or Madam,}
\closing{Yours faithfully,}
\enclosure{enclosures}          % use an optional argument to use a string other than "Enclosure", or redefine \enclname
\makelettertitle
\makeletterclosing
\end{document}

得到的 pdf 格式如下:

生成的标题页

相关内容