Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to align times by their colon in a LaTeX-tabular?

I have a tabular of the times I in LaTeX.

These times are in the form 4:00 or 12:00 and this have different lengths. I would like to vertically align these times by their colon. Is there a nice way to do this in LaTeX?

like image 703
bastibe Avatar asked Oct 25 '25 04:10

bastibe


2 Answers

You can use @{}, or in your case @{:} as a column delimiter.

\begin{tabular}{l|r@{:}l}
  first & 12 & 00 \\
  second & 4 & 00 \\
\end{tabular}
like image 180
Svante Avatar answered Oct 26 '25 22:10

Svante


More or less like this:

\begin{tabular}{r@{:}l}
12&44\\
2&01\\
22&11
\end{tabular}

You may want to introduce some very small space around the ":", like \hspace{1pt}

like image 37
AVB Avatar answered Oct 26 '25 23:10

AVB



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!