我正在和全班同学一起制作简历moderncv
。因为我希望采用两栏页面布局,所以我按照这问题。
该布局无法正常工作的是带有\cvlistdoubleitem
: 的列表,实际上,这些项目并不是并排成对出现,而是上下排列。
从图中可以看出,在第一个子集组中(第二个子集是正常的\cvlistitem
):
我该如何修复此布局?我使用的代码如下:
\documentclass[10pt,a4paper,sans]{moderncv}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{url}
\usepackage{relsize}
\usepackage[margin=1in]{geometry}
\usepackage{multicol}
\usepackage{lipsum}
\moderncvstyle{classic} %classic, oldstyle, banking casual
\moderncvcolor{blue} %blue orange green red purple grey black
\firstname{Fat}
\familyname{Tony}
\title{Curriculum Vitae}
\address{Somewhere in Springfield}{12345}{United States}
\email{[email protected]}
\homepage{linkedin.com/in/fat.tony}
\setlength{\hintscolumnwidth}{2.5cm}
\begin{document}
\makecvtitle
\lipsum[1]
\setlength{\hintscolumnwidth}{2.6cm}
\begin{multicols}{2}
\setlength{\hintscolumnwidth}{0.175\textwidth}
\setlength{\separatorcolumnwidth}{0.015\textwidth}
\setlength{\maincolumnwidth}{\linewidth-\leftskip-\rightskip-\separatorcolumnwidth-\hintscolumnwidth}
\section{Personal Information}
\cvitem{Nationality}{Italian American}
\cvitem{Driving License}{Cars and limos}
\section{Education}
\cventry{1990-1995}%
{PhD in something something}%
{A university}%
{City}%
{High grade}%
{Some description of the thing}
\cventry{1988--1990}%
{Msc of science in another thing}%
{A university}%
{City}%
{High grade}%
{Some description of the thing}
\cventry{1985-1988}{Bsc in the first thing ever}%
{A university}%
{City}%
{High grade}%
{Some description of the thing}
\cventry{1980-1985}%
{High school of the best school diploma}%
{A high school}%
{City}%
{High grade}%
{Some description of the thing}
\section{Professional experience}
\cventry{1995-present}
{Mob boss}{A university}%
{City}%
{High grade}%
{Some description of the thing}
\section{Languages}
\cvitem{English}{Native speaker}
\cvitem{Sicilian}{Proficient user }
\cvitem{Italian}{Independent user}
\cvitem{Spanish}{Living the vida loca}
\section{A set of skills}
\subsection{First subset}
\cvlistdoubleitem{First}{Second}
\cvlistdoubleitem{Third}{Fourth}
\cvlistdoubleitem{Here is}{two more}
\subsection{Second subset}
\cvlistitem{Fifth}
\cvlistitem{Seventh}
\cvlistitem{AAAAAAAAAA}
\end{multicols}
\end{document}
答案1
这里的问题是命令的定义\cvlistdoubleitem
:
\renewcommand*{\cvlistdoubleitem}[3][.25em]{%
\cvitem[#1]{}{\listitemsymbol\begin{minipage}[t]{\listdoubleitemcolumnwidth}#2\end{minipage}%
\hfill% fill of \separatorcolumnwidth
\ifthenelse{\equal{#3}{}}%
{}%
{\listitemsymbol\begin{minipage}[t]{\listdoubleitemcolumnwidth}#3\end{minipage}}}}
使用的长度\listdoubleitemcolumnwidth
取决于长度\maincolumnwidth
,正如您从文件中的定义所看到的那样moderncvbodyi.sty
:
\setlength{\maincolumnwidth}{\textwidth-\leftskip-\rightskip-\separatorcolumnwidth-\hintscolumnwidth}%
\setlength{\listitemcolumnwidth}{\maincolumnwidth-\listitemsymbolwidth}%
\setlength{\doubleitemcolumnwidth}{\maincolumnwidth-\hintscolumnwidth-\separatorcolumnwidth-\separatorcolumnwidth}%
\setlength{\doubleitemcolumnwidth}{0.5\doubleitemcolumnwidth}%
\setlength{\listdoubleitemcolumnwidth}{\maincolumnwidth-\listitemsymbolwidth-\separatorcolumnwidth-\listitemsymbolwidth}%
\setlength{\listdoubleitemcolumnwidth}{0.5\listdoubleitemcolumnwidth}%
因此,您只需\listdoubleitemcolumnwidth
在启动环境后定义另一个长度并添加长度的两个定义multicols
(请参阅代码中添加的两行标有 的行<=========
,向右滚动即可查看两者):
\begin{multicols}{2}
\setlength{\hintscolumnwidth}{0.175\textwidth}
\setlength{\separatorcolumnwidth}{0.015\textwidth}
\setlength{\maincolumnwidth}{\linewidth-\leftskip-\rightskip-\separatorcolumnwidth-\hintscolumnwidth}
\setlength{\listdoubleitemcolumnwidth}{\maincolumnwidth-\listitemsymbolwidth-\separatorcolumnwidth-\listitemsymbolwidth}% <================================================
\setlength{\listdoubleitemcolumnwidth}{0.5\listdoubleitemcolumnwidth} % <==============================
所以最后你必须遵循链接问题中的建议:
对于不同的命令,您可能需要调整不同的长度,并且可能需要摆弄才能获得令人满意的结果。
\listdoubleitemcolumnwidth
在您的情况下,您需要在开始后添加更正的长度multicols
。
以下完整的 MWE
\documentclass[10pt,a4paper,sans]{moderncv}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{url}
\usepackage{relsize}
\usepackage[margin=1in]{geometry}
\usepackage{multicol}
\usepackage{lipsum}
\moderncvstyle{classic} %classic, oldstyle, banking casual
\moderncvcolor{blue} %blue orange green red purple grey black
\firstname{Fat}
\familyname{Tony}
\title{Curriculum Vitae}
\address{Somewhere in Springfield}{12345}{United States}
\email{[email protected]}
\homepage{linkedin.com/in/fat.tony}
% copied from moderncvbodyi.sty
%\renewcommand*{\cvlistdoubleitem}[3][.25em]{%
%\cvitem[#1]{}{\listitemsymbol\begin{minipage}[t]{\listdoubleitemcolumnwidth}#2\end{minipage}%
%\hfill% fill of \separatorcolumnwidth
%\ifthenelse{\equal{#3}{}}%
%{}%
%{\listitemsymbol\begin{minipage}[t]{\listdoubleitemcolumnwidth}#3\end{minipage}}}}
\begin{document}
\makecvtitle
\lipsum[1]
\begin{multicols}{2}
\setlength{\hintscolumnwidth}{0.175\textwidth}
\setlength{\separatorcolumnwidth}{0.015\textwidth}
\setlength{\maincolumnwidth}{\linewidth-\leftskip-\rightskip-\separatorcolumnwidth-\hintscolumnwidth}
\setlength{\listdoubleitemcolumnwidth}{\maincolumnwidth-\listitemsymbolwidth-\separatorcolumnwidth-\listitemsymbolwidth}% <================================================
\setlength{\listdoubleitemcolumnwidth}{0.5\listdoubleitemcolumnwidth} % <==============================
\section{Personal Information}
\cvitem{Nationality}{Italian American}
\cvitem{Driving License}{Cars and limos}
\section{Education}
\cventry{1990-1995}%
{PhD in something something}%
{A university}%
{City}%
{High grade}%
{Some description of the thing}
\cventry{1988--1990}%
{Msc of science in another thing}%
{A university}%
{City}%
{High grade}%
{Some description of the thing}
\cventry{1985-1988}{Bsc in the first thing ever}%
{A university}%
{City}%
{High grade}%
{Some description of the thing}
\cventry{1980-1985}%
{High school of the best school diploma}%
{A high school}%
{City}%
{High grade}%
{Some description of the thing}
\section{Professional experience}
\cventry{1995-present}
{Mob boss}{A university}%
{City}%
{High grade}%
{Some description of the thing}
\section{Languages}
\cvitem{English}{Native speaker}
\cvitem{Sicilian}{Proficient user }
\cvitem{Italian}{Independent user}
\cvitem{Spanish}{Living the vida loca}
\section{A set of skills}
\subsection{First subset}
\cvlistdoubleitem{First}{Second}
\cvlistdoubleitem{Third}{Fourth}
\cvlistdoubleitem{Here is}{two more}
\subsection{Second subset}
\cvlistitem{Fifth}
\cvlistitem{Seventh}
\cvlistitem{AAAAAAAAAA}
\end{multicols}
\end{document}
您将获得以下期望结果:
答案2
编辑:我已经用修改后的\cvlistdoubleitem
命令更新了我的答案。
该类modernCV
(v2.0.0)使用以下定义cvlistdoubleitem
:
\renewcommand*{\cvlistdoubleitem}[3][.25em]{%
\cvitem[#1]{}{\listitemsymbol\begin{minipage}[t]{\listdoubleitemcolumnwidth}#2\end{minipage}%
\hfill% fill of \separatorcolumnwidth
\ifthenelse{\equal{#3}{}}%
{}%
{\listitemsymbol\begin{minipage}[t]{\listdoubleitemcolumnwidth}#3\end{minipage}}}}
其中的\hfill
和 minipage\listdoubleitemcolumnwidth
似乎对您的两列布局有问题。我修改了命令,创建了\cvlistdoubleitemnew
:
\documentclass[10pt,a4paper,sans]{moderncv}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{url}
\usepackage{relsize}
\usepackage[margin=1in]{geometry}
\usepackage{multicol}
\usepackage{lipsum}
\moderncvstyle{classic} %classic, oldstyle, banking casual
\moderncvcolor{blue} %blue orange green red purple grey black
\firstname{Fat}
\familyname{Tony}
\title{Curriculum Vitae}
\address{Somewhere in Springfield}{12345}{United States}
\email{[email protected]}
\homepage{linkedin.com/in/fat.tony}
% copied from moderncvbodyi.sty
\newcommand{\cvlistdoubleitemnew}[3][.25em]{%
\cvitem[#1]{}{\listitemsymbol\begin{minipage}[t]{0.4\listdoubleitemcolumnwidth}#2\end{minipage}%
\ifthenelse{\equal{#3}{}}%
{}%
{\listitemsymbol\begin{minipage}[t]{0.4\listdoubleitemcolumnwidth}#3\end{minipage}}}}
\begin{document}
\makecvtitle
\lipsum[1]
\begin{multicols}{2}
\setlength{\hintscolumnwidth}{0.175\textwidth}
\setlength{\separatorcolumnwidth}{0.015\textwidth}
\setlength{\maincolumnwidth}{\linewidth-\leftskip-\rightskip-\separatorcolumnwidth-\hintscolumnwidth}
\section{Personal Information}
\cvitem{Nationality}{Italian American}
\cvitem{Driving License}{Cars and limos}
\section{Education}
\cventry{1990-1995}%
{PhD in something something}%
{A university}%
{City}%
{High grade}%
{Some description of the thing}
\cventry{1988--1990}%
{Msc of science in another thing}%
{A university}%
{City}%
{High grade}%
{Some description of the thing}
\cventry{1985-1988}{Bsc in the first thing ever}%
{A university}%
{City}%
{High grade}%
{Some description of the thing}
\cventry{1980-1985}%
{High school of the best school diploma}%
{A high school}%
{City}%
{High grade}%
{Some description of the thing}
\section{Professional experience}
\cventry{1995-present}
{Mob boss}{A university}%
{City}%
{High grade}%
{Some description of the thing}
\section{Languages}
\cvitem{English}{Native speaker}
\cvitem{Sicilian}{Proficient user }
\cvitem{Italian}{Independent user}
\cvitem{Spanish}{Living the vida loca}
\section{A set of skills}
\subsection{First subset}
\cvlistdoubleitemnew{First}{Second}
\cvlistdoubleitemnew{Third}{Fourth}
\cvlistdoubleitemnew{Here is}{two more}
\subsection{Second subset}
\cvlistitem{Fifth}
\cvlistitem{Seventh}
\cvlistitem{AAAAAAAAAA}
\end{multicols}
\end{document}