修改银行现代简历中的 cventry

修改银行现代简历中的 cventry

我想以银行风格编辑 cventry 以获得如下内容:

在此处输入图片描述 事实上,我得到了一些非常相似的东西,但我在概念和创建表格方面遇到了问题。我希望,如果描述参数大于一行,它仍然会继续出现在同一个“表格”中,并且描述和程度都在同一行中。目前我有这个:

在此处输入图片描述 如您所见,Description 参数已使用 \qquad 手动制表,并且不在同一行或表中

\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{banking}
\moderncvcolor{blue}

\usepackage[scale=0.75]{geometry}
\geometry{top=50pt}
\geometry{bottom=80pt}

\usepackage{adjustbox}

\makeatletter

\renewcommand*{\cventry}[7][.25em]{%
  \cvitem[#1]{#2}{%
    {\bfseries#3}%
    \ifthenelse{\equal{#4}{}}{}{, {\slshape#4}}%
    \ifthenelse{\equal{#5}{}}{}{, #5}%
    \ifthenelse{\equal{#6}{}}{}{, #6}%
    .\strut%
    \ifx&#7&%
    \else{\newline{}\begin{minipage}[t]{\linewidth}$\qquad\qquad\quad$\small#7\end{minipage}}\fi}}
\renewcommand*{\namefont}{\fontsize{28}{30}\mdseries\upshape}
\renewcommand*{\addressfont}{\small\mdseries\slshape}
\renewcommand*{\sectionfont}{\Large\mdseries\upshape}
\renewcommand*{\subsectionfont}{\large\mdseries\upshape}
\renewcommand*{\hintfont}{}

% styles
\renewcommand*{\namestyle}[1]{{\namefont\textcolor{color1}{#1}}}
\renewcommand*{\addressstyle}[1]{{\addressfont\textcolor{color1}{#1}}}
\renewcommand*{\sectionstyle}[1]{{\sectionfont\textcolor{color1}{#1}}}
\renewcommand*{\subsectionstyle}[1]{{\subsectionfont\textcolor{color1}{#1}}}
\renewcommand*{\hintstyle}[1]{{\hintfont\textcolor{color0}{#1}}}
%
\newlength{\makecvtitlenamewidth}
\setlength{\makecvtitlenamewidth}{0pt}% dummy value
\renewcommand*{\makecvtitle}{%
  % recompute lengths (in case we are switching from letter to resume, or vice versa)
  \recomputecvlengths%
  % optional detailed information box
  \newbox{\makecvtitledetailsbox}%
  \savebox{\makecvtitledetailsbox}{%
    \addressfont\color{color0}%
    \begin{tabular}[t]{@{}l@{}}%
      \ifthenelse{\isundefined{\@addressstreet}}{}{\makenewline\@addressstreet,%
        \ifthenelse{\equal{\@addresscity}{}}{}{\hspace{1ex} \@addresscity}}% if \addresstreet is defined, \addresscity will always be defined but could be empty
      \ifthenelse{\isundefined{\@mobile}}{}{\makenewline\phonesymbol\@mobile\hspace{1em}\textbackslash}%
      \ifthenelse{\isundefined{\@phone}}{}{\hspace{1em} \phonesymbol\@phone}%
%      \ifthenelse{\isundefined{\@fax}}{}{\makenewline\@fax}%
      \ifthenelse{\isundefined{\@email}}{}{\makenewline\emaillink{\@email}}%
%      \ifthenelse{\isundefined{\@homepage}}{}{\hspace{1.5em}\httplink{\@homepage}}%

      \ifthenelse{\isundefined{\@extrainfo}}{}{\makenewline\@extrainfo}%
    \end{tabular}
  }%
  % optional photo (pre-rendering)
  \newbox{\makecvtitlepicturebox}%
  \savebox{\makecvtitlepicturebox}{%
    \ifthenelse{\isundefined{\@photo}}%
    {}%
    {%
      \hspace*{\separatorcolumnwidth}%
      \color{color1}%
      \setlength{\fboxrule}{\@photoframewidth}%
      \ifdim\@photoframewidth=0pt%
        \setlength{\fboxsep}{0pt}\fi%
      \framebox{\includegraphics[width=\@photowidth]{\@photo}}}}%
  \newlength{\makecvtitlepicturewidth}\settowidth{\makecvtitlepicturewidth}{\usebox{\makecvtitlepicturebox}}%
  \ifthenelse{\lengthtest{\makecvtitlenamewidth=0pt}}% check for dummy value (equivalent to \ifdim\makecvtitlenamewidth=0pt)
    {\setlength{\makecvtitlenamewidth}{\textwidth-\makecvtitlepicturewidth}}%
    {}%
  \begin{minipage}[b]{\textwidth}%
    \begin{tabular}[t]{@{}l}
    \namestyle{\@firstname\ \@familyname}%
    \ifthenelse{\equal{\@title}{}}{}{\\[1.25em]\titlestyle{\@title}}
    \\
    \usebox{\makecvtitledetailsbox}
    \end{tabular}
    \hfill
    \begin{adjustbox}{valign=t}
      \usebox{\makecvtitlepicturebox}
    \end{adjustbox}
  \end{minipage}%
  \par\vspace{1em}
  % optional quote
  \par}%
\makeatother

% personal data
\firstname{John}
\familyname{Doe}
\address{street and number}{postcode city}
\mobile{+1~(234)~567~890}
\phone{+2~(345)~678~901}
\fax{+3~(456)~789~012}
\email{[email protected]}
\homepage{www.johndoe.com}
\extrainfo{additional information}
\photo[94pt][0.4pt]{picture}

%----------------------------------------------------------------------------------
%            content
%----------------------------------------------------------------------------------
\begin{document}
\makecvtitle

\section{Education}

\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description very very very very very very very very long very long very long very long very long very long very long very long very long very long very long very long very long}  % arguments 3 to 6 can be left empty
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}

\section{Master thesis}
\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.\newline{}%
Detailed achievements:%
\begin{itemize}%
\item Achievement 1;
\item Achievement 2, with sub-achievements:
  \begin{itemize}%
  \item Sub-achievement (a);
  \item Sub-achievement (b), with sub-sub-achievements (don't do this!);
    \begin{itemize}
    \item Sub-sub-achievement i;
    \item Sub-sub-achievement ii;
    \item Sub-sub-achievement iii;
    \end{itemize}
  \item Sub-achievement (c);
  \end{itemize}
\item Achievement 3.
\end{itemize}}
\cventry{year--year}{Job title}{Employer}{City}{}{Description line 1\newline{}Description line 2}
\subsection{Miscellaneous}
\cventry{year--year}{Job title}{Employer}{City}{}{Description}
\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}{XXX, YYY, ZZZ}{category 4}{XXX, YYY, ZZZ}
\cvdoubleitem{category 2}{XXX, YYY, ZZZ}{category 5}{XXX, YYY, ZZZ}
\cvdoubleitem{category 3}{XXX, YYY, ZZZ}{category 6}{XXX, YYY, ZZZ}

\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}

\renewcommand{\listitemsymbol}{-~}            % change the symbol for lists

\section{Extra 2}
\cvlistdoubleitem{Item 1}{Item 4}
\cvlistdoubleitem{Item 2}{Item 5\cite{book1}}
\cvlistdoubleitem{Item 3}{}

% Publications from a BibTeX file without multibib
%  for numerical labels: \renewcommand{\bibliographyitemlabel}{\@biblabel{\arabic{enumiv}}}
%  to redefine the heading string ("Publications"): \renewcommand{\refname}{Articles}
\nocite{*}
\bibliographystyle{plain}
\bibliography{publications}                   % 'publications' is the name of a BibTeX file

% Publications from a BibTeX file using the multibib package
%\section{Publications}
%\nocitebook{book1,book2}
%\bibliographystylebook{plain}
%\bibliographybook{publications}              % 'publications' is the name of a BibTeX file
%\nocitemisc{misc1,misc2,misc3}
%\bibliographystylemisc{plain}
%\bibliographymisc{publications}              % 'publications' is the name of a BibTeX file

\clearpage
%-----       letter       ---------------------------------------------------------
% recipient data
\recipient{Company Recruitment team}{Company, Inc.\\123 somestreet\\some city}
\date{January 01, 1984}
\opening{Dear Sir or Madam,}
\closing{Yours faithfully,}
\enclosure[Attached]{curriculum vit\ae{}}     % use an optional argument to use a string other than "Enclosure", or redefine \enclname
\makelettertitle

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis ullamcorper neque sit amet lectus facilisis sed luctus nisl iaculis. Vivamus at neque arcu, sed tempor quam. Curabitur pharetra tincidunt tincidunt. Morbi volutpat feugiat mauris, quis tempor neque vehicula volutpat. Duis tristique justo vel massa fermentum accumsan. Mauris ante elit, feugiat vestibulum tempor eget, eleifend ac ipsum. Donec scelerisque lobortis ipsum eu vestibulum. Pellentesque vel massa at felis accumsan rhoncus.

Suspendisse commodo, massa eu congue tincidunt, elit mauris pellentesque orci, cursus tempor odio nisl euismod augue. Aliquam adipiscing nibh ut odio sodales et pulvinar tortor laoreet. Mauris a accumsan ligula. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Suspendisse vulputate sem vehicula ipsum varius nec tempus dui dapibus. Phasellus et est urna, ut auctor erat. Sed tincidunt odio id odio aliquam mattis. Donec sapien nulla, feugiat eget adipiscing sit amet, lacinia ut dolor. Phasellus tincidunt, leo a fringilla consectetur, felis diam aliquam urna, vitae aliquet lectus orci nec velit. Vivamus dapibus varius blandit.

Duis sit amet magna ante, at sodales diam. Aenean consectetur porta risus et sagittis. Ut interdum, enim varius pellentesque tincidunt, magna libero sodales tortor, ut fermentum nunc metus a ante. Vivamus odio leo, tincidunt eu luctus ut, sollicitudin sit amet metus. Nunc sed orci lectus. Ut sodales magna sed velit volutpat sit amet pulvinar diam venenatis.

Albert Einstein discovered that $e=mc^2$ in 1905.

\[ e=\lim_{n \to \infty} \left(1+\frac{1}{n}\right)^n \]

\makeletterclosing

%\clearpage\end{CJK*}                         % if you are typesetting your resume in Chinese using CJK; the \clearpage is required for fancyhdr to work correctly with CJK, though it kills the page numbering by making \lastpage undefined

\end{document}

答案1

要对代码进行最少的更改,请使用以下命令:

\newlength\descriptionindent
\setlength\descriptionindent{\widthof{\qquad\qquad\quad}}
\renewcommand*{\cventry}[7][.25em]{%
  \cvitem[#1]{#2}{%
    {\bfseries#3}%
    \ifthenelse{\equal{#4}{}}{}{, {\slshape#4}}%
    \ifthenelse{\equal{#5}{}}{}{, #5}%
    \ifthenelse{\equal{#6}{}}{}{, #6}%
    .\strut%
    \ifx&#7&%
    \else{\newline{}\hspace*{\descriptionindent}\begin{minipage}[t]{\dimexpr\linewidth-\descriptionindent\relax}\small#7\end{minipage}}\fi}}

注意我们所做的:

  • 为“描述缩进”创建了新的长度
  • 将小页面的宽度改为行宽减去此缩进
  • 缩进小页面本身,并按此缩进

我建议进行调整\descriptionindent以便更好地排队。

答案2

我们也可以这样做:

\renewcommand*{\cventry}[7][.25em]{
  \begin{tabular}{@{}p{0.1\maincolumnwidth}@{\hspace{\separatorcolumnwidth}}
                                    p{\dimexpr0.9\maincolumnwidth-\hintscolumnwidth}@{}}%
    {#2} & {\bfseries#3}%
     \ifthenelse{\equal{#4}{}}{}{, {\slshape#4}}%
     \ifthenelse{\equal{#5}{}}{}{, #5}%
     \ifthenelse{\equal{#6}{}}{}{, #6}%
     .\strut%
  \end{tabular}%
  \ifx&#7&%
  \else{\\%
    \hspace*{\dimexpr0.1\maincolumnwidth+\separatorcolumnwidth\relax}%
    \begin{minipage}{\dimexpr0.9\maincolumnwidth-\separatorcolumnwidth\relax}%
      \small#7%
    \end{minipage}}\fi%
  \par\addvspace{#1}}

在此处输入图片描述

完整代码:

\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{banking}
\moderncvcolor{blue}

\usepackage[scale=0.75]{geometry}
\geometry{top=50pt}
\geometry{bottom=80pt}

{\settowidth{\hintscolumnwidth}{year-year:}}

\usepackage{adjustbox}

\makeatletter

\renewcommand*{\cventry}[7][.25em]{
  \begin{tabular}{@{}p{0.1\maincolumnwidth}@{\hspace{\separatorcolumnwidth}}
                                    p{\dimexpr0.9\maincolumnwidth-\hintscolumnwidth}@{}}%
    {#2} & {\bfseries#3}%
     \ifthenelse{\equal{#4}{}}{}{, {\slshape#4}}%
     \ifthenelse{\equal{#5}{}}{}{, #5}%
     \ifthenelse{\equal{#6}{}}{}{, #6}%
     .\strut%
  \end{tabular}%
  \ifx&#7&%
  \else{\\%
    \hspace*{\dimexpr0.1\maincolumnwidth+\separatorcolumnwidth\relax}%
    \begin{minipage}{\dimexpr0.9\maincolumnwidth-\separatorcolumnwidth\relax}%
      \small#7%
    \end{minipage}}\fi%
  \par\addvspace{#1}}

\renewcommand*{\namefont}{\fontsize{28}{30}\mdseries\upshape}
\renewcommand*{\addressfont}{\small\mdseries\slshape}
\renewcommand*{\sectionfont}{\Large\mdseries\upshape}
\renewcommand*{\subsectionfont}{\large\mdseries\upshape}
\renewcommand*{\hintfont}{}

% styles
\renewcommand*{\namestyle}[1]{{\namefont\textcolor{color1}{#1}}}
\renewcommand*{\addressstyle}[1]{{\addressfont\textcolor{color1}{#1}}}
\renewcommand*{\sectionstyle}[1]{{\sectionfont\textcolor{color1}{#1}}}
\renewcommand*{\subsectionstyle}[1]{{\subsectionfont\textcolor{color1}{#1}}}
\renewcommand*{\hintstyle}[1]{{\hintfont\textcolor{color0}{#1}}}
%
\newlength{\makecvtitlenamewidth}
\setlength{\makecvtitlenamewidth}{0pt}% dummy value
\renewcommand*{\makecvtitle}{%
  % recompute lengths (in case we are switching from letter to resume, or vice versa)
  \recomputecvlengths%
  % optional detailed information box
  \newbox{\makecvtitledetailsbox}%
  \savebox{\makecvtitledetailsbox}{%
    \addressfont\color{color0}%
    \begin{tabular}[t]{@{}l@{}}%
      \ifthenelse{\isundefined{\@addressstreet}}{}{\makenewline\@addressstreet,%
        \ifthenelse{\equal{\@addresscity}{}}{}{\hspace{1ex} \@addresscity}}% if \addresstreet is defined, \addresscity will always be defined but could be empty
      \ifthenelse{\isundefined{\@mobile}}{}{\makenewline\phonesymbol\@mobile\hspace{1em}\textbackslash}%
      \ifthenelse{\isundefined{\@phone}}{}{\hspace{1em} \phonesymbol\@phone}%
%      \ifthenelse{\isundefined{\@fax}}{}{\makenewline\@fax}%
      \ifthenelse{\isundefined{\@email}}{}{\makenewline\emaillink{\@email}}%
%      \ifthenelse{\isundefined{\@homepage}}{}{\hspace{1.5em}\httplink{\@homepage}}%

      \ifthenelse{\isundefined{\@extrainfo}}{}{\makenewline\@extrainfo}%
    \end{tabular}
  }%
  % optional photo (pre-rendering)
  \newbox{\makecvtitlepicturebox}%
  \savebox{\makecvtitlepicturebox}{%
    \ifthenelse{\isundefined{\@photo}}%
    {}%
    {%
      \hspace*{\separatorcolumnwidth}%
      \color{color1}%
      \setlength{\fboxrule}{\@photoframewidth}%
      \ifdim\@photoframewidth=0pt%
        \setlength{\fboxsep}{0pt}\fi%
      \framebox{\includegraphics[width=\@photowidth]{\@photo}}}}%
  \newlength{\makecvtitlepicturewidth}\settowidth{\makecvtitlepicturewidth}{\usebox{\makecvtitlepicturebox}}%
  \ifthenelse{\lengthtest{\makecvtitlenamewidth=0pt}}% check for dummy value (equivalent to \ifdim\makecvtitlenamewidth=0pt)
    {\setlength{\makecvtitlenamewidth}{\textwidth-\makecvtitlepicturewidth}}%
    {}%
  \begin{minipage}[b]{\textwidth}%
    \begin{tabular}[t]{@{}l}
    \namestyle{\@firstname\ \@familyname}%
    \ifthenelse{\equal{\@title}{}}{}{\\[1.25em]\titlestyle{\@title}}
    \\
    \usebox{\makecvtitledetailsbox}
    \end{tabular}
    \hfill
    \begin{adjustbox}{valign=t}
      \usebox{\makecvtitlepicturebox}
    \end{adjustbox}
  \end{minipage}%
  \par\vspace{1em}
  % optional quote
  \par}%
\makeatother

% personal data
\firstname{John}
\familyname{Doe}
\address{street and number}{postcode city}
\mobile{+1~(234)~567~890}
\phone{+2~(345)~678~901}
\fax{+3~(456)~789~012}
\email{[email protected]}
\homepage{www.johndoe.com}
\extrainfo{additional information}
\photo[94pt][0.4pt]{picture}

%----------------------------------------------------------------------------------
%            content
%----------------------------------------------------------------------------------
\begin{document}
\makecvtitle
\the\hintscolumnwidth

\section{Education}

\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description very very very very very very very very long very long very long very long very long very long very long very long very long very long very long very long very long}  % arguments 3 to 6 can be left empty
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}

\section{Master thesis}
\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.\newline{}%
Detailed achievements:%
\begin{itemize}%
\item Achievement 1;
\item Achievement 2, with sub-achievements:
  \begin{itemize}%
  \item Sub-achievement (a);
  \item Sub-achievement (b), with sub-sub-achievements (don't do this!);
    \begin{itemize}
    \item Sub-sub-achievement i;
    \item Sub-sub-achievement ii;
    \item Sub-sub-achievement iii;
    \end{itemize}
  \item Sub-achievement (c);
  \end{itemize}
\item Achievement 3.
\end{itemize}}
\cventry{year--year}{Job title}{Employer}{City}{}{Description line 1\newline{}Description line 2}
\subsection{Miscellaneous}
\cventry{year--year}{Job title}{Employer}{City}{}{Description}
\section{Languages}

\end{document}

相关内容