带有缩进换行文本的 Moderncv 子条目

带有缩进换行文本的 Moderncv 子条目

如何在 moderncv 中获取子条目?

我已经实现了上述帖子中的解决方案,但我想知道是否有一些简单的方法可以让缩进也适用于换行文本?这样整个块都会缩进,而不仅仅是第一行。

新风:

\documentclass[11pt,a4paper,sans]{moderncv} 
\moderncvstyle{classic}

\newcommand*{\subcventry}[7][.25em]{%
    \cvitem[#1]{#2}{%
        {\hspace*{1em}#3}%
        \ifthenelse{\equal{#4}{}}{}{, {\slshape#4}}%
        \ifthenelse{\equal{#5}{}}{}{, #5}%
        \ifthenelse{\equal{#6}{}}{}{, #6}%
        .\strut%
        \ifx&#7&%
        \else{\newline{}\hspace*{1em}\begin{minipage}[t]{\dimexpr\linewidth-1em}\small#7\end{minipage}}\fi
    }
}

\firstname{Mr.}
\familyname{Awesome} 

\setlength{\hintscolumnwidth}{2.6cm}

\begin{document}
\section{Experience}

\cventry{November 2007 -- current}{Mr. Awesome}{Awesome Ltd.}{The Earth}{}{}
\subcventry{July 2015}{Intake of Awesomeness version 2}{}{}{}{}
\subcventry{May 2014 -- current}{SPOC for all awesomeness in all our awesome clients, which includes Awesome1, Awesome2, awesome3 and awesome4}{}{}{}{}
\end{document}

所以我想完全识别 SPOC 线,它的两条线。

有人有什么想法吗?

答案1

您使用的命令的定义\subcventry只允许在参数中拥有多行#7,插入到自己的参数中minipage

您可以使用示例命令进行测试

\subcventry{November 2007 -- current--2}{Mr. Awesome--3}{Awesome Ltd.--4}{The Earth--5}{test--6}{test--7}

如果将长文本移到最后一个参数中,可编译的 MWE 会显示正确的布局:

\documentclass[11pt,a4paper,sans]{moderncv} 
\moderncvstyle{classic}

\newcommand*{\subcventry}[7][.25em]{%
    \cvitem[#1]{#2}{%
        {\hspace*{1em}#3}%
        \ifthenelse{\equal{#4}{}}{}{, {\slshape#4}}%
        \ifthenelse{\equal{#5}{}}{}{, #5}%
        \ifthenelse{\equal{#6}{}}{}{, #6}%
        .\strut%
        \ifx&#7&%
        \else{\newline{}\hspace*{1em}\begin{minipage}[t]{\dimexpr\linewidth-1em}\small#7\end{minipage}}\fi
    }
}

\firstname{Mr.}
\familyname{Awesome} 

\setlength{\hintscolumnwidth}{2.6cm}

\begin{document}
\section{Experience}

\cventry{November 2007 -- current}{Mr. Awesome}{Awesome Ltd.}{The Earth}{}{}
\subcventry{November 2007 -- current--2}{Mr. Awesome--3}{Awesome Ltd.--4}{The Earth--5}{test--6}{test--7}
\subcventry{July 2015}{Intake of Awesomeness version 2}{}{}{}{}
\subcventry{May 2014 -- current}{SPOC}{}{}{}{SPOC for all awesomeness in all our awesome clients, which includes Awesome1, Awesome2, awesome3 and awesome4}
\end{document}

结果如下:

在此处输入图片描述

最后\subcventry显示移动参数后的结果......

或者你可以定义一个新的自己的命令,\mysubcventry例如

\newcommand*{\mysubcventry}[3][.25em]{%
    \cvitem[#1]{#2}{%
        {\hspace*{1em}\begin{minipage}[t]{\dimexpr\linewidth-1em}\small#3\end{minipage}}
    }
}

带有两个参数和一个选项(用于命令末尾的垂直空格\cvitem)。

使用以下 MWE

\documentclass[11pt,a4paper,sans]{moderncv} 
\moderncvstyle{classic}

\newcommand*{\subcventry}[7][.25em]{%
    \cvitem[#1]{#2}{%
        {\hspace*{1em}#3}%
        \ifthenelse{\equal{#4}{}}{}{, {\slshape#4}}%
        \ifthenelse{\equal{#5}{}}{}{, #5}%
        \ifthenelse{\equal{#6}{}}{}{, #6}%
        .\strut%
        \ifx&#7&%
        \else{\newline{}\hspace*{1em}\begin{minipage}[t]{\dimexpr\linewidth-1em}\small#7\end{minipage}}\fi
    }
}

\newcommand*{\mysubcventry}[3][.25em]{%
    \cvitem[#1]{#2}{%
        {\hspace*{1em}\begin{minipage}[t]{\dimexpr\linewidth-1em}\small#3\end{minipage}}
    }
}

\firstname{Mr.}
\familyname{Awesome} 

\setlength{\hintscolumnwidth}{2.6cm}


\begin{document}
\section{Experience}

\cventry{November 2007 -- current}{Mr. Awesome}{Awesome Ltd.}{The Earth}{}{}
\subcventry{November 2007 -- current--2}{Mr. Awesome--3}{Awesome Ltd.--4}{The Earth--5}{test--6}{test--7.}
\subcventry{July 2015}{Intake of Awesomeness version 2}{}{}{}{}
\subcventry{May 2014 -- current}{SPOC}{}{}{}{SPOC for all awesomeness in all our awesome clients, which includes Awesome1, Awesome2, awesome3 and awesome4.}
\mysubcventry[5em]{May 2014 -- current}{SPOC for all awesomeness in all our awesome clients, which includes Awesome1, Awesome2, awesome3 and awesome4.}
\mysubcventry{May 2014 -- current}{SPOC for all awesomeness in all our awesome clients, which includes Awesome1, Awesome2, awesome3 and awesome4.}
\end{document}

你得到了结果

在此处输入图片描述

相关内容