1

I would like to have a simple table with three columns, where the first is left aligned, the second one is center aligned, and the last one is right aligned. For this I am trying to use tabularx but I can't manage to get it to work. This is the MWE:

\documentclass{article}

\usepackage{tabularx}
\usepackage{hyperref}

\begin{document}

\begin{tabularx}{\linewidth}{>{\raggedright}m{0.33\linewidth}>{\centering}m{0.33\linewidth}>{\raggedleft}m{0.33\linewidth}}
{\Large First Author} & {\Large Second Author} & {\Large Third Author} \\
{ First Institution, which can be very long} & {Second Institution, which can also be very long} & {Third Institution, which can be very long as well and I need to prevent hyphenation} \\
\href{mailto:first@author.net}{first@author.net} &  \href{mailto:second@author.net}{second@author.net}  & \href{mailto:third@author.net}{third@author.net}  \\ 
\end{tabularx}


\end{document}

The institutions are long, and so I can't have them hyphenated. What am I doing wrong?

1

You should:

  • not use tabularx without a X column (here you don't need one)
  • use \arraybackslash
  • maybe reduce your column width as it may add up to something greater than textwidth

MWE:

\documentclass{article}

\usepackage{array}
\usepackage{hyperref}

\begin{document}

\begin{tabular}{>{\raggedright\arraybackslash}m{0.33\linewidth}>{\centering\arraybackslash}m{0.33\linewidth}>{\raggedleft\arraybackslash}m{0.33\linewidth}}
{\Large First Author} & {\Large Second Author} & {\Large Third Author} \\
{ First Institution, which can be very long} & {Second Institution, which can also be very long} & {Third Institution, which can be very long as well and I need to prevent hyphenation} \\
\href{mailto:first@author.net}{first@author.net} &  \href{mailto:second@author.net}{second@author.net}  & \href{mailto:third@author.net}{third@author.net}  \\ 
\end{tabular}


\end{document}

Alternatively you can use tabularx (advantage: automatic column width), but then using a redefined column type X:

tabularx

\documentclass{article}

\usepackage{tabularx}
\usepackage{hyperref}

\begin{document}

\begingroup
\renewcommand*{\tabularxcolumn}[1]{m{#1}}
\begin{tabularx}{\textwidth}{>{\raggedright\arraybackslash}X>{\centering\arraybackslash}X>{\raggedleft\arraybackslash}X}
{\Large First Author} & {\Large Second Author} & {\Large Third Author} \\
{ First Institution, which can be very long} & {Second Institution, which can also be very long} & {Third Institution, which can be very long as well and I need to prevent hyphenation} \\
\href{mailto:first@author.net}{first@author.net} &  \href{mailto:second@author.net}{second@author.net}  & \href{mailto:third@author.net}{third@author.net}  \\ 
\end{tabularx}
\endgroup

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.