TransWikia.com

Makecell: Declare default alignment in usepackage[]

TeX - LaTeX Asked by snadhelta on November 29, 2020

I want to load the makecell package with a default option to make all makecell cells left-aligned by default. What should I substitute in for OPTIONS below to make left-alignment the default behavior for makecell cells?

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

I’m almost certain I’ve seen this done before, but after playing around with it a bit I can’t figure it out, nor can I find it in the documentation.

2 Answers

As far as I could see, makecell does not offer an option to change the default alignment of makecell but you can use renewcommandcellalign{<alignment here>} in order to globally change the default alignment to your liking.

documentclass{report}
usepackage{makecell}
renewcommandcellalign{cl}
begin{document}
begin{tabular}{cc}
  makecell{Label  1} & 1234 
  makecell{Label  2} & 5678
end{tabular}
end{document}

Correct answer by leandriis on November 29, 2020

Straight from the manual of makecell you can use t/b/c or r/l/c/p in the options

enter image description here

enter image description here

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}

Answered by js bibra on November 29, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP