![对齐表格中的两行](https://linux22.com/image/409131/%E5%AF%B9%E9%BD%90%E8%A1%A8%E6%A0%BC%E4%B8%AD%E7%9A%84%E4%B8%A4%E8%A1%8C.png)
我正在使用 longtable 构建简历。我希望将“第二行”的第一个单词与带有项目符号的列表中第一行的第一个单词对齐。
以下是一个例子:
%%%%%%%%%%%%%%%%% PREAMBLE %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Change the font size of your document - 10pt, 12.1pt, etc.
\documentclass[letterpaper,8pt,oneside]{article}
\usepackage[utf8]{inputenc}
\usepackage{setspace}
\usepackage{booktabs}% http://ctan.org/pkg/booktabs
\newcommand{\tabitem}{~~\llap{\textbullet}~~}
\usepackage{longtable}
\usepackage{microtype}
\usepackage{booktabs, multirow, xltabular}
\usepackage{scrextend}
\usepackage{marvosym}
\usepackage[centering, left=2cm, bottom=2cm, top=2cm]{geometry}
%\usepackage[centering,includeheadfoot,margin=2cm]{geometry}
\usepackage{array}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
%% Distances
% width of the table
\newcommand\x{11cm} % width
% distance line-bold
\newcommand\dista{0.2cm}
% distance bold-text
\newcommand\distb{0.01cm}
% distance text-bold/line
\newcommand\distc{0.4cm}
\begin{document}
\vspace{-0.2cm}
\begin{longtable}{@{} >{}l p{\x} @{}}
\hline \noalign{\vskip \dista}
\Large{\textbf{Academic Experience}} &
\textbf{Teaching Assistantship} \\[\distb]
\small{Spring 2020}
&
\tabitem Open Economy Macroeconomics, IDEA Ph.D. program, UAB. Mario Rossi Vella\\
\small{Fall 2018 and Fall 2019}
&
Macroeconomics I, IDEA Ph.D. program, UAB. Prof. Mario Rossi Vella \\
\small{Fall 2019}
&
\tabitem Econometric I with R (in Spanish), undergraduate, UAB. Mario Rosahahahsi Vellalalal.\\
\small{Fall 2018}
&
\tabitem Econometrics I with GRETL (in Spanish), undergraduate, UAB. Lauraahaha Pinyol.\\
\small{Spring 2018}
&
\tabitem Statistics I with GRETL (in Spanish), undergraduate, UAB.\\ \addlinespace[\distc]
\end{longtable}
\end{document}
答案1
这是一种简单的方法,使用补充列来显示项目符号。我对布局进行了一些改进,并简化了一些代码:
\documentclass[letterpaper,8pt,oneside]{article}
\usepackage[utf8]{inputenc}
\usepackage{setspace}
\usepackage{booktabs}% http://ctan.org/pkg/booktabs
\let\tabitem\textbullet
\usepackage{longtable}
\usepackage{microtype}
\usepackage{booktabs, multirow, xltabular}
\usepackage{scrextend}
\usepackage{marvosym}
\usepackage[centering, left=2cm, vmargin=2cm]{geometry}
\usepackage{array}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
%% Distances
% width of the table
\newcommand\x{11cm} % width
% distance line-bold
\newcommand\dista{0.2cm}
% distance bold-text
\newcommand\distb{0.01cm}
% distance text-bold/line
\newcommand\distc{0.4cm}
\begin{document}
\vspace{-0.2cm}
\setlength{\extrarowheight}{3pt}
\begin{longtable}{>{\small}ll@{\hskip\labelsep} p{\x} @{}}
\hline \noalign{\vskip \dista}
\Large{\textbf{Academic Experience}} &
\multicolumn{2}{l}{\textbf{Teaching Assistantship}} \\\addlinespace[1ex]
Spring 2020
& \tabitem & Open Economy Macroeconomics, IDEA Ph.D. program, UAB. Mario Rossi Vella\\
Fall 2018 and Fall 2019
&
\multicolumn{2}{l}{Macroeconomics I, IDEA Ph.D. program, UAB. Prof. Mario Rossi Vella} \\
Fall 2019
& \tabitem & Econometric I with R (in Spanish), undergraduate, UAB. Mario Rosahahahsi Vellalalal.\\
Fall 2018
& \tabitem & Econometrics I with GRETL (in Spanish), undergraduate, UAB. Lauraahaha Pinyol.\\
Spring 2018
& \tabitem & Statistics I with GRETL (in Spanish), undergraduate, UAB.\\ \addlinespace[\distc]
\end{longtable}
\end{document}