嗨,我正在尝试修复以下代码片段。如果句子太长,我希望表格条目延伸到第二行。但是,使用这段代码,表格条目超出了页面宽度。
\begin{rSection}{IT and language}
\begin{tabular}{ @{} >{\bfseries}l @{\hspace{3ex}} l }
MATLAB & 6+ years of experience in signal processing, image analysis, image segmentation, noise removal and quantitative data analysis \\
IT skills & Python (beginner), \LaTeX\ (advanced), MS Office (intermediate) \\
\end{tabular}
\end{rSection}
所以我引入了{\tabular*}{\pagewidth}
。但是问题仍然存在。我觉得我缺少一个简单的解决方案。
\begin{rSection}{IT and language}
\begin{tabular*}{\textwidth}{ @{} >{\bfseries}l @{\hspace{3ex}} l }
MATLAB & 6+ years of experience in signal processing, image analysis, image segmentation, noise removal and quantitative data analysis \\
IT skills & Python (beginner), \LaTeX\ (advanced), MS Office (intermediate) \\
\end{tabular*}
\end{rSection}
我看到过一些建议,例如以下建议,其中表格和列宽可以硬编码到 latex 中。但是,我希望第一列随文本扩展,第二列继续直到\pagewidth
文本保持\raggedright
对齐(即从单元格的左上角开始)。
\begin{tabular}{@{} L{3.5cm} L{9cm} @{}}
Jun 2016--Aug 2016 & Lorem ipsum dolor sit amet, consectetur adipiscing elit.
\end{tabular}
带 CLASS 的 MWE 如下所示
\documentclass{resumeTechEngQuantLargeGap} % Use the custom resumeTechEngQuant.cls for style
\usepackage[left=0.4 in,top=0.4in,right=0.4 in,bottom=0.4in]{geometry} % Margins
\newcommand{\tab}[1]{\hspace{.2667\textwidth}\rlap{#1}}
\newcommand{\itab}[1]{\hspace{0em}\rlap{#1}}
%%% a square symbol
\usepackage{amssymb}
\makeatletter
\DeclareRobustCommand{\sqcdot}{\mathbin{\mathpalette\morphic@sqcdot\relax}}
\newcommand{\morphic@sqcdot}[2]{
\sbox\z@{$\m@th#1\centerdot$}%
\ht\z@=.3333\ht\z@
\vcenter{\box\z@}%
}
\makeatother
%---------------------------
% CV information
%---------------------------
\name{John Doe} % Your name
\address{124 Obsolete Street, Imagination Town. AB1 3ED \\ \underline{[email protected]} \\ +01 (0)23 4567 8901} % Your address
%---------------------------
% CV information
%---------------------------
\begin{document}
\begin{rSection}{IT and language}
\begin{tabular}{ @{} >{\bfseries}l @{\hspace{3ex}} l }
MATLAB & 6+ years of experience in signal processing, image analysis, image segmentation, noise removal and quantitative data analysis \\
IT skills & Python (beginner), \LaTeX\ (advanced), MS Office (intermediate) \\
\end{tabular}
\end{rSection}
\end{document}
类文件
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ProvidesClass{resumeTechEngQuantLargeGap}[2010/07/10 v0.9 Resume class]
\LoadClass[11pt,letterpaper]{article} % Font size and paper type
%\LoadClass[11pt,letterpaper,times]{article} % Font size and paper type
\usepackage[parfill]{parskip} % Remove paragraph indentation
\usepackage{array} % Required for boldface (\bf and \bfseries) tabular columns
\usepackage{ifthen} % Required for ifthenelse statements
\pagestyle{empty} % Suppress page numbers
%\usepackage{mathptmx}
\usepackage{Times}
%%% a square symbol
%\usepackage{amssymb}
%
%\makeatletter
%\DeclareRobustCommand{\sqcdot}{\mathbin{\mathpalette\morphic@sqcdot\relax}}
%\newcommand{\morphic@sqcdot}[2]{%
% \sbox\z@{$\m@th#1\centerdot$}%
% \ht\z@=.33333\ht\z@
% \vcenter{\box\z@}%
%}
%\makeatother
%----------------------------------------------------------------------------------------
% HEADINGS COMMANDS: Commands for printing name and address
%----------------------------------------------------------------------------------------
\def \name#1{\def\@name{#1}} % Defines the \name command to set name
\def \@name {} % Sets \@name to empty by default
\def \addressSep {$\mid$} % \Big| Set default address separator to a diamond
% One, two or three address lines can be specified
\let \@addressone \relax
\let \@addresstwo \relax
\let \@addressthree \relax
% \address command can be used to set the first, second, and third address (last 2 optional)
\def \address #1{
\@ifundefined{@addresstwo}{
\def \@addresstwo {#1}
}{
\@ifundefined{@addressthree}{
\def \@addressthree {#1}
}{
\def \@addressone {#1}
}}
}
% \printaddress is used to style an address line (given as input)
\def \printaddress #1{
\begingroup
\def \\ {\addressSep\ }
\centerline{#1}
\endgroup
\par
\addressskip
}
% \printname is used to print the name as a page header
\def \printname {
\begingroup
\hfil{\MakeUppercase{\namesize\bf \@name}}\hfil
\nameskip % adds space between name and address
\break
\endgroup
}
%----------------------------------------------------------------------------------------
% PRINT THE HEADING LINES
%----------------------------------------------------------------------------------------
\let\ori@document=\document
\renewcommand{\document}{
\ori@document % Begin document
\printname % Print the name specified with \name
\@ifundefined{@addressone}{}{ % Print the first address if specified
\printaddress{\@addressone}}
\@ifundefined{@addresstwo}{}{ % Print the second address if specified
\printaddress{\@addresstwo}}
\@ifundefined{@addressthree}{}{ % Print the third address if specified
\printaddress{\@addressthree}}
}
%----------------------------------------------------------------------------------------
% SECTION FORMATTING
%----------------------------------------------------------------------------------------
% Defines the rSection environment for the large sections within the CV
\newenvironment{rSection}[1]{ % 1 input argument - section name
\sectionskip
\MakeUppercase{\bf #1} % Section title
\sectionlineskip
\hrule % Horizontal line
\begin{list}{}{ % List for each individual item in the section
\setlength{\leftmargin}{1.5em} % Margin within the section
}
\item[]
}{
\end{list}
}
%----------------------------------------------------------------------------------------
% SUB-SECTION FORMATTING: WORK EXPERIENCE FORMATTING
%----------------------------------------------------------------------------------------
%% original rSubSection settings
% sub-section style 0: job and experience listing with bullet points
\newenvironment{rSubsection}[4]{ % 4 input arguments - company name, year(s) employed, job title and location
{\bf #1} \hfill {#2} % Bold company name and date on the right
\ifthenelse{\equal{#3}{}}{}{ % If the third argument is not specified, don't print the job title and location line
\\
{\em #3} \hfill {\em #4} % Italic job title and location
}\smallskip
\begin{list}{$\cdot$}{\leftmargin=0em} % \cdot used for bullets, no indentation
\itemsep -0.5em \vspace{-0.5em} % Compress items in list together for aesthetics
}{
\end{list}
\vspace{0.5em} % Some space after the list of bullet points
}
% sub-section style bkup: job and experience listing with bullet points
\newenvironment{rSubsection1}[4]{ % 4 input arguments - company name, year(s) employed, job title and location
{\bf #1} \hfill {#2} % Bold company name and date on the right
\ifthenelse{\equal{#3}{}}{}{ % If the third argument is not specified, don't print the job title and location line
\\
{\em #3} \hfill {\em #4} % Italic job title and location
}\smallskip
\begin{list}{$\cdot$}{\leftmargin=0em} % \cdot used for bullets, no indentation
\itemsep -0.5em \vspace{-0.5em} % Compress items in list together for aesthetics
}{
\end{list}
\vspace{0.5em} % Some space after the list of bullet points
}
% rSubsectionHeadingsTwoLineList : 4 input: displayed in two lines ONLY
\newenvironment{rSubsectionHeadingsTwoLine}[4]{ % 4 input arguments - company name, year(s) employed, job title and location
{\bf #3} \hfill {#4} % Bold company name and date on the right
\ifthenelse{\equal{#3}{}}{}{ % If the third argument is not specified, don't print the job title and location line
\\
{\em #1} \hfill {\em #2} % Italic job title and location
}\smallskip
\itemsep -0.5em \vspace{-0.5em}
% \vspace{-0.5em} % Some space after the list of bullet points
}
% rSubsectionHeadingsTwoLineList : 4 input: displayed in two lines with Lists of items
\newenvironment{rSubsectionHeadingsTwoLineList}[4]{ % 4 input arguments - company name, year(s) employed, job title and location
{\bf #3} \hfill {\em #4} % Bold company name and date on the right
\ifthenelse{\equal{#3}{}}{}{ % If the third argument is not specified, don't print the job title and location line
\\
{\bf #1} \hfill {\em #2} % Italic job title and location
}\smallskip
\begin{list}{$\sqcdot$}{\leftmargin=1.0em}
% \cdot used for bullets, no indentation;
% \sqcdot used for to make centerdot in the centre to produce squarebullets
% \bullet used for bullet points
% \textbullet for text mode bullets
\itemsep -0.5em \vspace{-0.5em} % Compress items in list together for aesthetics
}{
\end{list}
\vspace{0.5em} % Some space after the list of bullet points
}
% sub-section style 1: job and experience listing without bullet points
\newenvironment{rSubsectionHeadingsOneLine}[3]{ % 4 input arguments - company name, year(s) employed, job title and location
{\bf #1} {$\ \mid $} {\bf #3} \hfill {#2} % Bold company name and date on the right
\smallskip
\itemsep -0.5em \vspace{-0.5em}
}
% sub-section style 1: job and experience listing without bullet points
\newenvironment{rSubsectionHeadingsOneLineList}[3]{ % 4 input arguments - company name, year(s) employed, job title and location
{\bf #1} {$\ \mid $} {\bf #3} \hfill {#2} %\hfill {#2} % Bold company name and date on the right
% \ifthenelse{\equal{#3}{}}{}{ % If the third argument is not specified, don't print the job title and location line
% \\
% {\em #3} \hfill {\em #4} % Italic job title and location
% }\smallskip
\begin{list}{$\cdot$}{\leftmargin=0em} % \cdot used for bullets, no indentation
\itemsep -0.5em \vspace{-0.5em} % Compress items in list together for aesthetics
}{
\end{list}
\vspace{0.5em} % Some space after the list of bullet points
}
% rSubsectionHeadingsMultiJobLists: one job multi position experience listings with List
\newenvironment{rSubsectionHeadingsMultiJobLists}[2]{ % 4 input arguments - company name, year(s) employed
{\bf #1} \hfill {\em #2} % Bold company name and date on the right
\smallskip
\begin{list}{}{ % List for each individual item in the section
\itemsep -0.5em \vspace{-0.5em} % Compress items in list together for aesthetics
\setlength{\leftmargin}{1.0em} % Margin within the section
}
\item[]
}{
\end{list}
}
% rSubSubsection: one job multi position experience listings with List
\newenvironment{rSubSubsection}[2]{ % 4 input arguments - company name, year(s) employed
{\bf #1} \hfill {\em #2} % Bold company name and date on the right
\smallskip
\begin{list}{$\sqcdot$}{\leftmargin=1em} % \cdot used for bullets, no indentation
\itemsep -0.5em \vspace{-0.5em} % Compress items in list together for aesthetics
}{
\end{list}
% \vspace{-0.25em} % Some space after the list of bullet points
}
%----------------------------------------------------------------------------------------
% DEFINES WHITESPACE WITHIN THE DOCUMENT
%----------------------------------------------------------------------------------------
% The below commands define the whitespace after certain things in the document - they can be \smallskip, \medskip or \bigskip
\def\namesize{\huge} % Size of the name at the top of the document
\def\addressskip{\smallskip} % The space between the two address (or phone/email) lines
%\def\nameskip{\bigskip} % The space after your name at the top
%\def\sectionlineskip{\medskip} % The space above the horizontal line for each section
%\def\sectionskip{\medskip} % The space after the heading section
\def\sectionskip{\vspace{1pt}}
\def\sectionlineskip{\vspace{2pt}}
\def\nameskip{\vspace{2pt}}
\def\tempskip{\vspace{20pt}}
有什么建议么?
@leandriis 建议
\begin{document}
\begin{rSection}{IT and language}
\begin{tabularx}{\textwidth}{lX}%{ @{} >{\bfseries}l @{\hspace{3ex}} l }
MATLAB & 6+ years of experience in signal processing, image analysis, image segmentation, noise removal and quantitative data analysis \\
IT skills & Python (beginner), \LaTeX\ (advanced), MS Office (intermediate) \\
\end{tabularx}
\end{rSection}
\end{document}
答案1
借助tabularx
和\linewidth
:(红线表示边距)
\documentclass{resumeTechEngQuantLargeGap} % Use the custom resumeTechEngQuant.cls for style
\usepackage[left=0.4 in,top=0.4in,right=0.4 in,bottom=0.4in]{geometry} % Margins
\newcommand{\tab}[1]{\hspace{.2667\textwidth}\rlap{#1}}
\newcommand{\itab}[1]{\hspace{0em}\rlap{#1}}
%%% a square symbol
\usepackage{amssymb}
\makeatletter
\DeclareRobustCommand{\sqcdot}{\mathbin{\mathpalette\morphic@sqcdot\relax}}
\newcommand{\morphic@sqcdot}[2]{
\sbox\z@{$\m@th#1\centerdot$}%
\ht\z@=.3333\ht\z@
\vcenter{\box\z@}%
}
\makeatother
%---------------------------
% CV information
%---------------------------
\name{John Doe} % Your name
\address{124 Obsolete Street, Imagination Town. AB1 3ED \\ \underline{[email protected]} \\ +01 (0)23 4567 8901} % Your address
%---------------------------
% CV information
%---------------------------
\usepackage{tabularx}
\begin{document}
\begin{rSection}{IT and language}
\begin{tabularx}{\linewidth}{lX}%{ @{} >{\bfseries}l @{\hspace{3ex}} l }
MATLAB & 6+ years of experience in signal processing, image analysis, image segmentation, noise removal and quantitative data analysis \\
IT skills & Python (beginner), \LaTeX\ (advanced), MS Office (intermediate) \\
\end{tabularx}
\end{rSection}
\end{document}