1

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.

5

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

  • Thanks, that works. Will it work if I use [tl] or [lt], or does it need to be [vertical horizontal]? – Aarow Jan 16 '18 at 18:08
  • 1
    Any order will be OK. – Bernard Jan 16 '18 at 18:32

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.