# how to align cell text to center with \makecell

\begin{center}
\begin{longtable}{|>{\centering}m{.2\textwidth}|m{.2\textwidth}|}
\hline
\makecell[{{p{.2\textwidth}}}]{this is a test test test test test test\\ a test too} & bear \\\hline
\end{longtable}
\end{center}


The first column is left aligned, but I want to center-align the column. What can I do this?

• Why not simply use this is a test test test test test test\\ a test too & bear \\\hline without the makecell command? – leandriis Jan 2 '19 at 10:06

I don't know if this is what is needed:

\documentclass[]{article}
\usepackage{longtable,makecell}
\begin{document}
\begin{center}
with makecell
\begin{longtable}{|c|m{.2\textwidth}|}
\hline
\makecell[cm{0.2\textwidth}]{\centering this is a test test test test test test
\\ a test too} & bear \\\hline
\end{longtable}
\end{center}

\begin{center}
without makecell
\begin{longtable}{|>{\centering}m{0.2\textwidth}|m{.2\textwidth}|}
\hline
this is a test test test test test test
\\ a test too & bear \\\hline
\end{longtable}
\end{center}
\end{document}


The second suggestion is based on @leandriis comment

• Thanks for your answer! It perfectly solved my problem. – user178717 Jan 3 '19 at 1:14
• @user178717 If this does solve you problem please mark the answer as accepted – Hafid Boukhoulda Jan 3 '19 at 12:10