Makecell : \ usepackage []에 기본 정렬 선언

Oct 11 2020

makecell기본 옵션으로 모든 \makecell셀을 기본적으로 왼쪽 정렬 하도록 패키지 를로드하고 싶습니다 . OPTIONS왼쪽 정렬을 \makecell셀 의 기본 동작으로 만들려면 아래를 무엇으로 대체해야 합니까?

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

나는 전에 이것을 본 적이 있다고 거의 확신하지만 조금 놀아 본 후에 나는 그것을 알아낼 수 없으며 문서 에서 찾을 수 없습니다 .

답변

2 leandriis Oct 11 2020 at 18:18

내가 볼 수있는 한, makecell은 기본 정렬을 변경하는 옵션을 제공하지 않지만 기본 정렬을 원하는대로 전역 적으로 변경하기 위해 \makecell사용할 수 있습니다 \renewcommand\cellalign{<alignment here>}.

\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

makecell 설명서에서 바로 옵션에서 t / b / c 또는 r / l / c / p를 사용할 수 있습니다.

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