You are on page 1of 6

makecell.

sty - Ngt dng trong v ng k cho


Nguyn Hu in Khoa Ton - C - Tin hc HKHTN H Ni, HQGHN

Gii thiu

Gi lnh makecell.sty do Olga Lapko to ra c ti a ch http://tug.ctan.org/tex-archive/macros/latex/contrib/makecell/

Nhng lnh c bn

Lnh c bn ca gi ny l \makecell[<Sp xp>]{Vn bn c th ngt xung dng} thng qua v d cc bn c m ngun s hiu

\begin{tabular}{|c|c|} \hline Cell text & 28--31\\ \hline \makecell{Nhiu dng \\ mt } & 28--31\\ \hline \makecell[l]{Dt tri \\ vn bn ca } & 37--43\\ \hline \makecell*[r]{Dt phi\\ vn bn ca } & 37--43\\ \hline \makecell[b]{Dng t dng di \\ vn bn ca } & 52--58\\ \hline \makecell*[{{p{3cm}}}]{ nhiu vn bn xc nh di} & 52--58\\ \hline \makecell[{{>{\parindent1em}p{3cm}}}] { nhiu vn bn xc nh di} & 52--58\\ \hline \end{tabular} 1

http://nhdien.wordpress.com

Cell text Nhiu dng mt Dt tri vn bn ca Dt phi vn bn ca Dng t dng di vn bn ca nhiu vn bn xc nh di nhiu vn bn xc nh di 2831 2831 3743 3743 5258 5258 5258

- Mt lnh khc tng t \thead{First column head}

\renewcommand\theadset{\def\arraystretch{.85}}% \begin{tabular}{|l|c|} \hline \thead{Ct u th nht}& \thead{Ct hai \\ nhiu dng\\ cng u }\\ \hline Ni dung vn bn& 28--31\\ \hline \end{tabular}

Ct u th nht Ct hai nhiu dng cng u

Ni dung vn bn

2831

- Kt hp vi gi \usepackage{rotating} v lnh \rothead{}

\settowidth\rotheadsize{\theadfont Chiu cao ca ct th hai} \begin{tabular}{|l|c|}

http://nhdien.wordpress.com \hline \thead{u ct th nht}& \rothead{Ct th hai nhiu dng \\ u dng hai}\\ \hline Ct vn bn bn tri & 28--31\\ \hline \end{tabular}

Ct th hai nhiu dng u dng hai

u ct th nht

Ct vn bn bn tri

2831

- K ng cho u tin \diaghead(H t l cao,V t l ngang){Vn bn hoc di ct}% {u gc 1}{u gc 2} Thng qua v d

\begin{tabular}{|c|c|c|}% \hline \diaghead{\theadfont Diag ColumnmnHead II}%^^A {Diag \\Column Head I}{Diag Column\\ Head II}& \thead{Second\\column}&\thead{Third\\column}\\ \hline \makecell[l]{Left aligned \\ cell text} & A & 37--43\\ \hline \makecell*[r]{Right aligned \\ cell text} & B & 37--43\\ \hline \makecell[b]{Bottom aligned\\ cell text} & C & 52--58\\ \hline \end{tabular}%

http://nhdien.wordpress.com

aa aa Diag Column aa Second aaHead II column Diag Column Head I aaa a Third column

Left aligned cell text Right aligned cell text Bottom aligned cell text

A B C

3743 3743 5258

\begin{tabularx}{.62\hsize}{|X|c|c|}% \hline \diaghead(4,1){\hskip\hsize}% %^^A{\theadfont Diag ColuDiag Column}%^^A {Diag \\Column Head I}{Diag Column \\Head II}& \thead{Second\\column}&\thead{Third\\column}\\ \hline \makecell[l]{Left aligned \\ cell text} & A & 37--43\\ \hline \makecell*[r]{Right aligned \\ cell text} & B & 37--43\\ \hline \makecell[b]{Bottom aligned\\ cell text} & C & 52--58\\ \hline \end{tabularx}%

  Diag Column  Second  Diag Head II  column  Column Head I   Third column

Left aligned cell text

A B C

3743 3743 5258

Right aligned cell text Bottom aligned cell text

\begin{tabular}{|l|c|c|}% \hline \diaghead(-4,1){\hskip4.2cm}%^^A

http://nhdien.wordpress.com {Diag \\Column Head I}{Diag Column \\Head II}& \thead{Second\\column}&\thead{Third\\column}\\ \hline \makecell[l]{Left aligned \\ cell text} & A & 37--43\\ \hline \makecell*[r]{Right aligned \\ cell text} & B & 37--43\\ \hline \makecell[b]{Bottom aligned\\ cell text} & C & 52--58\\ \hline \end{tabular}%

XXX Diag Column Second Diag XXXX X Head II column Column Head I XXXX X X Third column

Left aligned cell text Right aligned cell text Bottom aligned cell text

A B C

3743 3743 5258

- Bng c khung m vin

\renewcommand\theadset{\def\arraystretch{.85}}% \renewcommand\theadgape{} \begin{tabular}{!{\vrule width1.2pt}c !{\vrule width1.2pt}c|c!{\vrule width1.2pt}} \Xhline{1.2pt} \multirowthead{4}{First Column head}& \multicolumn{2}{c!{\vrule width1.2pt}}{\thead{Multicolumn head}}\\ \Xcline{2-3}{1.2pt} & \thead{Second \\multlined \\ column head} & \thead{Third \\ column head}\\ \Xhline{1.2pt} Cell text & A &\multirowcell{4}{28--31}\\ \cline{1-2} \makecell{Multilined \\Cell text} & B& \\ \hline \makecell[l]{Left aligned \\ cell text} & C & \multirowcell{4}[0ex][l]{37--43}\\ \cline{1-2} \makecell[r]{Right aligned \\ cell text} & D & \\

http://nhdien.wordpress.com

\hline \makecell[b]{Bottom aligned \\ cell text} & E & \multirowcell{6}[0ex][r]{37--43\\52--58}\\ \cline{1-2} \makecell[{{p{5cm}}}]{Cell long long long long long long text with predefined width} & F & \\ \cline{1-2} \makecell[{{>{\parindent1em}p{5cm}}}]{Cell long long long long long long text with predefined width} & G & \\ \Xhline{1.2pt} \end{tabular}

First Column head Multicolumn head Second Third multlined column head column head

Cell text Multilined Cell text Left aligned cell text Right aligned cell text Bottom aligned cell text Cell long long long long long long text with predefined width Cell long long long long long long text with predefined width

A B C D E F 3743 5258 3743 2831

You might also like