Moderncv:\cvitem 文本太大

Moderncv:\cvitem 文本太大

我如何更改下项的文本大小\cvitem以匹配下项\cventry且不会对其他项造成问题\moderncvstyle{xyz}

梅威瑟:

\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{classic} % banking, casual, classic, empty, oldstyle options  
\moderncvcolor{blue}   % black, blue, green, grey, orange, purple, red options  
\usepackage[scale=0.85]{geometry} % default scale=0.7. height= scale * layoutheight
\usepackage{etoolbox}
\patchcmd{\section}{\vspace*{.5ex}}{\vspace{.5ex}}{}{}

\firstname{John}
\familyname{Doe}
\title{R\'esum\'e}     % optional

% the following definition is from the file moderncvstyleclassic.sty
% reformats the \cventry by removing the period at the end of the line
\renewcommand*{\cventry}[7][.25em]{%
  \cvitem[#1]{#2}{%
    {\bfseries#3}%
    \ifthenelse{\equal{#4}{}}{}{, {\slshape#4}}
    \ifthenelse{\equal{#5}{}}{}{, #5}%
    \ifthenelse{\equal{#6}{}}{}{, #6}%
%   .\strut% original
    \strut%   remove period
    \ifx&#7&%
      \else{\newline{}\begin{minipage}[t]{\linewidth}\small#7\end{minipage}}\fi}}

% Fixes spacing if using \cvitem in the classic style by redefining \section. 
\makeatletter   % changes the catcode of @ to 11 aka Make @ symbol a letter
\@ifpackageloaded{moderncvstyleclassic}{%
\let\oldsection\section%
\renewcommand{\section}[1]{\leavevmode\unskip\vspace*{-\baselineskip}\oldsection{#1}}}{}
\makeatother % changes the catcode of @ back to 12 aka Make @ symbol an "other"

\begin{document}
\makecvtitle
\section{Professional Experience}
    \cventry{Year--Year}{Intern}{Financial Services Inc.}{Somewhere}{State}{
        \begin{itemize}
            \item This is something important that I did here. This cventry text is the perfect size.
            \item This is something else equally important that I did here. This cventry text is the perfect size.
        \end{itemize}}

\section{Skills}
    \cvitem[-1.0em]{}{
        \begin{itemize}
            \item These are the skills I have. Why is this cvitem text larger than cventry text?
        \end{itemize}}

\section{Languages}
    \cvitem{}{
        \begin{itemize}
            \item These are the languages I speak. Why is this cvitem text larger than cventry text?
        \end{itemize}}
\end{document}

答案1

提供 4 种不同风格moderncv:(casual默认)classicoldstylebanking

  • casual使用 的定义,\cvitem如 中所定义classic
  • classic使用以下定义\cvitem

    \renewcommand*{\cvitem}[3][.25em]{%
      \begin{tabular}{@{}p{\hintscolumnwidth}@{\hspace{\separatorcolumnwidth}}p{\maincolumnwidth}@{}}%
        \raggedleft\hintstyle{#2} &{#3}%
      \end{tabular}%
      \par\addvspace{#1}}
    
  • oldstyle使用以下定义\cvitem

    \renewcommand*{\cvitem}[3][.25em]{%
      \ifthenelse{\equal{#2}{}}{}{\hintstyle{#2}: }{#3}%
      \par\addvspace{#1}}
    
  • banking使用\cvitem中的定义\oldstyle

您可以重新定义\cvitem,或者使用xpatch修补\xpatchcmd#3插入\small

\usepackage{xpatch}% http://ctan.org/pkg/xpatch
\xpatchcmd{\cvitem}{#3}{\small #3}{}{}

根据您使用的样式,您可能需要相应地调整大小。如果您使用,它将是这样的classic

在此处输入图片描述

\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{classic} % banking, casual, classic, empty, oldstyle options  
\moderncvcolor{blue}   % black, blue, green, grey, orange, purple, red options  
\usepackage[scale=0.85]{geometry} % default scale=0.7. height= scale * layoutheight
\usepackage{etoolbox,xpatch}
\patchcmd{\section}{\vspace*{.5ex}}{\vspace{.5ex}}{}{}

\firstname{John}
\familyname{Doe}
\title{R\'esum\'e}     % optional

% the following definition is from the file moderncvstyleclassic.sty
% reformats the \cventry by removing the period at the end of the line
\xpatchcmd{\cvitem}{#3}{\small #3}{}{}
\renewcommand*{\cventry}[7][.25em]{%
  \cvitem[#1]{#2}{%
    {\bfseries#3}%
    \ifthenelse{\equal{#4}{}}{}{, {\slshape#4}}
    \ifthenelse{\equal{#5}{}}{}{, #5}%
    \ifthenelse{\equal{#6}{}}{}{, #6}%
%   .\strut% original
    \strut%   remove period
    \ifx&#7&%
      \else{\newline{}\begin{minipage}[t]{\linewidth}#7\end{minipage}}\fi}}

% Fixes spacing if using \cvitem in the classic style by redefining \section. 
\makeatletter   % changes the catcode of @ to 11 aka Make @ symbol a letter
\@ifpackageloaded{moderncvstyleclassic}{%
\let\oldsection\section%
\renewcommand{\section}[1]{\leavevmode\unskip\vspace*{-\baselineskip}\oldsection{#1}}}{}
\makeatother % changes the catcode of @ back to 12 aka Make @ symbol an "other"

\begin{document}
\makecvtitle
\section{Professional Experience}
    \cventry{Year--Year}{Intern}{Financial Services Inc.}{Somewhere}{State}{
        \begin{itemize}
            \item This is something important that I did here. This cventry text is the perfect size.
            \item This is something else equally important that I did here. This cventry text is the perfect size.
        \end{itemize}}

\section{Skills}
    \cvitem[-1.0em]{}{
        \begin{itemize}
            \item These are the skills I have. Why is this cvitem text larger than cventry text?
        \end{itemize}}

\section{Languages}
    \cvitem{}{
        \begin{itemize}
            \item These are the languages I speak. Why is this cvitem text larger than cventry text?
        \end{itemize}}
\end{document}

\small请注意,我已从您对\cventrysince \cventryuses的重新定义中删除了\cvitem现在\small默认使用的(由于补丁)。

相关内容