我正在创建一个包含以下类别的文档:
\documentclass[11pt,a4paper]{altacv}
\cvdoubleitem
我想使用课堂上可用的命令moderncv
。如何实现?
测试方法
我探索了类文件moderncv
并包含了定义此功能的命令,如下所示:
\newcommand*{\cvdoubleitem}[5][.25em]{}
我使用了如下所示的命令:
\cvdoubleitem[5mm]{1}{2}{3}{4}
它不起作用。输出没有变化。
答案1
每种风格的命令定义都不同moderncv
。根据您想要在简历中使用的变体,您可以从相应的来源复制moderncvbodyVERSION.sty
定义github例如moderncvbodyi.sty
:
\renewcommand*{\cvdoubleitem}[5][.25em]{%
\cvitem[#1]{#2}{%
\begin{minipage}[t]{\doubleitemcolumnwidth}#3\end{minipage}%
\hfill% fill of \separatorcolumnwidth
\begin{minipage}[t]{\hintscolumnwidth}\raggedleft\hintstyle{#4}\end{minipage}%
\hspace*{\separatorcolumnwidth}%
\begin{minipage}[t]{\doubleitemcolumnwidth}#5\end{minipage}}}
或者moderncvbodyiii.sty
:
\renewcommand*{\cvdoubleitem}[5][.25em]{%
\begin{minipage}[t]{\doubleitemcolumnwidth}\hintstyle{#2}: #3\end{minipage}%
\hfill% fill of \separatorcolumnwidth
\begin{minipage}[t]{\doubleitemcolumnwidth}\ifstrempty{#4}{}{\hintstyle{#4}: }#5\end{minipage}%
\par\addvspace{#1}}
答案2
嗯,命令\cvdoubleitem
是根据 moderncv 使用的样式定义的。它还依赖于几个其他宏(例如:)\cvitem
和一些使用的长度(例如\doubleitemcolumnwidth
)以及从到的moderncv.cls
几个变体。moderncvbodyX.sty
X
i
vi
因为你没有说出使用的风格moderncv
,所以我现在只是猜测casual
,那意味着moderncvbodyi.sty
使用。
要获取编译命令,\cvdoubleitem
您需要在序言中添加以下代码:
% <=====================================================================
\usepackage{calc}
% makes a resume line 2 headers and their corresponding text
% usage: \cvdoubleitem[spacing]{header1}{text1}{header2}{text2}
\newcommand*{\cvdoubleitem}[5][.25em]{%
\cvitem[#1]{#2}{%
\begin{minipage}[t]{\doubleitemcolumnwidth}#3\end{minipage}%
\hfill% fill of \separatorcolumnwidth
\begin{minipage}[t]{\hintscolumnwidth}\raggedleft\hintstyle{#4}\end{minipage}%
\hspace*{\separatorcolumnwidth}%
\begin{minipage}[t]{\doubleitemcolumnwidth}#5\end{minipage}}}
\newcommand*{\cvitem}[3][.25em]{%
\begin{tabular}{@{}p{\hintscolumnwidth}@{\hspace{\separatorcolumnwidth}}p{\maincolumnwidth}@{}}%
\raggedleft\hintstyle{#2} &{#3}%
\end{tabular}%
\par\addvspace{#1}}
\newcommand*{\hintfont}{}
\newcommand*{\hintstyle}[1]{{\hintfont\textcolor{red}{#1}}}
\makeatletter
% creates a length if not yet defined
\newcommand*{\@initializelength}[1]{%
\ifdefined#1
\else%
\newlength{#1}\fi%
\setlength{#1}{0pt}}
\@initializelength{\hintscolumnwidth}
\@initializelength{\separatorcolumnwidth}
\@initializelength{\maincolumnwidth}
\@initializelength{\doubleitemcolumnwidth}
\makeatother
\setlength{\hintscolumnwidth}{0.175\textwidth}
\setlength{\separatorcolumnwidth}{0.025\textwidth}
\setlength{\maincolumnwidth}{\textwidth-\leftskip-\rightskip-\separatorcolumnwidth-\hintscolumnwidth}%
\setlength{\doubleitemcolumnwidth}{\maincolumnwidth-\hintscolumnwidth-\separatorcolumnwidth-\separatorcolumnwidth}%
% <=====================================================================
使用以下完整的 MWE
%%%%%%%%%%%%%%%%%
% This is an sample CV template created using altacv.cls
% (v1.1.5, 1 December 2018) written by LianTze Lim ([email protected]). Now compiles with pdfLaTeX, XeLaTeX and LuaLaTeX.
%
%% It may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%% http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2003/12/01 or later.
%%%%%%%%%%%%%%%%
%% If you need to pass whatever options to xcolor
\PassOptionsToPackage{dvipsnames}{xcolor}
%% If you are using \orcid or academicons
%% icons, make sure you have the academicons
%% option here, and compile with XeLaTeX
%% or LuaLaTeX.
% \documentclass[10pt,a4paper,academicons]{altacv}
%% Use the "normalphoto" option if you want a normal photo instead of cropped to a circle
% \documentclass[10pt,a4paper,normalphoto]{altacv}
\documentclass[10pt,a4paper,ragged2e]{altacv}
%% AltaCV uses the fontawesome and academicon fonts
%% and packages.
%% See texdoc.net/pkg/fontawecome and http://texdoc.net/pkg/academicons for full list of symbols. You MUST compile with XeLaTeX or LuaLaTeX if you want to use academicons.
% Change the page layout if you need to
\geometry{left=1cm,right=9cm,marginparwidth=6.8cm,marginparsep=1.2cm,top=1.25cm,bottom=1.25cm}
% Change the font if you want to, depending on whether
% you're using pdflatex or xelatex/lualatex
\ifxetexorluatex
% If using xelatex or lualatex:
\setmainfont{Lato}
\else
% If using pdflatex:
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[default]{lato}
\fi
% Change the colours if you want to
\definecolor{Mulberry}{HTML}{72243D}
\definecolor{SlateGrey}{HTML}{2E2E2E}
\definecolor{LightGrey}{HTML}{666666}
\colorlet{heading}{Sepia}
\colorlet{accent}{Mulberry}
\colorlet{emphasis}{SlateGrey}
\colorlet{body}{LightGrey}
% Change the bullets for itemize and rating marker
% for \cvskill if you want to
\renewcommand{\itemmarker}{{\small\textbullet}}
\renewcommand{\ratingmarker}{\faCircle}
%% sample.bib contains your publications
\addbibresource{sample.bib}
% <=====================================================================
\usepackage{calc}
% makes a resume line 2 headers and their corresponding text
% usage: \cvdoubleitem[spacing]{header1}{text1}{header2}{text2}
\newcommand*{\cvdoubleitem}[5][.25em]{%
\cvitem[#1]{#2}{%
\begin{minipage}[t]{\doubleitemcolumnwidth}#3\end{minipage}%
\hfill% fill of \separatorcolumnwidth
\begin{minipage}[t]{\hintscolumnwidth}\raggedleft\hintstyle{#4}\end{minipage}%
\hspace*{\separatorcolumnwidth}%
\begin{minipage}[t]{\doubleitemcolumnwidth}#5\end{minipage}}}
\newcommand*{\cvitem}[3][.25em]{%
\begin{tabular}{@{}p{\hintscolumnwidth}@{\hspace{\separatorcolumnwidth}}p{\maincolumnwidth}@{}}%
\raggedleft\hintstyle{#2} &{#3}%
\end{tabular}%
\par\addvspace{#1}}
\newcommand*{\hintfont}{}
\newcommand*{\hintstyle}[1]{{\hintfont\textcolor{red}{#1}}}
\makeatletter
% creates a length if not yet defined
\newcommand*{\@initializelength}[1]{%
\ifdefined#1
\else%
\newlength{#1}\fi%
\setlength{#1}{0pt}}
\@initializelength{\hintscolumnwidth}
\@initializelength{\separatorcolumnwidth}
\@initializelength{\maincolumnwidth}
\@initializelength{\doubleitemcolumnwidth}
\makeatother
\setlength{\hintscolumnwidth}{0.175\textwidth}
\setlength{\separatorcolumnwidth}{0.025\textwidth}
\setlength{\maincolumnwidth}{\textwidth-\leftskip-\rightskip-\separatorcolumnwidth-\hintscolumnwidth}%
\setlength{\doubleitemcolumnwidth}{\maincolumnwidth-\hintscolumnwidth-\separatorcolumnwidth-\separatorcolumnwidth}%
% <=====================================================================
\begin{document}
\name{Your Name Here}
\tagline{Your Position or Tagline Here}
\photo{2.8cm}{Globe_High}
\personalinfo{%
% Not all of these are required!
% You can add your own with \printinfo{symbol}{detail}
\email{[email protected]}
\phone{000-00-0000}
\mailaddress{Address, Street, 00000 County}
\location{Location, COUNTRY}
\homepage{www.homepage.com/}
\twitter{@twitterhandle}
\linkedin{linkedin.com/in/yourid}
\github{github.com/yourid}
%% You MUST add the academicons option to \documentclass, then compile with LuaLaTeX or XeLaTeX, if you want to use \orcid or other academicons commands.
% \orcid{orcid.org/0000-0000-0000-0000}
}
\cvdoubleitem{header1}{text1}{header2}{text2} % <=======================
%% Make the header extend all the way to the right, if you want.
\begin{fullwidth}
\makecvheader
\end{fullwidth}
%% Depending on your tastes, you may want to make fonts of itemize environments slightly smaller
% \AtBeginEnvironment{itemize}{\small}
%% Provide the file name containing the sidebar contents as an optional parameter to \cvsection.
%% You can always just use \marginpar{...} if you do
%% not need to align the top of the contents to any
%% \cvsection title in the "main" bar.
\cvsection[sample-p1sidebar]{Experience}
\cvevent{Job Title 1}{Company 1}{Month 20XX -- Ongoing}{Location}
\begin{itemize}
\item Job description 1
\item Job description 2
\end{itemize}
\divider
\cvevent{Job Title 2}{Company 2}{Month 20XX -- Ongoing}{Location}
\begin{itemize}
\item Job description 1
\item Job description 2
\end{itemize}
\cvsection{Projects}
\cvevent{Project 1}{Funding agency/institution}{}{}
\begin{itemize}
\item Details
\end{itemize}
\divider
\cvevent{Project 2}{Funding agency/institution}{Project duration}{}
A short abstract would also work.
\medskip
\cvsection{A Day of My Life}
% Adapted from @Jake's answer from http://tex.stackexchange.com/a/82729/226
% \wheelchart{outer radius}{inner radius}{
% comma-separated list of value/text width/color/detail}
\wheelchart{1.5cm}{0.5cm}{%
6/8em/accent!30/{Sleep,\\beautiful sleep},
3/8em/accent!40/Hopeful novelist by night,
8/8em/accent!60/Daytime job,
2/10em/accent/Sports and relaxation,
5/6em/accent!20/Spending time with family
}
\clearpage
\cvsection[page2sidebar]{Publications}
\nocite{*}
\printbibliography[heading=pubtype,title={\printinfo{\faBook}{Books}},type=book]
\divider
\printbibliography[heading=pubtype,title={\printinfo{\faFileTextO}{Journal Articles}},type=article]
\divider
\printbibliography[heading=pubtype,title={\printinfo{\faGroup}{Conference Proceedings}},type=inproceedings]
%% If the NEXT page doesn't start with a \cvsection but you'd
%% still like to add a sidebar, then use this command on THIS
%% page to add it. The optional argument lets you pull up the
%% sidebar a bit so that it looks aligned with the top of the
%% main column.
% \addnextpagesidebar[-1ex]{page3sidebar}
\end{document}
您将获得以下结果:
因为您没有告诉我们您希望的结果的详细信息,所以我把寻找正确长度的任务留给了您……