如何使用 tabularx 合并两列布局中的两列

如何使用 tabularx 合并两列布局中的两列

我最近决定将我的简历模板改为 Latex,并找到了一个不错的双列模板那是在网上。

此模板使用基于 scrartcl 的类来构建 Latex 文档中使用的所有对象。到目前为止,我已成功更新该类以更正所有已弃用的方法,并更改了一些内容。但是,如果不合并布局的两列,我就无法合并 tabularx 中的两列。

问题在于教育清单,我称之为多列{2}{l}并且它不会合并 tabularx,而是合并整个两列布局。这是我使用的类,可以用 TeXworks 打开:

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{tccv}
              [2012/11/09 v1.0
 Two Column Curriculum Vitae]

\LoadClass[10pt]{scrartcl}

\setcounter{secnumdepth}{-1}
\RequirePackage[hmargin=1.25cm,vmargin=1.25cm,twocolumn,columnsep=1.25cm]{geometry}
\RequirePackage{bookman,etoolbox,hyperref,needspace,tabularx,xcolor,fontawesome}

% Capitalize words of at least a minimum length (default to 3 chars).
% The text is capitalized before being expanded.
%
% This macro uses Lua to do the job but fails gracefully (that is,
% return the text as is) if \directlua is not available.
%
% |[
% \ucwords[optional: miminum length]{text}
% ]|
\newcommand\ucwords[2][3]{%
    % Fails gracefully if not in LuaLaTeX
    \providecommand\directlua[1]{#2}%
    \directlua{%
    local minlen=tonumber("#1")
    local src="\luaescapestring{\unexpanded{#2}}"
    local dst={}
    for w in src:gmatch('[^\string\%s]+') do
        if w:len() >= minlen then w = w:sub(1,1):upper()..w:sub(2) end
        table.insert(dst, w)
    end
    tex.print(dst)}}

\pagestyle{empty}
\setlength\parindent{0pt}
\color[HTML]{303030} % Default foreground color
\definecolor{link}{HTML}{506060} % Hyperlinks
\hypersetup{colorlinks,breaklinks,urlcolor=link,linkcolor=link}
\setkomafont{disposition}{\color[HTML]{0058B6}}
\setkomafont{section}{\scshape\Large\mdseries}

% In tccv \part must contain the subject of the curriculum vitae.
% The command will start a new page and output in onecolumn the
% subject (first and last name) with the hardcoded text
% "Curriculum vitae" under it.
\renewcommand\part[1]{%
    \twocolumn[%
    \begin{center}
    \vskip-\lastskip%
    {\usekomafont{part} #1} \medskip\\
    %{\fontfamily{pzc}\selectfont\Huge Curriculum vitae}
    \bigskip
    \end{center}]}

% Overrides the \section command to capitalize every
% word for cosmetic purposes and draws a rule under it.
\makeatletter
\let\old@section\section
\renewcommand\section[2][]{%
    \old@section[#1]{\ucwords{#2}}%
    \newdimen\raising%
    \raising=\dimexpr-0.7\baselineskip\relax%
    \vskip\raising\hrule height 0.4pt\vskip-\raising}
\makeatother

% Allow conditionals based on the job name. This can usually be set
% from a command-line argument: check fausto.en.tex for an example.
%
% |[
% \ifjob{jobname}{content if matches}{content if does not match}
% ]|
\newcommand\ifjob[3]{%
    \edef\JOBNAME{\jobname}%
    \edef\PIVOT{\detokenize{#1}}%
    \ifdefstrequal{\JOBNAME}{\PIVOT}{#2}{#3}%
}

% Renders a personal data box:
%
% |[
% \personal[optional: web site without scheme (no http:// prefix)]
%          {address}{phone number}{email}
% ]|
\newcommand\personal[4][]{%
    \needspace{0.5\textheight}%
    \newdimen\boxwidth%
    \boxwidth=\dimexpr\linewidth-2\fboxsep\relax%
    \colorbox[HTML]{C7E2F2}{%
    \begin{tabularx}{\boxwidth}{c|X}
    \faMapMarker  & {#2}\smallskip\\
    \faPhone     & {#3}\smallskip\\
    \faEnvelope      & \href{mailto:#4}{#4}
    \ifstrempty{#1}{}{\smallskip\\ \faLinkedin & \href{http://www.#1}{#1}}
    \end{tabularx}}}

% Every \item can be followed by one or more paragraphs
% of description:
%
% |[
% \item{date range}{company}{role}
%
% Description of what achieved during this application.
% ]|
\newenvironment{eventlist}{%
    \newcommand*\inskip{}
    \renewcommand\item[3]{%
    \inskip%
    {\raggedleft\scshape ##1\\[1pt]}
    {\Large##2}\\[2pt]
    {\itshape ##3}
    \medskip
    \renewcommand\inskip{\bigskip}}}
    {\bigskip}

% Use only \item inside this environment: no other macros
% are allowed:
%
% |[
% \item[optional: what has been achieved]{years}{subject}{notes}
% ]|
\newenvironment{yearlist}{%
    \renewcommand\item[4][]{%
    {\scshape ##2} & {\bfseries ##3} \\
    \ifstrempty{##1}{}{& {\scshape ##1} \\}
    & {\itshape ##4}\medskip\\}
    \tabularx{\linewidth}{rX}}
    {\endtabularx}

% Use only \item inside this environment: no other macros
% are allowed:
%
% |[
% \item[optional: what has been achieved]{years}{subject}{notes}
% ]|
\newenvironment{educationlist}{%
    \renewcommand\item[4][]{%
    {\bfseries ##3} & {\raggedleft\scshape ##2} \\
    \ifstrempty{##1}{}{{\scshape ##1} &\\}
    \multicolumn{2}{l}{\itshape ##4} \medskip\\}
    \tabularx{\linewidth}{X r}}
    {\endtabularx}


% Use only \item inside this environment: no other macros
% are allowed:
%
% |[
% \item{fact}{description}
% ]|
\newenvironment{factlist}{%
    \newdimen\unbaseline
    \unbaseline=\dimexpr-\baselinestretch\baselineskip\relax
    \renewcommand\item[2]{%
    \textsc{##1} & {\raggedright ##2\medskip\\}\\[\unbaseline]}
    \tabularx{\linewidth}{rX}}
    {\endtabularx}


% Use only \item inside this environment: no other macros
% are allowed:
%
% |[
% \item{place}{description}
% ]|
\newenvironment{activitylist}{%
    \newdimen\unbaseline
    \unbaseline=\dimexpr-\baselinestretch\baselineskip\relax
    \renewcommand\item[2]{%
    {\bfseries ##1} & {\raggedright ##2\medskip\\}\\[\unbaseline]}
    \tabularx{\linewidth}{rX}}
    {\endtabularx}
%%
%% End of file `tccv.cls'.

我使用该课程的 Latex 文档如下:

\documentclass{tccv}
\usepackage[english]{babel}

\begin{document}

\part{Nicola Fontana}

\section{Work experience}

\begin{eventlist}

\item{July 2007 -- Present}
     {eNTiDi software, Travagliato}
     {Management and development}

Software development for the industrial automation sector: configuration
front-end in C with interface based on GTK+,
web applications and sites on LAMP platforms grounded on the
SilverStripe framework,
supervisor programs in LabVIEW and remote system in
Lua on GNU/Linux systems.

\item{January 2002 -- June 2004}
     {TEMA s.r.l., Travagliato}
     {PLC Omron development}

Development and testing of automatic and semiautomatic machines for
ribbon winding on spools and rolls (safety belts, hook-and-loop tapes,
elastic ribbon and bindings). Designing of electrical schematics on
2D cad and user manuals drafting.

\item{October 1998 -- November 2001}
     {TWINS s.r.l., Sarezzo}
     {PC and PLC Siemens development}

Programming, installation and trial of transfer machines for assembly,
adjustment and testing of gas taps. Development and installation of PC
based semiautomatic test stands for pneumatic and hydraulic leakage
tests on valves, gas regulators, electrovalves, tanks and others.

\end{eventlist}

\section{Education}

\begin{educationlist}

\item[High school diploma]{1988 -- 1992}
     {Informatic engineer}
     {ITIS Castelli, Brescia bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla}

\item{1987 -- 1988}
     {Classical gymnasium}
     {Seminario vescovile, Cremona bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla}

\end{educationlist}

\personal
    [www.entidi.com]
    {viale Conciliazione, 13\newline 25039 -- Travagliato (BS)}
    {+39 (30) 6862332}
    {[email protected]}

\section{Public projects}

\begin{yearlist}

\item{2012}
     {ntdisp}
     {Embedded devices programmer}

\item{2007}
     {tip}
     {PHP framework based on PEAR}

\item{2006}
     {adg}
     {Automatic drawing generation}

\item{2006}
     {gtk2panel}
     {Top panel menu in GTK+2}

\item{2004}
     {ntd}
     {General purpose libraries}

\end{yearlist}

\section{Communication skills}

\begin{factlist}
\item{Italian}{Native speaker}
\item{English}{Oral: fair -- Written: good}
\item{Spanish}{Oral: good}
\end{factlist}

\section{Software skills}

\begin{factlist}

\item{Good level}
     {C, PHP, HTML, CSS, autotools, git, gcc, GTK+, GObject, shell,
      MS-DOS, Linux, ladder, G-Code}

\item{Intermediate}
     {Lua, \LaTeX, MySQL, VBA, cuBasic, pascal, subversion, LabVIEW}

\item{Basic level}
     {Windows, FreeBSD, OpenIndiana, Postgres}

\end{factlist}

\end{document}

结果如下:

在此处输入图片描述

答案1

编辑:

尝试这个解决方案:

\newenvironment{educationlist}{%
    \renewcommand\item[4][]{%
    {\bfseries ##3} & {\raggedleft\scshape ##2} \\
    \ifstrempty{##1}{}{& {\scshape ##1} \\}
    \multicolumn{2}{l}{\begin{minipage}{0.45\textwidth}\itshape ##4\end{minipage}}\medskip\\}
    \tabularx{\linewidth}{X r}}
    {\endtabularx}

结果: 在此处输入图片描述

相关内容