0

I'm trying to write my CV using tabularx, but I'm having some problems with getting some things to align. I'm using tabularx for sections on single pages, but longtable for sections spanning multiple pages. But the resulting tables do not align. Here's a section of a (fake) CV illustrating the issue:

enter image description here

As you can just about see, the faint grey line has again been shifted rightwards in the longtable compared to the regular tables. How can I rectify this without changing all the tables to longtables? Thanks!

Here's the code:

\documentclass[10pt]{article}
\usepackage[margin=20mm]{geometry}
\title{\vspace{-15mm}\huge JOE BLOGGS\vspace{-5mm}}
\author{joebloggs@gmail.com}
\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}
2
  • Add in the preamble \setlength{\parindent}{0pt} to delete indentation.
    – Aviroum
    Nov 24, 2020 at 14:09
  • Thanks! That gets rid of the first right shift but doesn't solve the problem with longtable which is still slightly shifted to the right. Any ideas on what's causing that? Nov 24, 2020 at 14:16

1 Answer 1

0

Is that what you want ?

If you want to change \title , open article.cls, copy paste and change \maketitle as you want :

\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

Edit :

\documentclass[10pt]{article}
\usepackage{etoolbox}
\AtBeginEnvironment{tabularx}{\medskip}%before
\AtEndEnvironment{tabularx}{\medskip}%after
\usepackage[margin=20mm]{geometry}
\title{ JOE BLOGGS}
\author{joebloggs@gmail.com}
\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}

enter image description here

10
  • Not quite: I want to use longtable for sections which span over multiple pages, but when I do so the faint grey line is shifted rightwards slightly. In the original example this section was entitled 'Teaching Experience', but in your answer its been changed to tabularx. Nov 25, 2020 at 10:46
  • I edit my answer. You can use supertabularpackage. You get the same result.
    – Aviroum
    Nov 25, 2020 at 21:33
  • You can add nobottomtitlesoption to titlesec to get section title in the top of the next page.
    – Aviroum
    Nov 25, 2020 at 22:17
  • Thanks for your help! Is there a way of resolving this issue that doesn't involve changing all the tables to longtables? I've edited the question to make it clearer what I'm after so that it just focusses on the tabularx and longtable alignment issue. Nov 26, 2020 at 10:27
  • Do you mean you want just tabularx for some tabular environments and just longtable when you want page break ?
    – Aviroum
    Nov 26, 2020 at 16:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .