# Align emails in table

I am trying to vertically align email adresses one below the other at the @ symbol in a table. I would like to avoid using two separate columns.

I tried using the siunitx package but, despite reading the documentation, cannot find if it can be properly applied to text. It sort of does the job when I try to use the S type column but throw errors as the value is not a number. If I wrap everything in \text{} it does not align anything anymore.

The aim is to have working email hyperlinks properly aligned so that the domain name is fixed.

### MWE

\documentclass{article}
\usepackage{mwe}
\usepackage{siunitx}
\begin{document}
\begin{tabular}{ll}
1 & a@tex \\
2 & ab@tex
\end{tabular}
\end{document}


### Results

1. l column:

2. S column:

How many are you email addresses?

If they are few you could use this workaround:

\documentclass{article}
\usepackage{mwe}
\usepackage{array}
\usepackage{hyperref}
\begin{document}
\begin{tabular}{l>{\ttfamily}l}
1 & \phantom{xxx}\href{mailto:a@tex}{a@tex} \\
2 & \phantom{xx}\href{mailto:ab@tex.eu}{ab@tex.eu}\\
3 & \href{mailto:abcd@tex.com}{abcd@tex.com}\\
4 & \phantom{x}\href{mailto:abc@tex.it}{abc@tex.it} \\
\end{tabular}
\end{document}


If they are many, I think it's possible to count the chars before the @ and built the \phantom accordingly (I've given the idea, I think some TeXpert here can implement it).

• I guess four or five adresses at maximum. So this is indeed a great idea. I would need a counter with the max length and subtract the numbers of chars from it to automatise the process. In the mean time, this is a quick fix I can use, thanks. – Florian Sep 26 '17 at 8:57

You might not like this because you do need two columns here and the link works but is only clickable on the part before the @ symbol. But at least it gives you what you want: The first @suppresses the intercolumn space and the second replaces the column separator with the @ symbol.

\begin{tabular}{r@{@}l}
a&tex\\
ab&tex\\
a&tx\\
ab&tx\\
\href{mailto:mynamedomain.com}{myname}&domain.com\\
\end{tabular}


yields

• One could, of course, make all three parts clickable by making each one of them a link. Then it's technically not just one link, but depending on the link style that might not be noticeable (for the style shown in this answer it's probably fine, whereas if there's a rectangle drawn around every url then there will be 3 rectangles, which wouldn't look nice). – magula Sep 22 '17 at 15:46
• It is a nice proposition but I would rather find a way without having to divide my column in two. Indeed, it requires me to manually split email adresses which could lead to errors, and the hyperlink is also cut by the @ separator (I did not manage to make it a link as well). – Florian Sep 25 '17 at 12:53