Download as pdf
Download as pdf
You are on page 1of 5

xtab.

sty bảng kéo dài hơn một trang


được ngắt
Nguyễn Hữu Điển
Khoa Toán - Cơ - Tin học
ĐHKHTN Hà Nội, ĐHQGHN

Mục lục
1 Giới thiệu 1

2 Tùy chọn của gói lệnh 1

3 Các môi trường và lệnh của gói lệnh 2

4 Ví dụ 3

1 Giới thiệu
Gói lệnh xtab.sty do các tác giả Peter Wilson, Herries Press viết nhằm khắc phục
một số nhược điểm của gói lệnh supertabular.sty, gói lệnh này tôi đã đề cập tới
trong cuốn sách thứ 2 về TeX của tôi. Mục đích của các gói lệnh này là tự động
ngắt các bảng quá dài hơn một trang, còn dùng môi trường tabular thì không
làm được. Bạn có thể lấy gói lệnh tại địa chỉ
http://www.tex.ac.uk/tex-archive/macros/latex/contrib/xtab/

2 Tùy chọn của gói lệnh


Dùng gói lệnh bằng \usepackage[<tùy chọn>]{xtab} có thể dùng tùy chọn
hoặc không dưới đâu

• errorshow đây là tùy chọn mặc định, không viết vào tệp *.log các thông
tin quá cỡ của bảng.

• pageshow viết ra tất cả công thông tin khia nào, tại sao xtab lại ngắt và
làm những việc như vậy.

1
http://nhdien.wordpress.com 2

• debugshow giống như phần trên pageshow nhưng thêm dòng vào bảng để
truy lại dòng đó được.

Có thể dùng \sstraceon mở mỗi đoạn để dùng debugshow và đóng đoạn kiểm
tra lại dùng \sstraceoff, tất nhiên không có tùy chọn debugshow ngay từ đầu

3 Các môi trường và lệnh của gói lệnh


1. Môi trường

\begin{xtabular}{| l | l | l | l | l |}
*&*&*&*&*\\
*&*&*&*&*\\
*&*&*&*&*\\
*&*&*&*&*\\
\end{xtabular}

giống như môi trường tabular, chỉ khác là ngắt được sang trang.
2. Môi trường có minipage

\begin{xtabular}{| l | l | l | l | l |}
*&*&*&*&*\\
*&*&*&*&*\\
*&*&*&*&*\\
*&*&*&*&*\\
\end{xtabular}

Môi trường khi tách sang trang được đưa vào một môi trường minipage của
LaTeX, do vậy cuối trang có chỗ chú thích chứ không phải cuối bảng.
3. Các lệnh làm chú thích bảng, nhãn, câu chú thích chuyển trang của bảng đều
có lệnh riên và để ngoài.

• \topcaption{...} chú thích bảng được để đầu bàng, không dùng


\caption{...}

• \bottomcaption{...}chú thích bảng được để cuối bàng.

• \tablecaption{...} mặc định để đầu bảng.

• \tablefirsthead{...} Dòng đầu tiên của bảng, có các tiêu đề.

• \tablehead{...} Khi chuyển trang dòng đầu tiên có nội dung của lệnh
này.

• \tablelasthead{...} Dòng cuối cùng của bảng.

• \notablelasthead Không có dòng cuối cùng của bảng.


http://nhdien.wordpress.com 3

• \tabletail{...} Khi chuyển trang dòng cuối cùng có nội dung của lệnh
này.

• \tablelasttail{...} Nội dùng cuối cùng của bảng.

4 Ví dụ
\topcaption{The principal xtab package commands} \label{tab:xtab}
\tablefirsthead{\hline \multicolumn{1}{|c|}{\textbf{Command}} &
\multicolumn{1}{c|}{\textbf{Effect}} \\ \hline }
\tablehead{\multicolumn{2}{c}%
{{\captionsize\bfseries \tablename\ \thetable{} --
continued from previous page}} \\
\hline \multicolumn{1}{|c|}{\textbf{Command}} &
\multicolumn{1}{c|}{\textbf{Effect}} \\ \hline }
\tablelasthead{\multicolumn{2}{c}%
{{\captionsize\bfseries \tablename\ \thetable{} --
concluded from previous page}} \\
\hline \multicolumn{1}{|c|}{\textbf{Command}} &
\multicolumn{1}{c|}{\textbf{Effect}} \\ \hline }
\tabletail{\hline \multicolumn{2}{|r|}{{Continued on next page}} \\ \hline}
\tablelasttail{\hline \hline}
\begin{center}
\begin{xtabular}{|l|p{0.5\textwidth}|}
\verb|\begin{xtabular}{...}| & This is equivalent to the normal
\verb|\begin{tabular}{...}| environment.
You supply the specification of the columns
just as for the normal \Lenv{tabular} environment.
\\
&
All commands that can be used within a \Lenv{tabular}
environment can also be used within
the \Lenv{xtabular} environment.
\\
&
Unlike the \Lenv{tabular} environment which prevents page breaking
within the tabular, the \Lenv{xtabular} allows page breaking, so that
tabulars can extend automatically across several pages.
... ... ...\\
\verb|\tablelasttail{...}| & The contents of this command are inserted before
the final (internal) \verb|\end{tabular}| of the table.
\\
\verb|\tablelasttail{...}| & The contents of this command are inserted before
the final (internal) \verb|\end{tabular}| of the table.
http://nhdien.wordpress.com 4

\\
&
For example, you might want to note that this is where
the table ends.
\\
\end{xtabular}
\end{center}

Bảng 1: The principal xtab package commands


Command Effect
\begin{xtabular}{...} This is equivalent to the normal
\begin{tabular}{...} environment.
You supply the specification of the
columns just as for the normal tabular
environment.
All commands that can be used within
a tabular environment can also be used
within the xtabular environment.
Unlike the tabular environment which
prevents page breaking within the tabu-
lar, the xtabular allows page breaking,
so that tabulars can extend automati-
cally across several pages. ... ... ...
\tablelasttail{...} The contents of this command are
inserted before the final (internal)
\end{tabular} of the table.
\tablelasttail{...} The contents of this command are
inserted before the final (internal)
\end{tabular} of the table.
\tablelasttail{...} The contents of this command are
inserted before the final (internal)
\end{tabular} of the table.
\tablelasttail{...} The contents of this command are
inserted before the final (internal)
\end{tabular} of the table.
Continued on next page
http://nhdien.wordpress.com 5

Bảng 1 – concluded from previous page


Command Effect
\tablelasttail{...} The contents of this command are
inserted before the final (internal)
\end{tabular} of the table.
\tablelasttail{...} The contents of this command are
inserted before the final (internal)
\end{tabular} of the table.
\tablelasttail{...} The contents of this command are
inserted before the final (internal)
\end{tabular} of the table.
\tablelasttail{...} The contents of this command are
inserted before the final (internal)
\end{tabular} of the table.
\tablelasttail{...} The contents of this command are
inserted before the final (internal)
\end{tabular} of the table.
\tablelasttail{...} The contents of this command are
inserted before the final (internal)
\end{tabular} of the table.
\tablelasttail{...} The contents of this command are
inserted before the final (internal)
\end{tabular} of the table.
For example, you might want to note
that this is where the table ends.

You might also like