Graphics, Figures & Tables\hfill last column in tabular

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
zenzike
Posts: 3
Joined: Thu Jun 11, 2009 7:17 pm

\hfill last column in tabular

Post by zenzike »

I'm trying to make the last column in a tabular environment be on the far right hand side of the page (as close to \textwidth as possible), and thought that this would work:

Code: Select all

\begin{tabular}{lll}
foo & foo & \hfill goo \\
foo & foo 
\end{tabular}
Sadly, this isn't working, and goo just sits where it does (right next to foo). Does anybody know how I might be able to do this?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

\hfill last column in tabular

Post by localghost »

The additional array and tabularx package will do the trick.

Code: Select all

\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{babel}
\usepackage{array,tabularx}

\begin{document}
  \begin{tabularx}{\textwidth}{ll>{\raggedleft\arraybackslash}X}
    foo & foo & goo \\
    foo & foo &
  \end{tabularx}
\end{document}

Best regards and welcome to the board
Thorsten
zenzike
Posts: 3
Joined: Thu Jun 11, 2009 7:17 pm

Re: \hfill last column in tabular

Post by zenzike »

Thanks very much!
Post Reply