Graphics, Figures & Tables\raggedright, \hline, and the tabular environment

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

\raggedright, \hline, and the tabular environment

Post by kaiserkarl13 »

Is there any way to make the last column of a table a left-aligned cell with an \hline below it? The following code breaks:

Code: Select all

\documentclass[12pt]{article}

\begin{document}

\begin{tabular}{l l l p{1em}}
\hline
a & b & c & d \raggedright \\ \hline
\end{tabular}

\end{document}
Similarly non-functional is

Code: Select all

\begin{tabular}{l >{\raggedright}p{1em}
                  >{\raggedright}p{1em} 
                  >{\raggedright}p{1em} |
                  >{\raggedright}p{1em} 
                  >{\raggedright}p{1em}
                  >{\raggedright}p{1em}
               } \hline \hline
  a & b & c & d & e & f & g \\ \hline
\end{tabular}
Last edited by kaiserkarl13 on Thu Apr 16, 2009 3:05 am, edited 1 time in total.

Recommended reading 2024:

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

NEW: TikZ book now 40% off at Amazon.com for a short time.

Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

\raggedright, \hline, and the tabular environment

Post by Stefan Kottwitz »

Hi Karl,

this will work:

Code: Select all

\raggedright\let\\\tabularnewline
Or just use \tabularnewline instead of \\.

Stefan
LaTeX.org admin
kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

Re: \raggedright, \hline, and the tabular environment

Post by kaiserkarl13 »

I've been wracking my brain all afternoon trying to remember the \tabularnewline command. Thank you!
Post Reply