1. BẢNG VÀ GÓI LỆNH LIÊN QUAN
Nguyễn Hữu Điển
Khoa Toán - Cơ - Tin học
Đại học khoa học tự nhiên, ĐHQG HN
1 Một số loại bảng
- Bảng với chú thích ở dưới bảng
begin{table}[htbp]
caption{Chú thích}
begin{center}
begin{minipage}{4cm}
renewcommand{thempfootnote}{fnsymbol{mpfootnote}}
begin{center}
begin{tabular}{|c|r|r|}
hline
multicolumn{1}{|c|}{A} & multicolumn{1}{c|}{BB}
& multicolumn{1}{c|}{CCC} hline
DDD & E & FFfootnote{Ba} hline
GG & HHHfootnote{Bốn} & I hline
end{tabular}
end{center}
end{minipage}
end{center}
end{table}
Bảng 1: Chú thích
A BB CCC
DDD E FF∗
GG HHH† I
∗
Ba
†
Bốn
- Bảng có viền bên ngoài
1
2. begin{tabular}{|c|c|c|c|}
multicolumn{1}{c}{} & multicolumn{1}{c}{a} &
multicolumn{1}{c}{b} & multicolumn{1}{c}{c} cline{2-4}
multicolumn{1}{c|}{x} & & 2 & cline{2-4}
multicolumn{1}{c|}{y} & 3 & 2 & cline{2-4}
end{tabular}
a b c
x 2
y 3 2
- Bảng kẻ khung
newcolumntype{I}{!{vrule width 2pt}} % creates a vertical thick bar
newlengthsavedwidth
newcommand{wcline}[1]{noalign{globalsavedwidtharrayrulewidthglobal
arrayrulewidth 2pt}%
cline{#1}
noalign{globalarrayrulewidthsavedwidth}}
renewcommand{arraystretch}{1.5}
begin{tabular}{|ccc|}
hline
a & b & c
wcline{2-2}
multicolumn{1}{|cI}{c} & multicolumn{1}{cI}{e} & f
wcline{2-2}
g & h & i
hline
end{tabular}
a b c
c e f
g h i
begin{tabular}{|c|c|c|c|c|c|c|} hline
multicolumn{1}{|c}{} & multicolumn{1}{c|}{$Y$}&
multicolumn{5}{c|}{Hànghspace{1cm}ngang} cline{3-7}
multicolumn{1}{|c}{$X$} & multicolumn{1}{c|}{}&
multicolumn{1}{c|}{1} & 2 & 3 & 4 &
multicolumn{1}{c|}{5} hlinewcline{3-7}
& 5 &multicolumn{1}{Ic|}{1} & 3 & 1 & 0 &multicolumn{1}{cI}{1}
cline{2-7}
2
4. end{minipage}
end{table}
end{center}
Bảng 2: Chú thích trên
Một Hai
Ba Bốn
một Hai
3
4
4
3
Bảng 3: Chú thích dưới
2 Gói lệnh listliketab.sty
Gói lệnh có tại địa chỉ
http://www.ctan.org/tex-archive/macros/latex/contrib/listliketab/
mục đích là dóng nhiều cột của danh sách trong một hàng như môi trường itemize
hoặc enumerate.
ví dụ như dùng môi trường listliketab với các đánh số nextnum, các dấu chấm
textbullet, ... nhưng trước môi trường này phải lưu lại môi trường ví dụ như
storestyleof{enumerate}, storestyleof{itemize}, xem ví dụ dưới đây
storestyleof{enumerate}
begin{listliketab}
newcounter{lltenum}setcounter{lltenum}{0}
newcommand{nextnum}{addtocounter{lltenum}{1}thelltenum.}
begin{tabularx}{linewidth}{LX@{qquad}lR}
& & multicolumn{1}{c}{Due date} cline{3-3}
nextnum & Clean desk. & 2005/01/10
nextnum & Sort ‘‘in’’ pile. & 2005/01/11
nextnum & Discard random applications from ‘‘in’’ pile. & 2005/01/11
nextnum & Move applications from ‘‘in’’ pile to ‘‘out’’ pile, stamping
each one with a different official-looking stamp.
& 2005/01/15
nextnum & Write and mail meaningless memos. & 2005/01/16
nextnum & Update r’esum’e. & 2005/01/20
end{tabularx}
end{listliketab}
4
5. Due date
1. Clean desk. 2005/01/10
2. Sort “in” pile. 2005/01/11
3. Discard random applications from “in” pile. 2005/01/11
4. Move applications from “in” pile to “out” pile, stamping each
one with a different official-looking stamp.
2005/01/15
5. Write and mail meaningless memos. 2005/01/16
6. Update résumé. 2005/01/20
- Ta có thể dóng theo các cột và đánh số
storestyleof{enumerate}
begin{listliketab}
newcounter{tabenum}setcounter{tabenum}{0}
newcommand{nextnum}{addtocounter{tabenum}{1}thetabenum.}
begin{tabular}{L>{bf}l@{~or~}>{bf}l@{~or~}>{bf}l}
nextnum & Red & green & blue
nextnum & Short & stout & tall
nextnum & Happy & sad & confused
end{tabular}
end{listliketab}
1. Red or green or blue
2. Short or stout or tall
3. Happy or sad or confused
- Kết hợp với gói lệnh tabularx lập danh sách sau:
storestyleof{itemize}
begin{listliketab}
begin{tabularx}{0.5linewidth}{%
LX@{raisebox{-2pt}{framebox(12,12){}}}R}
textbullet & Milk
textbullet & Flour
textbullet & Sugar
textbullet & Butter
textbullet & Eggs
end{tabularx}
5
6. end{listliketab}
• Milk
• Flour
• Sugar
• Butter
• Eggs
- Danh sách đánh số theo bảng
newcolumntype{A}{>{columncolor[rgb]{0.8,0.8,0.8}}c}
storestyleof{enumerate}
begin{listliketab}
newcommand{nextnum}{addtocounter{tabenum}{1}thetabenum }
begin{tabular}{|A|p{70mm}|p{60mm}|}
multicolumn{3}{c}{textbf{Danh sách trong bảng}}
hline
nextnum & Metaphors from the real world &A
nextnum & Direct manipulation &B
nextnum & See-and-point (instead of remember-and-type)&C
nextnum & Consistency &D
nextnum & WYSIWYG (What You See Is What You Get) &X
nextnum & User Control &E
nextnum & Feedback and Dialog&F
nextnum & Forgiveness&G
nextnum & Perceived Stablity &H
nextnum & Aesthetic Integrity&I
hline
end{tabular}
end{listliketab}
6
7. Danh sách trong bảng
1 Metaphors from the real world A
2 Direct manipulation B
3 See-and-point (instead of remember-and-
type)
C
4 Consistency D
5 WYSIWYG (What You See Is What You
Get)
X
6 User Control E
7 Feedback and Dialog F
8 Forgiveness G
9 Perceived Stablity H
10 Aesthetic Integrity I
- Danh sách theo kiểu kết hợp với bảng dài longtable.sty
begin{listliketab}
%newcounter{tabenum}
setcounter{tabenum}{0}
newcommand{nextnum}{addtocounter{tabenum}{1}fbox{Largethetabenum}}
{renewcommandarraystretch{2}
begin{longtable}[c]{cp{0.5textwidth}p{0.26textwidth}}
nextnum & iroh & KOTAE
nextnum & juge & KOTAE
nextnum & iroh & KOTAE
nextnum & juge & KOTAE
nextnum & iroh & KOTAE
nextnum & juge & KOTAE
nextnum & iroh & KOTAE
end{longtable}
}
end{listliketab}
7
8. 1 Phần chữ không nhiều lắm ở đây còn gì
nữa
Ví dụ:
2 Phần này chữ hơi dài một chút,...Phần
này chữ hơi dài một chút,...Phần này
chữ hơi dài một chút,...Phần này chữ
hơi dài một chút,...Phần này chữ hơi dài
một chút,...Phần này chữ hơi dài một
chút,...Phần này chữ hơi dài một chút,...
Ví dụ:
3 Phần chữ không nhiều lắm ở đây còn gì
nữa
Ví dụ:
4 Phần này chữ hơi dài một chút,...Phần
này chữ hơi dài một chút,...Phần này
chữ hơi dài một chút,...Phần này chữ
hơi dài một chút,...Phần này chữ hơi dài
một chút,...Phần này chữ hơi dài một
chút,...Phần này chữ hơi dài một chút,...
Ví dụ:
5 Phần chữ không nhiều lắm ở đây còn gì
nữa
Ví dụ:
6 Phần này chữ hơi dài một chút,...Phần
này chữ hơi dài một chút,...Phần này
chữ hơi dài một chút,...Phần này chữ
hơi dài một chút,...Phần này chữ hơi dài
một chút,...Phần này chữ hơi dài một
chút,...Phần này chữ hơi dài một chút,...
Ví dụ:
7 Phần chữ không nhiều lắm ở đây còn gì
nữa
Ví dụ:
- Ví dụ cột thứ hai theo danh sách
storestyleof{itemize}
begin{table}[hbp]
8
10. & rule{0cm}{2cm}parbox[b]{0.6textwidth}{iroh} hline
nextnum & fbox{includegraphics[width=15mm]{tiger.eps}}
& rule{0cm}{25mm}parbox[b]{0.6textwidth}{irohirohairohirohairoh}
hline
nextnum & fbox{includegraphics[width=15mm]{tiger.eps}}
& rule{0cm}{30mm}parbox[b]{0.6textwidth}{irohirohairohirohairoh}
hline
end{longtable}
end{listliketab}
1) Phần nhỏ
2)
Phần nhỏPhần lớn, Phần lớn, Phần lớn, Phần lớn,
Phần lớn, Phần lớn
3)
Phần nhỏPhần lớn, Phần lớn, Phần lớn, Phần lớn,
Phần lớn, Phần lớnPhần nhỏPhần lớn, Phần lớn,
Phần lớn, Phần lớn, Phần lớn, Phần lớn
4) Phần nhỏ
5)
Phần nhỏPhần lớn, Phần lớn, Phần lớn, Phần lớn,
Phần lớn, Phần lớnPhần nhỏPhần lớn, Phần lớn,
Phần lớn, Phần lớn, Phần lớn, Phần lớnPhần nhỏ
6)
Phần nhỏPhần lớn, Phần lớn, Phần lớn, Phần lớn,
Phần lớn, Phần lớnPhần nhỏPhần lớn, Phần lớn,
Phần lớn, Phần lớn, Phần lớn, Phần lớnPhần nhỏ
10