我想删除语言和熟练程度之间的空格。这是使用表格组件生成的,我无法删除标题和行内容之间的大空格。该怎么做?
这是用于生成此代码的代码
% Document class and font size
\documentclass[a4paper,9pt]{extarticle}
% Packages
\usepackage[utf8]{inputenc} % For input encoding
\usepackage{geometry} % For page margins
\geometry{letterpaper, margin=0.75in} % Set paper size and margins
\usepackage{tabularx}
% Formatting
\setlist{noitemsep} % Removes item separation
\titleformat{\section}{\large\bfseries}{\thesection}{1em}{}[\titlerule] % Section title format
\titlespacing*{\section}{0pt}{\baselineskip}{\baselineskip}
\begin{document}
\section*{LANGUAGES}
\begin{center}
\noindent
\begin{tabular*}{0.95\textwidth}{
@{\extracolsep{\fill}}
l @{\ ---\ \extracolsep{0pt}} l @{\extracolsep{\fill}}
l @{\ ---\ \extracolsep{0pt}} l @{\extracolsep{\fill}}
l @{\ ---\ \extracolsep{0pt}} l
@{}
}
\multicolumn{2}{@{}l}{\textbf{English} (Native)} &
\multicolumn{2}{@{}l}{\textbf{French}} &
\multicolumn{2}{@{}l@{}}{\textbf{Polish}} \\[2ex]
Speaking & \textit{Fluent} & Speaking & \textit{Limited} & Speaking & \textit{Proficient} \\
Listening & \textit{Fluent} & Listening & \textit{Limited} & Listening & \textit{Proficient} \\
Reading & \textit{Fluent} & Reading & \textit{Proficient} & Reading & \textit{Limited} \\
Writing & \textit{Fluent} & Writing & \textit{Intermediate} & Writing & \textit{Basic} \\
\end{tabular*}
\end{center}
\end{document}
答案1
为了减少标题规则和环境第一行之间的空白量
tanular*
,请将第四个参数的值设置为较小值\titlespacing*
。在您的代码中,此参数为1\baselineskip
;我建议您将其减少为0.75\baselineskip
。为了减少环境第一行和第二行之间的空白量
tabular*
,可以更改\\[2ex]
为\\[0.5ex]
。
\documentclass[9pt]{extarticle} % no need for 'a4paper' option
\usepackage{iftex}
\ifpdftex
%\usepackage[utf8]{inputenc} % that's the default nowadays
\usepackage[T1]{fontenc} % <-- new
\else
\usepackage{fontspec}
\fi
\usepackage{geometry}
\geometry{letterpaper, margin=0.75in} % paper size and margins
%\usepackage{tabularx} % not needed
\usepackage{array} % <-- new
\newcolumntype{L}{>{\itshape}l} % <-- automatic italics
%\usepackage{enumitem} % not needed
%\setlist{noitemsep} % not needed
\usepackage{titlesec} % <-- new
\titleformat{\section}{\large\bfseries}{\thesection}{1em}{}[\titlerule]
\titlespacing*{\section}{0pt}{1\baselineskip}{0.75\baselineskip}
\begin{document}
\section*{LANGUAGES}
\begin{center}
\setlength\tabcolsep{0pt} % <-- new
\begin{tabular*}{0.95\textwidth}{% why not '1\textwidth'?
@{\extracolsep{\fill}}
l @{ --- \extracolsep{0pt}} L
@{\extracolsep{\fill}}
l @{ --- \extracolsep{0pt}} L
@{\extracolsep{\fill}}
l @{ --- \extracolsep{0pt}} L
}
\multicolumn{2}{l}{\textbf{English} (Native)} &
\multicolumn{2}{l}{\textbf{French}} &
\multicolumn{2}{l}{\textbf{Polish}} \\[0.5ex] % '2ex' is too much
Speaking & Fluent & Speaking & Limited & Speaking & Proficient \\
Listening & Fluent & Listening & Limited & Listening & Proficient \\
Reading & Fluent & Reading & Proficient & Reading & Limited \\
Writing & Fluent & Writing & Intermediate & Writing & Basic \\
\end{tabular*}
\end{center}
\end{document}