根据接受的答案此主题我做了一些修改。其中一项修改遇到了问题:
但我想省略两个项目之间的换行符。
我采用了部分已接受的答案并创建了一个新命令:
\newcommand*{\mycvdescriptiontabularwithitemize}[2]{\begin{tabularx}{\linewidth}{p{\mycolwidthtobedescribed} p{1em} X} %
\begin{itemize}%
\item %
#1%
\end{itemize}
& & #2%
\end{tabularx}}%
我在这里使用这个命令:
\newcommand*{\mycvdescriptionwithitemize}[3][.25em]{%
\begin{tabular}{@{}p{\hintscolumnwidth}@{\hspace{\separatorcolumnwidth}}p{\maincolumnwidth}@{}}%
\raggedleft\hintstyle{} &{\mycvdescriptiontabularwithitemize{#2}{#3}}%
\end{tabular}%
\par}
\cvitem
这是提供的命令的修改moderncv
。
额外的换行符从何而来以及如何省略它?
整个代码:
%% start of file `template.tex'.
%% Copyright 2006-2015 Xavier Danaux ([email protected]).
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License version 1.3c,
% available at http://www.latex-project.org/lppl/.
\documentclass[11pt,a4paper,sans]{moderncv} % possible options include font size ('10pt', '11pt' and '12pt'), paper size ('a4paper', 'letterpaper', 'a5paper', 'legalpaper', 'executivepaper' and 'landscape') and font family ('sans' and 'roman')
% moderncv themes
\moderncvstyle{classic} % style options are 'casual' (default), 'classic', 'banking', 'oldstyle' and 'fancy'
\moderncvcolor{blue} % color options 'black', 'blue' (default), 'burgundy', 'green', 'grey', 'orange', 'purple' and 'red'
%\renewcommand{\familydefault}{\sfdefault} % to set the default font; use '\sfdefault' for the default sans serif font, '\rmdefault' for the default roman one, or any tex font name
%\nopagenumbers{} % uncomment to suppress automatic page numbering for CVs longer than one page
% character encoding
%\usepackage[utf8]{inputenc} % if you are not using xelatex ou lualatex, replace by the encoding you are using
%\usepackage{CJKutf8} % if you need to use CJK to typeset your resume in Chinese, Japanese or Korean
% adjust the page margins
\usepackage[scale=0.75]{geometry}
\usepackage{tabularx}
%\setlength{\hintscolumnwidth}{3cm} % if you want to change the width of the column with the dates
%\setlength{\makecvheadnamewidth}{10cm} % for the 'classic' style, if you want to force the width allocated to your name and avoid line breaks. be careful though, the length is normally calculated to avoid any overlap with your personal info; use this at your own typographical risks...
% personal data
\name{John}{Doe}
\title{Resumé title} % optional, remove / comment the line if not wanted
\address{street and number}{postcode city}{country}% optional, remove / comment the line if not wanted; the "postcode city" and "country" arguments can be omitted or provided empty
\phone[mobile]{+1~(234)~567~890} % optional, remove / comment the line if not wanted; the optional "type" of the phone can be "mobile" (default), "fixed" or "fax"
\phone[fixed]{+2~(345)~678~901}
\phone[fax]{+3~(456)~789~012}
\email{[email protected]} % optional, remove / comment the line if not wanted
\homepage{www.johndoe.com} % optional, remove / comment the line if not wanted
\social[linkedin]{john.doe} % optional, remove / comment the line if not wanted
\social[xing]{john\_doe} % optional, remove / comment the line if not wanted
\social[twitter]{jdoe} % optional, remove / comment the line if not wanted
\social[github]{jdoe} % optional, remove / comment the line if not wanted
\social[gitlab]{jdoe} % optional, remove / comment the line if not wanted
\social[skype]{jdoe} % optional, remove / comment the line if not wanted
\extrainfo{additional information} % optional, remove / comment the line if not wanted
\photo[64pt][0.4pt]{picture} % optional, remove / comment the line if not wanted; '64pt' is the height the picture must be resized to, 0.4pt is the thickness of the frame around it (put it to 0pt for no frame) and 'picture' is the name of the picture file
\quote{Some quote} % optional, remove / comment the line if not wanted
% bibliography adjustements (only useful if you make citations in your resume, or print a list of publications using BibTeX)
% to show numerical labels in the bibliography (default is to show no labels)
%\makeatletter\renewcommand*{\bibliographyitemlabel}{\@biblabel{\arabic{enumiv}}}\makeatother
\renewcommand*{\bibliographyitemlabel}{[\arabic{enumiv}]}
% to redefine the bibliography heading string ("Publications")
%\renewcommand{\refname}{Articles}
\newcommand{\mycolwidthtobedescribed}{2.7cm}
\newcommand*{\mycvdescriptiontabularwithitemize}[2]{\begin{tabularx}{\linewidth}{p{\mycolwidthtobedescribed} p{1em} X} %
\begin{itemize}%
\item %
#1%
\end{itemize}
& & #2%
\end{tabularx}}%
\newcommand*{\mycvdescriptionwithitemize}[3][.25em]{%
\begin{tabular}{@{}p{\hintscolumnwidth}@{\hspace{\separatorcolumnwidth}}p{\maincolumnwidth}@{}}%
\raggedleft\hintstyle{} &{\mycvdescriptiontabularwithitemize{#2}{#3}}%
\end{tabular}%
\par}
% bibliography with mutiple entries
%\usepackage{multibib}
%\newcites{book,misc}{{Books},{Others}}
%----------------------------------------------------------------------------------
% content
%----------------------------------------------------------------------------------
\begin{document}
%\begin{CJK*}{UTF8}{gbsn} % to typeset your resume in Chinese using CJK
%----- resume ---------------------------------------------------------
\makecvtitle
%\moderncvstyle{fancy}
\section{Education}
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description} % arguments 3 to 6 can be
\subsection{Suff}
\mycvdescriptionwithitemize{one item}{item is a thing}
\mycvdescriptionwithitemize{another itme}{this item is interesting}
\end{document}
%% end of file `template.tex'.
答案1
对我来说,不太清楚你想要什么,但让我们看看我的猜测是否有帮助......
如果添加的“项目”不太长,则以下解决方案有效。您的问题没有明确说明如果包含的项目(非常)长,该如何应对:
\mycvdescriptionwithitemize{third item, which can be a problem}{this item is more interesting}
解决方法可以是以下代码(请参阅我删除的环境itemize
):
\newcommand*{\mycvdescriptiontabularwithitemize}[2]{%
\begin{tabularx}{\linewidth}{p{\mycolwidthtobedescribed} p{1em} X} %
\listitemsymbol \quad #1% % <===========================================
& & #2%
\end{tabularx}}%
现在——根据 的值\mycolwidthtobedescribed
——您可以创建一个类似 itemize 的布局。但请注意,如果要像 itemize 一样的文本太长,此解决方案将失败。
所以我们需要知道,一个项目可以有多长,以及你想要如何布局它......
使用以下 MWE
\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{classic}
\moderncvcolor{blue}
%\renewcommand{\familydefault}{\sfdefault}
%\nopagenumbers{}
\usepackage[scale=0.75]{geometry}
\usepackage{tabularx}
%\setlength{\hintscolumnwidth}{3cm}
%\setlength{\makecvheadnamewidth}{10cm}
% personal data
\name{John}{Doe}
\title{Resumé title}
\address{street and number}{postcode city}{country}
\phone[mobile]{+1~(234)~567~890}
\phone[fixed]{+2~(345)~678~901}
\phone[fax]{+3~(456)~789~012}
\email{[email protected]}
\homepage{www.johndoe.com}
\social[linkedin]{john.doe}
\social[xing]{john\_doe}
\social[twitter]{jdoe}
\social[github]{jdoe}
\social[gitlab]{jdoe}
\social[skype]{jdoe}
\extrainfo{additional information}
\photo[64pt][0.4pt]{example-image-a}
\quote{Some quote}
\newcommand{\mycolwidthtobedescribed}{2.7cm}
\newcommand*{\mycvdescriptiontabularwithitemize}[2]{%
\begin{tabularx}{\linewidth}{p{\mycolwidthtobedescribed} p{1em} X} %
\listitemsymbol \quad #1% % <===========================================
& & #2%
\end{tabularx}}%
\newcommand*{\mycvdescriptionwithitemize}[3][.25em]{%
\begin{tabular}{@{}p{\hintscolumnwidth}@{\hspace{\separatorcolumnwidth}}p{\maincolumnwidth}@{}}%
\raggedleft\hintstyle{} &{\mycvdescriptiontabularwithitemize{#2}{#3}}%
\end{tabular}%
\par}
\begin{document}
\makecvtitle
%\moderncvstyle{fancy}
\section{Education}
\cventry{year--year}%
{Degree}%
{Institution}%
{City}%
{\textit{Grade}}%
{Description} % arguments 3 to 6 can be
\subsection{Subsection}
\mycvdescriptionwithitemize{one item}{item is a thing}
\mycvdescriptionwithitemize{another item}{this item is interesting}
\mycvdescriptionwithitemize{third item, which can be a problem}{this item is more interesting}
\end{document}
您将获得以下结果: