我在简历中使用longtabu
3 行显示内容。第一行类型l
是日期,第二行包含描述(毕业、团队成员等)和类型X
(我将其重新定义为L
左对齐类型),最后一行是类型r
并包含地点(社会、大学等)。
在第二行中,应该有一个multicol
横跨L
和r
列的。在这里我想打印毕业论文标题或我作为一名员工所做的事情。因为我需要\newline
在这里输入的能力,所以我需要p
输入的类型multicol
,但不幸的是,这会继续输入宽度p{}
。我不知道宽度,因为它取决于前一行的内容,所以我想自动完成。
我怎样才能实现这个结果?multicol
像类型一样跨越两列l
,但也允许使用\newline
?
平均能量损失
\documentclass{article}
\usepackage[utf8]{inputenc}
% %%%%%%%%%%%%%%%
% Packages and
% Package options
% %%%%%%%%%%%%%%%
\usepackage{geometry, tabu, longtable, xparse, parskip}
\geometry{%
verbose,%
a4paper,%
tmargin=25mm,%
bmargin=25mm,%
lmargin=25mm,%
rmargin=20mm,%
nomarginpar,%
nohead,%
}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
% %%%%%%%%%%%%%%%
% New environment
% %%%%%%%%%%%%%%%
\NewDocumentEnvironment{entrylist}{m}%
{%
{\LARGE\bfseries #1}
\par%
\addvspace{.5em}%
\longtabu{@{} l L r @{}}%
}%
{%
\endlongtabu
\par\addvspace{2em}
}
% %%%%%%%%%%%
% New Command
% %%%%%%%%%%%
\newcommand{\entryitem}[4]{
#1
&
{\bfseries #2}
&
{\small\color{light-gray}{#3}}\\
&
\multicolumn{2}{p{6cm}}{\itshape #4}\\[.5\baselineskip]
}
% %%%%%%%%
% Document
% %%%%%%%%
\begin{document}
\begin{entrylist}{Test}
\entryitem
{2014 \textendash\ 2018}
{Member of the foo research team}
{Foo society}
{Working on a new foo}
\entryitem
{2014}
{Graduation to master of bar}
{Bar school}
{The juxtaposition of foo and bar}
\end{entrylist}
\end{document}
答案1
我不完全确定我是否正确地调整了代码,但以下示例似乎有效:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{calc}
\usepackage{lipsum}
% %%%%%%%%%%%%%%%
% Packages and
% Package options
% %%%%%%%%%%%%%%%
\usepackage{geometry, tabu, longtable, xparse, parskip}
\geometry{%
verbose,%
a4paper,%
tmargin=25mm,%
bmargin=25mm,%
lmargin=25mm,%
rmargin=20mm,%
nomarginpar,%
nohead,%
}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
% %%%%%%%%%%%%%%%
% New environment
% %%%%%%%%%%%%%%%
\NewDocumentEnvironment{entrylist}{m}%
{%
{\LARGE\bfseries #1}
\par%
\addvspace{.5em}%
\longtabu{@{} l L r @{}}%
}%
{%
\endlongtabu
\par\addvspace{2em}
}
% %%%%%%%%%%%
% New Command
% %%%%%%%%%%%
\newcommand{\entryitem}[4]{
#1
&
{\bfseries #2}
&
{\small\color{light-gray}{#3}}\\
&
\multicolumn{2}{p{6cm}}{\itshape #4}\\[.5\baselineskip]
}
% %%%%%%%%
% Document
% %%%%%%%%
\begin{document}
\makeatletter
\newdimen\zzz
\ifx\LT@i\@undefined
\zzz=8cm
\else
\global\zzz\z@
\begingroup
\@tempcnta\z@
\def\LT@entry#1#2{%
\advance\@tempcnta\@ne
\ifnum\@tempcnta=1 \global\advance\zzz#2\relax\fi
\ifnum\@tempcnta=2 \global\advance\zzz#2\relax\fi
}
\LT@i
\endgroup
\advance\zzz-2\tabcolsep
\advance\zzz-\arrayrulewidth
\begin{entrylist}{Test}
\entryitem
{2014 \textendash\ 2018}
{Member of the foo research team}
{Foo society}
{Working on a new foo}
\entryitem
{2014}
{Graduation to master of bar}
{Bar school}
{The juxtaposition of foo and bar}
& \multicolumn{2}{l}{%
\rlap{\parbox[t]{\zzz}{\lipsum[2]}}}\\
\end{entrylist}
\end{document}