19

I am writing a table with the \makecell package, and I am able to left-align the makecell text with the command:

\makecell[l]{here is \\ my text \\ in the cell}

I can also top-align the text with:

\makecell[t]{here is \\ my text \\ in the cell}

Below is a minimum working example of my table.

\documentclass[12pt]{article}
\usepackage{makecell}
\usepackage{tabu}


\begin{document}

\begin{table}
\begin{tabu} to \textwidth {lXX}
\hline
Head Col 1 & Head Col 2 & Head Col 3 \\
\hline
Data Col 1 & Data Col 2 & \makecell[l]{Long Data \\ Col 3} \\
Data Col 1 & Data Col 2 & \makecell[t]{Long Data \\ Col 3} \\
\hline
\end{tabu}
\end{table}


\end{document} 

I want to top-align AND left-align the text, something like:

 \makecell[t,l]{here is \\ my text \\ in the cell}

How can I do this?

The best answer about \makecell, here doesn't address this.

Edit: left a package out of MWE.

Aarow
  • 353

1 Answers1

21

Just don't add a comma between the alignment:

\documentclass[12pt]{article}
\usepackage{makecell}
\usepackage{tabu, booktabs}

\begin{document}

\begin{table}
\begin{tabu} to \textwidth {lXX}
\toprule
Head Col 1 & Head Col 2 & Head Col 3 \\
\hline
Data Col 1 & Data Col 2 & \makecell[l]{here is \\ my text \\ in the cell} \\
\addlinespace
Data Col 1 & Data Col 2 & \makecell[tl]{here is \\ my text \\ in the cell} \\
\addlinespace
Data Col 1 & Data Col 2 & \makecell[br]{here is \\ my text \\ in the cell} \\
\bottomrule
\end{tabu}
\end{table}

\end{document}

enter image description here

CarLaTeX
  • 62,716
Bernard
  • 271,350