Tabularx 和 Longtable 对齐

Tabularx 和 Longtable 对齐

我正在尝试使用 编写简历tabularx,但在对齐某些内容方面遇到了一些问题。我使用 来tabularx对齐单页上的部分,但longtable用于跨多页的部分。但生成的表格没有对齐。以下是(假)简历的一部分,说明了这个问题:

在此处输入图片描述

正如您所看到的,与常规表相比,长表中的淡灰色线再次向右移动。我该如何在不将所有表都改为长表的情况下纠正这个问题?谢谢!

代码如下:

\documentclass[10pt]{article}
\usepackage[margin=20mm]{geometry}
\title{\vspace{-15mm}\huge JOE BLOGGS\vspace{-5mm}}
\author{[email protected]}
\date{}

\usepackage{baskervillef} %font
\usepackage[T1]{fontenc} %font
\usepackage{nopageno} %eliminates page numbers
\usepackage[explicit]{titlesec} %adjust titles
\usepackage{longtable} %multi-page tables

\usepackage{array, xcolor}
\definecolor{lightgray}{gray}{0.8}
\newcolumntype{L}{>{\raggedleft}p{0.14\textwidth}}
\newcolumntype{R}{p{0.8\textwidth}}
\newcommand\VRule{\color{lightgray}\vrule width 0.5pt}

\setlength{\parindent}{0pt}

\titleformat{\section}{\normalfont}{\thesection}{1em}{\MakeUppercase{#1}}[\vspace{1mm} \titlerule]

\begin{document}

\maketitle

\noindent Areas of Particular Interest: dogs, aardvarks, amazing birds of paradise.

\vspace{1mm}

\noindent Areas of Interest: cats, honey badgers, goldfish.

\section*{Education}
\begin{tabular}{L!{\VRule}R}
    2018—2020 & MPhil in Zoology, University A.\\
    & \hspace{5mm} MPhil Thesis: \textit{999 Reasons Why Dogs Are Better than Cats}\\
    & \hspace{5mm} Supervisors: Scooby \& Snoopy\\
    & \hspace{5mm} Examiners: Fido (Internal) \& Laika (External) \vspace{1mm}\\
    2014—2017 & BA in Zoology (First), University B.\\
\end{tabular}

\section*{Works in Progress}
\begin{tabular}{L!{\VRule}R}
    2020 & \textit{Aardvarks and Their Discontents.} Revise \& resubmit in the \textit{Journal of Zoology}. \vspace{1mm}\\
    2020 & \textit{Should We Care for Wild Animals?} Revise \& resubmit in \textit{Zoological Studies}.
\end{tabular}

\section*{Presentations}

\begin{tabular}{L!{\VRule}R}
    February 2021 & \textit{Should Animals Be Sent into Space?} Paper to be presented at the 24\textsuperscript{th} Oxford Zoology Graduate Conference, University of Oxford, UK.\vspace{1mm}\\
    July 2020 & \textit{Why Do Cats Hate Water?} Paper presented at the 13\textsuperscript{th} Annual Cambridge Graduate Conference on Zoology, University of Cambridge, UK.\vspace{1mm}\\
\end{tabular}

\vspace{\baselineskip}

\begin{tabular}{L!{\VRule}R}
    February 2020 & \textit{Are Cats Really Smarter than Dogs? A Summary of Recent Research}. Paper presented at the Friday Seminar, University A, UK.\vspace{1mm}\\
    December 2019 & \textit{How Many Times Did Laika Orbit the Earth? Ethical Issues Surrounding Space Exploration} Paper presented at the Zoology Group, University A, UK.\vspace{1mm}\\
\end{tabular}

\section*{Awards}

\begin{tabular}{L!{\VRule}R}
    2020 & Generic academic award for being amazing, contributing to the department, and many other things. University A, UK.\vspace{1mm}\\
    2020 & Another generic academic award for being amazing, contributing to the department, and many other things. University A, UK.\vspace{1mm}\\
    2020 & Another generic award for being amazing, contributing to the department, and many other things. University A, UK.\vspace{1mm}\\
    2020 & Another generic award for being amazing, contributing to the department, and many other things. University A, UK.\vspace{1mm}\\
    2020 & Another generic award for being amazing, contributing to the department, and many other things. University A, UK.\vspace{1mm}\\
\end{tabular}

\section*{Teaching Experience}

\begin{longtable}{L!{\VRule}R}
    2020 & Taught Undergraduates Zoology. University A, UK.\\
    2020 & Taught Undergraduates Zoology. University A, UK.\\
    2020 & Taught Undergraduates Zoology. University A, UK.\\
    2020 & Taught Undergraduates Zoology. University A, UK.\\
    2020 & Taught Undergraduates Zoology. University A, UK.\\
\end{longtable}

\section*{Academic Service}

\begin{tabular}{L!{\VRule}R}
    2020 & Head of the Zoology Society. University A, UK.\vspace{1mm}\\
    2020 & Convenor of the Zoology Reading Group. University A, UK.\vspace{1mm}\\
    2020 & Referee, Zoology Graduate Conference. University A, UK.\vspace{1mm}
\end{tabular}

\end{document}

答案1

那是你要的吗 ?

如果您想更改\title,请打开article.cls、复制粘贴并\maketitle根据需要进行更改:

\makeatletter
    \def\@maketitle{%
  \newpage
  \null
  \vskip 2em%
  \begin{center}%
  \let \footnote \thanks
    {\huge \@title \par}% <=\LARGE by default
    \vskip 1.5em%
    {\large
      \lineskip .5em%
      \begin{tabular}[t]{c}%
        \@author
      \end{tabular}\par}%
    \vskip 1em%
    {\large \@date}%
  \end{center}%
  \par
  \vskip 1.5em}
\makeatother

编辑 :

\documentclass[10pt]{article}
\usepackage{etoolbox}
\AtBeginEnvironment{tabularx}{\medskip}%before
\AtEndEnvironment{tabularx}{\medskip}%after
\usepackage[margin=20mm]{geometry}
\title{ JOE BLOGGS}
\author{[email protected]}
\date{}

\usepackage{baskervillef} %font
\usepackage[T1]{fontenc} %font
\usepackage{nopageno} %eliminates page numbers
\usepackage[nobottomtitles,explicit]{titlesec} %adjust titles
\usepackage{array,tabularx,longtable} %multi-page tables
\usepackage[table]{xcolor}
\definecolor{lightgray}{gray}{0.8}
\newcolumntype{L}{>{\raggedleft}p{0.14\textwidth}}
\newcolumntype{R}{p{0.8\textwidth}}
\newcommand\VRule{\color{lightgray}\vrule width 0.5pt}%no need | do the same job perfectly

%\titleformat{\section}{\normalfont}{\textbf{}}{0em}{\textbf{#1}}

\titleformat{\section}{\normalfont}{\thesection}{1em}{\MakeUppercase{#1}}[ \titlerule]

\setlength{\parindent}{0pt}
\setlength{\extrarowheight}{5pt}
\arrayrulecolor{gray}
\usepackage{lipsum}


    
    
\begin{document}

\maketitle

 Areas of Particular Interest: dogs, aardvarks, amazing birds of paradise.



 Areas of Interest: cats, honey badgers, goldfish.

\section*{Education}
\begin{tabularx}{\textwidth}{L|@{\quad}R}
    2018--2020 & MPhil in Zoology, University A.\\
%   & Attained distinctions in every module in first year.\\
    &  MPhil Thesis: \textit{999 Reasons Why Dogs Are Better than Cats}\\
    & Supervisors: Scooby \& Snoopy\\
    & Examiners: Fido (Internal) \& Laika (External) \\
    2014--2017 & BA in Zoology (First), University B.\\
    %& \hspace{5mm} Upper Second Class.\\
    %2011--2013 & \textbf{A Levels, King Edward VI School (Southampton)}\\
    %& Mathematics (A*), Chemistry (A*), Biology (A*), \& Economics (A*).
\end{tabularx}

\section*{Works in Progress}
\begin{tabularx}{\textwidth}{L|@{\quad}R}
    2020 & \textit{Aardvarks and Their Discontents.} Revise \& resubmit in the \textit{Journal of Zoology}. \\
    2020 & \textit{Should We Care for Wild Animals?} Revise \& resubmit in \textit{Zoological Studies}.
\end{tabularx}

\section*{Presentations}

\begin{tabularx}{\textwidth}{L|@{\quad}R}
    February 2021 & \textit{Should Animals Be Sent into Space?} Paper to be presented at the 24\textsuperscript{th} Oxford Zoology Graduate Conference, University of Oxford, UK.\\
    July 2020 & \textit{Why Do Cats Hate Water?} Paper presented at the 13\textsuperscript{th} Annual Cambridge Graduate Conference on Zoology, University of Cambridge, UK.\\
\end{tabularx}

%\vspace{\baselineskip} %no need etooolbox do this for you

\begin{tabularx}{\textwidth}{L|@{\quad}R}
    February 2020 & \textit{Are Cats Really Smarter than Dogs? A Summary of Recent Research}. Paper presented at the Friday Seminar, University A, UK.\\
    December 2019 & \textit{How Many Times Did Laika Orbit the Earth? Ethical Issues Surrounding Space Exploration} Paper presented at the Zoology Group, University A, UK.\\
\end{tabularx}

\section*{Awards}

\begin{tabularx}{\textwidth}{L|@{\quad}R}
    2020 & Generic academic award for being amazing, contributing to the department, and many other things. University A, UK.\\
    2020 & Another generic academic award for being amazing, contributing to the department, and many other things. University A, UK.\\
    2020 & Another generic award for being amazing, contributing to the department, and many other things. University A, UK.\\
    2020 & Another generic award for being amazing, contributing to the department, and many other things. University A, UK.\\
    2020 & Another generic award for being amazing, contributing to the department, and many other things. University A, UK.\\
\end{tabularx} 

\section*{Teaching Experience}

\begin{longtable}{L|@{\quad}R}
   2020 & \lipsum[1]\\
    2020 & \lipsum[1]\\
    2020 & Taught Undergraduates Zoology. University A, UK.\\
    2020 & Taught Undergraduates Zoology. University A, UK.\\
    2020 & Taught Undergraduates Zoology. University A, UK.\\
\end{longtable}


\end{document}

在此处输入图片描述

相关内容