GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI DẠY BUỔI 2) - TIẾNG ANH 7 GLOBAL SUCCESS (2 CỘ...
Titlesec help
1. GÓI LỆNH titlesec.sty
Nguyễn Hữu Điển
Khoa Toán - Cơ - Tin học
ĐHKHTN Hà Nội, ĐHQGHN
1 Giới thiệu
Gói lệnh quotchap.sty cho việc làm chương với chú thích bên cạnh. Gói titlesec.sty và
titletoc.sty cho ta cách làm lại các ttiêu đề đoạn, chương và mục lục theo ý muốn. Gói lệnh
được viết bởi Javier Bezos có tại địa chỉ
http://www.ctan.org/tex-archive/macros/latex/contrib/titlesec/
Bạn phải lấy về và đọc hướng dẫn lý giải và tùy chọn của gói lệnh. Tại đây tôi chỉ giới
thiệu một số ví dụ cụ thể cho người dùng mà họ đã làm.
2 Tùy chọn của gói lệnh
Giống như bất cứ gói lệnh nào đưa vào phần đầu
documentclass{article}
usepackage[sf,bf,compact,topmarks,calcwidth,pagestyles]{titlesec}
usepackage{titletoc}
usepackage[utf8]{vietnam}
begin{document}
2.1 Định dạng tiêu đề và chương
1. rm sf tt md bf up it sl sc
Đặt lại phông tiêu đề theo family/series/shape. Mặc định là bf.
2. big medium small tiny
Đặt cỡ của tiêu đề. Mặc định là big.
3. raggedleft center raggedright
Sắp xếp tiêu đề căn lề trái phải.
4. titlelabel{<label-format>}
Định dạng nhãn số của đoạn và chương, ví dụ thêm dấu chấm
titlelabel{thetitle.quad}
4. titleformat*{<command>}{<format>}
Định dạng lại các lệnh section, chapter, ... Ví dụ tiêu đề nghiêng
titleformat*{section}{itshape}
2.2 Lệnh định dạng tổng quát
titleformat{<command>}[<shape>]{<format>}{<label>}{<sep>}{<before>}[<after>]
• <command> là định nghĩa lại các lệnh là part, chapter, section, subsection,
subsubsection, paragraph hoặc subparagraph.
1
2. • <shape>
hang là giá trị mặc định giống như các định dạng lệnh cơ bản.
block tạo tiêu đề thành khối, có thể định dạng lại tiêu đề và hình khung bao quanh
dạng đặc biệt.
display tiêu đề thành một đoạn riêng giống như tiêu đề chương.
runin tiêu đề cùng với nội dung liền nhau.
leftmargin đặt tiêu đề lề trái.
rightmargin đặt tiêu đề lề phải.
drop tiêu đề có thể ngắt được.
wrap giống như drop như khoảng cách giữa tiêu đề văn bản được tính đẹp hơn.
frame tiêu đề có khung.
• <format> định dạng cho cả số và văn bản tiêu đề.
• <label> có thể bỏ trống.
• <sep> Khoảng trrống nhãn tiêu đề và văn bản.
• <before> Khoảng trống trước tiêu đề.
• <after> Khoảng trống sau tiêu đề.
3 Ví dụ định dạng đoạn
Tiếp tục với mục trên bằng
4 Gói lệnh là gì
titleformat{section}[block]
{normalfontbfseriesfilcenter}{fbox{itshapethesection}}{1em}{}
section[Ví dụ]{Gói lệnh là gì}
5 KẺ KHUNG SỐ
titleformat{section}[block]
{normalfontbfseriesfilright}{fbox{itshapethesection}}{1em}{}
section[Ví dụ]{KẺ KHUNG SỐ}
PHẦN 6
KẺ KHUNG CẢ TIÊU ĐỀ
titleformat{section}[frame]
{normalfont}
{filright
footnotesize
enspace PHẦN thesectionenspace}
{8pt}
{Largebfseriesfilcenter}
section[Ví dụ]{KẺ KHUNG CẢ TIÊU ĐỀ}
7. Tiêu đề kẻ trên
titleformat{section}
{titlerule
vspace{.8ex}%
normalfontitshape}
{thesection.}{.5em}{}
section[Ví dụ]{Tiêu đề kẻ trên}
2
3. 8
Tiêu đề kẻ trên với số
titleformat{section}[block]
{normalfontsffamily}
{thesection}{.5em}{titlerule[.8ex]bfseries}
section[Ví dụ]{Tiêu đề kẻ trên với số}
9 TIÊU ĐỀ RẤT DÀI CÓ THỂ NGẮT XUỐNG DÒNG
VÀ QUY TÂM VÀO GIỮA
10 TIÊU ĐỀ NGẮN
titleformat{section}[block]
{filcenterlarge
addtolength{titlewidth}{2pc}%
titleline*[c]{titlerule*[.6pc]{tinytextbullet}}%
addvspace{6pt}%
normalfontsffamily}
{thesection}{1em}{}
titlespacing{section}
{5pc}{*2}{*2}[5pc]
section[Ví dụ]{Tiêu đề rất dài có thể ngắt xuống dòng và quy tâm vào giữa}
section
Đây là ví dụ tiêu đề và nội dung thành một khối
titleformat{section}[display]
{normalfontfillast}
{scshape section oldstylenums{thesection}}
{1ex minus .1ex}
{small}
titlespacing{section}
{3pc}{*3}{*2}[3pc]
section[Ví dụ]{Đây là ví dụ tiêu đề và nội dung thành một khối}
PHẦN TIÊU ĐỀ LIỀN ngay với nội dung ở đây. . .
titleformat{section}[runin]
{normalfontscshape}
{}{0pt}{}
titlespacing{section}
{parindent}{*2}{wordsep}
section*{PHẦN TIÊU ĐỀ LIỀN}
ngay với nội dung ở đâyldots
12. Tiêu đề ở một góc văn bản
tuy có hơi dài
Dùng soạn thảo văn bản bằng LaTeX là dùng các lệnh để
điều khiển cho ta kết quả cuối cùng sản phẩm chế bản.
Để mở rộng khả năng sử dụng LaTeX và đáp ứng nhu cầu
đa dạng với kết quả chuyên nghiệp, người ta đã thiết kế cho người sử dụng tạo các gói lệnh
dùng chung.
titleformat{section}[wrap]
3
4. {normalfontfontseries{b}selectfontfilright}
{thesection.}{.5em}{}
titlespacing{section}
{12pc}{1.5ex plus .1ex minus .2ex}{1pc}
section[Ví dụ]{Tiêu đề ở một góc văn bản tuy có hơi dài}
13. Tiêu đề ở một góc ngắn Dùng soạn thảo văn bản bằng LaTeX là dùng các lệnh để
điều khiển cho ta kết quả cuối cùng sản phẩm chế bản. Để
mở rộng khả năng sử dụng LaTeX và đáp ứng nhu cầu đa dạng với kết quả chuyên nghiệp,
người ta đã thiết kế cho người sử dụng tạo các gói lệnh dùng chung.
titleformat{section}[wrap]
{normalfontfontseries{b}selectfontfilright}
{thesection.}{.5em}{}
titlespacing{section}
{12pc}{1.5ex plus .1ex minus .2ex}{1pc}
section[Ví dụ]{Tiêu đề ở một góc ngắn}
§ 14. Tiêu đề chạy liên tục.—Dùng soạn thảo văn bản bằng LaTeX là dùng các lệnh
để điều khiển cho ta kết quả cuối cùng sản phẩm chế bản. Để mở rộng khả năng sử dụng
LaTeX và đáp ứng nhu cầu đa dạng với kết quả chuyên nghiệp, người ta đã thiết kế cho
người sử dụng tạo các gói lệnh dùng chung.
titleformat{section}[runin]
{normalfontbfseries}
{S thesection.}{.5em}{}[.---]
titlespacing{section}
{parindent}{1.5ex plus .1ex minus .2ex}{0pt}
section[Ví dụ]{Tiêu đề chạy liên tục}
Tiêu đề ở
ngoài lề
văn bản
Dùng soạn thảo văn bản bằng LaTeX là dùng các lệnh để điều khiển cho ta kết quả cuối
cùng sản phẩm chế bản. Để mở rộng khả năng sử dụng LaTeX và đáp ứng nhu cầu đa dạng
với kết quả chuyên nghiệp, người ta đã thiết kế cho người sử dụng tạo các gói lệnh dùng
chung.
titleformat{section}[leftmargin]
{normalfont
%titlerule*[.6em]{bfseries .}%
vspace{6pt}%
sffamilybfseriesfilleft}
{thesection}{.5em}{}
titlespacing{section}
{4pc}{1.5pc plus .1ex minus .2ex}{1pc}
section*{Tiêu đề ở ngoài lề văn bản}
4 Ví dụ định dạng chương
Ví dụ định dạng chương tương tự
4
5. CHƯƠNG 5
TIÊU ĐỀ CỦA CHƯƠNG
titlespacing{chapter}{0pt}{*4}{*4}
titleformat{chapter}[display]
{normalfontLargefilcentersffamily}
{titlerule[1pt]%
vspace{1pt}%
titlerule
vspace{1pc}%
LARGE CHƯƠNG thechapter}
{1pc}
{titlerule
vspace{1pc}%
Huge}
chapter[Ví dụ]{TIÊU ĐỀ CỦA CHƯƠNG}
CHƯƠNG VI
TIÊU ĐỀ CỦA CHƯƠNG
defthesection{Roman{chapter}}
titleformat{chapter}[display]
{bfseriesLarge}
{filleft CHƯƠNG Hugethechapter}
{4ex}
{titlerule
vspace{2ex}%
filright}
[vspace{2ex}%
titlerule]
chapter[Ví dụ]{TIÊU ĐỀ CỦA CHƯƠNG}
5 Ví dụ định dạng đầy đủ
documentclass[twoside]{report}
usepackage[sf,sl,outermarks]{titlesec}
% chapter, subsection...: no additional code
5
6. titleformat{section}
{LARGEsffamilyslshape}
{thesection}{1em}{}
titlespacing{section}
{-6pc}{3.5ex plus .1ex minus .2ex}{1.5ex minus .1ex}
titleformat{paragraph}[leftmargin]
{sffamilyslshapefilright}
{}{}{}
titlespacing{paragraph}
{5pc}{1.5ex minus .1 ex}{1pc}
% 5+1=6, ie, the negative left margin in section
widenhead{6pc}{0pc}
renewpagestyle{plain}{}
newpagestyle{special}[smallsffamily]{
headrule
sethead[usepage][textsl{chaptertitle}][]
{}{textsl{chaptertitle}}{usepage}}
newpagestyle{main}[smallsffamily]{
headrule
sethead[usepage][textsl{thechapter. chaptertitle}][]
{}{textsl{thesection. sectiontitle}}{usepage}}
pagestyle{special}
begin{document}
---TOC
pagestyle{main}
---Body
pagestyle{special}
---Index
end{document}
6 Các lớp chuẩn cũ được định nghĩa
Ta định nghĩa các đoạn và chương như chuẩn cũ như sau.
titleformat{chapter}[display]
{normalfonthugebfseries}{chaptertitlename thechapter}{20pt}{Huge}
titleformat{section}
{normalfontLargebfseries}{thesection}{1em}{}
titleformat{subsection}
{normalfontlargebfseries}{thesubsection}{1em}{}
titleformat{subsubsection}
{normalfontnormalsizebfseries}{thesubsubsection}{1em}{}
titleformat{paragraph}[runin]
{normalfontnormalsizebfseries}{theparagraph}{1em}{}
6
7. titleformat{subparagraph}[runin]
{normalfontnormalsizebfseries}{thesubparagraph}{1em}{}
titlespacing*{chapter} {0pt}{50pt}{40pt}
titlespacing*{section} {0pt}{3.5ex plus 1ex minus .2ex}{2.3ex plus .2ex}
titlespacing*{subsection} {0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}
titlespacing*{subsubsection}{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}
titlespacing*{paragraph} {0pt}{3.25ex plus 1ex minus .2ex}{1em}
titlespacing*{subparagraph} {parindent}{3.25ex plus 1ex minus .2ex}{1em}
7 Chương với hình
Ta có thể vẽ hình ở tiêu đề bằng ( gói lệnhPSTricks)
usepackage[dvips]{color}
usepackage[rigidchapters,explicit]{titlesec}
DeclareFixedFont{chapterfont}{T1}{phv}{bx}{n}{11cm}
titlespacing{chapter}{0pt}{0pt}{210pt}
% Most of titles have some depth. The total space is
% a bit larger than the picture box.
titleformat{chapter}[block]
{begin{picture}(330,200)}
{put(450,80){%
makebox(0,0)[rb]{%
chapterfonttextcolor[named]{SkyBlue}{thechapter}}}
put(0,230){%
makebox(0,0)[lb]{%
Hugesffamilyunderline{Chapter thechapter}}}}
{0pt}
{put(0,190){parbox[t]{300pt}{%
Hugesffamilyfilright#1}}}
[end{picture}]
7