Makecell: Declara o alinhamento padrão em \ usepackage []

Oct 11 2020

Quero carregar o makecellpacote com uma opção padrão para tornar todas as \makecellcélulas alinhadas à esquerda por padrão. O que devo substituir OPTIONSabaixo para tornar o alinhamento à esquerda o comportamento padrão para \makecellcélulas?

\documentclass{report}
\usepackage[OPTIONS]{makecell}
\begin{document}
\begin{tabular}{cc}
  \makecell{Label \\ 1} & 1234 \\
  \makecell{Label \\ 2} & 5678
\end{tabular}
\end{document}

Tenho quase certeza de já ter visto isso feito antes, mas depois de brincar um pouco, não consigo descobrir, nem consigo encontrar na documentação .

Respostas

2 leandriis Oct 11 2020 at 18:18

Pelo que pude ver, makecellnão oferece uma opção para alterar o alinhamento padrão, \makecellmas você pode usar \renewcommand\cellalign{<alignment here>}para alterar globalmente o alinhamento padrão de acordo com sua preferência.

\documentclass{report}
\usepackage{makecell}
\renewcommand\cellalign{cl}
\begin{document}
\begin{tabular}{cc}
  \makecell{Label \\ 1} & 1234 \\
  \makecell{Label \\ 2} & 5678
\end{tabular}
\end{document}
jsbibra Oct 11 2020 at 12:58

Direto do manual do Makecell você pode usar t / b / c ou r / l / c / p nas opções

\documentclass{report}

\usepackage{tabu, booktabs}
\usepackage[]{makecell}
\begin{document}
\begin{tabular}{cc}
  \makecell[l]{Label \\ 1} & 1234 \\
  \makecell[tl]{Label \\ 2} & 5678\\
   \makecell[br]{Label \\ 3} & ABCDE
\end{tabular}
    

        \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{document}