我怎样才能拥有具有匹配列的多个表?

我怎样才能拥有具有匹配列的多个表?

我喜欢打字记录我的旅行计划。当我开始学习 LaTeX 时,我想用它。经过一番尝试,我发现我需要定义两者utf8xlibertine让欧元符号出现。

我有三个tabular部分,每个部分包含等效的信息。

  1. 我可以强制所有三个表(或至少前两个表)具有相同宽度的列吗?
  2. 我可以让时间(第一列和第三列)与以下车站名称(第二列和第四列)相当紧密吗?
  3. 为什么最后的表格要缩进?

article我只是在学习,所以除了我的主要问题(例如,我应该使用吗?)之外,我愿意考虑任何和所有的改进建议。

\documentclass[a4paper]{article}
\usepackage[utf8x]{inputenc}
\usepackage{libertine}
\usepackage[margin=0.5in]{geometry}
\pagenumbering{gobble}
\begin{document}
\title{Drachenwald Summer Coronation}
\date{16th - 18th June 2017}
\maketitle

\section*{Travel from Tullamore}

Ticket collection number: XXX XXXXXXXX \\
Booking number: XXXXXXXX \\
Booking status: Confirmed

\subsection*{Payment Details}

\begin{tabular}{ l l l r }
Payment method & Reference     & Status    & Amount \\
CC3DS          & XXXXXXXX-XXXX & Confirmed & €49.96 \\
CC3DS          & XXXXXXXX-XXXX & Failed    & €49.96
\end{tabular}

\subsection*{Friday, 16th June: Tullamore to Drogheda}

\begin{tabular}{ l l l l l r l }
18:48 & Tullamore       & 19:54 & Dublin Heuston    & A717 Coach A Seat 41 & €11.49 & Flexible \\
20:50 & Dublin Connolly & 21:29 & Drogheda MacBride & A136 Coach D Seat 08 & €11.79 & Flexible
\end{tabular}

\subsection*{Sunday, 18th June: Drogheda to Tullamore}

\subsubsection*{Booked Ticket}

\begin{tabular}{ l l l l l r l }
14:40 & Drogheda MacBride & 15:15 & Dublin Connolly & A145 Coach D Seat 44 & €11.79 & Flexible \\
16:35 & Dublin Heuston    & 17:31 & Tullamore       & A706 Coach E Seat 16 & €11.49 & Flexible \\
\end{tabular}

\subsubsection*{Other Options}
As the ticket is flexible, later travel options are available:

\begin{tabular}{l l l l l}
15:45 & Drogheda MacBride & 16:39 & Dublin Connolly & Commuter to Dublin Pearse \\
18:30 & Dublin Heuston    & 19:31 & Tullamore       & InterCity to Westport \\
\\
17:47 & Drogheda MacBride & 18:42 & Dublin Connolly & Commuter to Dublin Pearse \\
20:30 & Dublin Heuston    & 21:24 & Tullamore       & InterCity to Galway Ceannt
\end{tabular}

\end{document}

这个问题在评论中已经得到了很大程度的回答(不知道人们为什么这样做)。修改后的代码(如下)看起来干净整洁。然而,仍然存在一些问题:

  1. 这之所以有效,是因为时间列(第一列和第三列)恰好具有相同的宽度。如果我在早上出行(三位数时间而不是四位数时间),情况可能并非如此。在这种情况下,我也必须手动设置宽度吗?
  2. 每次都必须手动设置宽度,这似乎很麻烦。如果我想更改宽度,我必须编辑每个表格。(实际上这不是问题,因为单页文档中只有三个表格,但我正在尝试学习最佳实践,无论它们是什么,但这感觉不对。)有没有办法告诉 LaTeX 后面的表格应该与前面的表格匹配?

这就是我现在得到的。它包含了评论中建议的更改,并且在最后一个表格的两边各有一个手动换行符,以将其与周围的段落区分开来。

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{libertine}
\usepackage[margin=0.5in]{geometry}
\pagenumbering{gobble}
\begin{document}
\title{Drachenwald Summer Coronation}
\date{16th - 18th June 2017}
\maketitle

\section*{Travel from Tullamore}

Ticket collection number: XXX XXXXXXXX \\
Booking number: XXXXXXXX \\
Booking status: Confirmed

\subsection*{Payment Details}

\begin{tabular}{ l l l r }
Payment method & Reference     & Status    & Amount \\
CC3DS          & XXXXXXXX-XXXX & Confirmed & €49.96 \\
CC3DS          & XXXXXXXX-XXXX & Failed    & €49.96
\end{tabular}

\subsection*{Friday, 16th June: Tullamore to Drogheda}

\begin{tabular}{ l p{4cm} l p{4cm} l r l }
18:48 & Tullamore       & 19:54 & Dublin Heuston    & A717 Coach A Seat 41 & €11.49 & Flexible \\
20:50 & Dublin Connolly & 21:29 & Drogheda MacBride & A136 Coach D Seat 08 & €11.79 & Flexible
\end{tabular}

\subsection*{Sunday, 18th June: Drogheda to Tullamore}

\subsubsection*{Booked Ticket}

\begin{tabular}{ l p{4cm} l p{4cm} l r l }
14:40 & Drogheda MacBride & 15:15 & Dublin Connolly & A145 Coach D Seat 44 & €11.79 & Flexible \\
16:35 & Dublin Heuston    & 17:31 & Tullamore       & A706 Coach E Seat 16 & €11.49 & Flexible \\
\end{tabular}

\subsubsection*{Other Options}

As the ticket is flexible, later travel options are available:

\noindent
\\
\begin{tabular}{l p{4cm} l p{4cm} l}
15:45 & Drogheda MacBride & 16:39 & Dublin Connolly & Commuter to Dublin Pearse \\
18:30 & Dublin Heuston    & 19:31 & Tullamore       & InterCity to Westport \\
\\
17:47 & Drogheda MacBride & 18:42 & Dublin Connolly & Commuter to Dublin Pearse \\
20:30 & Dublin Heuston    & 21:24 & Tullamore       & InterCity to Galway Ceannt
\end{tabular}
\\

The location for the event is Newgrange Lodge. This is located just a moment’s walk from the Brú na Bóinne visitors centre, which is the gateway to Newgrange. Newgrange is a passage tomb that was built during the Neolithic period around 3200 BC, and is older than Stonehenge and the Egyptian pyramids.

The train and bus stations in Drogheda {\bf do not} have taxi ranks. Booking ahead is recommended. If you like to use an app, the local taxis use mytaxi. The site is 7.5km from Drogheda, and a taxi costs about €20.

\end{document}

相关内容