0

In the following MWE, I'd like the longtable look identical to the table. How to move it to the left so it fits how the table is formatted? I could simply just use longtables, but it needs to be aligned further to the left of the page.

\documentclass[a4paper]{tufte-handout}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{longtable}
\usepackage{tabularx} % better tables
\setlength{\extrarowheight}{3pt} % increase table row height
\newcommand{\tableheadline}[1]{\multicolumn{1}{l}{\spacedlowsmallcaps{#1}}}
\newcommand{\myfloatalign}{\centering} % to be used with each float for alignment
\newcolumntype{L}{>{\raggedleft}p{0.18\textwidth}}
\newcolumntype{R}{p{.78\textwidth}}
\newcommand\VRule{\vrule width 0.5pt}

\begin{document}
    

\section{Small List}
\begin{table}[h]
    \myfloatalign
    \begin{tabularx}{\textwidth}{l|X}
        2017 & Something Happened that year\\   
        2016 & That year too \\
    \end{tabularx}
\end{table} 
\bigskip

\section{Long List}
\begingroup
\begin{longtable}{L!{\VRule}R}
    2017 & Something Happened that year\\   
    2016 & That year too \\
\end{longtable}
\endgroup   
\end{document}

screenshot of LaTeX rendering

2
  • 2
    \setlength\LTleft{0pt} Commented Jan 26, 2022 at 23:40
  • \setlength\LTleft{-35pt} in the preamble did the job. Write it in a short answer to get the stackexchange karma!
    – Max N
    Commented Jan 27, 2022 at 8:49

2 Answers 2

1

From your own answer, it seems what you want is full width tables. But your own answer is wrong if you add hlines to the tables. The following is a better answer with several long or short table environments.

\documentclass[a4paper]{tufte-handout}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{tabularx}
\usepackage{xltabular}
\usepackage{tabularray}

\setlength{\extrarowheight}{3pt}
\newcommand\VRule{\vrule width 2pt}

\begin{document}

\section{Tabularx (short)}

\begin{table}[!htbp]
  \begin{tabularx}{\textwidth}{l!{\VRule}X}
  \hline
    2017 & Something Happened that year\\   
    2016 & That year too \\
  \hline
  \end{tabularx}
\end{table} 
\bigskip

\section{Xltabular (long)}

\begin{xltabular}{\textwidth}{l!{\VRule}X}
  \hline
    2017 & Something Happened that year\\   
    2016 & That year too \\
  \hline
\end{xltabular}

\section{Tabularray (short)}

\begin{table}[!htbp]
  \begin{tblr}{l|[2pt]X}
  \hline
    2017 & Something Happened that year\\   
    2016 & That year too \\
  \hline
  \end{tblr}
\end{table}

\section{Tabularray (long)}

\SetTblrTemplate{head}{empty}
\begin{longtblr}{l|[2pt]X}
  \hline
    2017 & Something Happened that year\\   
    2016 & That year too \\
  \hline
\end{longtblr}

\end{document}

enter image description here

2
  • Very cool. Thanks. Now I wonder how it would be possible to use the margin in tufte-handout for a \sidenote or \marginnote from within the table. Is that possible at all?
    – Max N
    Commented Feb 2, 2022 at 17:16
  • 1
    @MaxN I am not sure. You could ask a new question, and maybe someone else can help you.
    – L.J.R.
    Commented Feb 3, 2022 at 0:07
0

I've extended the MWE to include the modern tabularray package

\documentclass[a4paper]{tufte-handout}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{longtable}
\usepackage{tabularx} % better tables
\setlength{\extrarowheight}{3pt} % increase table row height
\setlength\LTleft{-35pt}
\newcommand{\tableheadline}[1]{\multicolumn{1}{l}{\spacedlowsmallcaps{#1}}}
\newcommand{\myfloatalign}{\centering} % to be used with each float for alignment
\newcolumntype{L}{>{\raggedleft}p{0.18\textwidth}}
\newcolumntype{R}{p{.78\textwidth}}
\newcommand\VRule{\vrule width 0.5pt}

\usepackage{tabularray}


\begin{document}
    

\section{Tabularx}
\begin{table}[h]
    \myfloatalign
    \begin{tabularx}{\textwidth}{l|X}
        2017 & Something Happened that year\\   
        2016 & That year too \\
    \end{tabularx}
\end{table} 
\bigskip

\section{Longtable}
\begingroup
\begin{longtable}{L!{\VRule}R}

    2017 & Something Happened that year\\   
    2016 & That year too \\
\end{longtable}
\endgroup   
\bigskip

\section{Tabularray}
\begin{table}[!htpb]
    \begin{tblr}{r|X}
    2017 & Something Happened that year\\   
    2016 & That year too \\
    \end{tblr}
\end{table}

\end{document}

rendered output

You must log in to answer this question.

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