1. 段首縮排
中文習慣在段首縮排兩格,在LaTeX中,/parindent 表示段首縮排的長度,我們將它設定為當前字型大小的兩個大寫字母M的寬度,大約正好是兩個漢字的寬度:
/setlength{/parindent}{2em}
LaTeX 預設每節的第一段的段首不縮排,這不符合中文排版習慣。我們希望本文的每一段都要縮排,使用indentfirst宏包就可辦到:
/usepackage{indentfirst}
2. 段距行距
LaTeX 用/baselineskip表示當前的行距,其預設值大約是當前字型大小的1.2倍,如果當前字型大小是10pt,那麼/baselineskip是12pt。這對英文排版是合適的,對中文就顯得太擁擠了,因為英文本文多為小寫字母,字高與小寫x差不多(即1ex)。如果字型大小為10pt,那麼1ex =4.3pt。我通常把行距設為字型大小的1.8倍:
/setlength{/baselineskip}{1.8em}
這個值隨時可以改,對更改點以後的文字有效。
LaTeX 用/parskip表示段距,我一般把它設為1ex:
/setlength{/parskip}{1ex}
注意這些修改長度的命令最好都放在本文區(即/begin{document}之後)。
3. 頁首頁尾
我通常用fancyhdr宏包來設定頁首和頁尾。
/documentclass[10pt, a4paper]{book}
/usepackage{fancyhdr}
我們在 LaTeX 中先把 page style 設為fancy,再設定這個style中的頁首和頁尾。但是它預設每章的第一頁的page style是plain,需要單獨處理。
% 設定 plain style 的屬性
/fancypagestyle{plain}{%
/fancyhf{} % 清空當前設定
% 設定頁首 (head)
/fancyhead[RE]{/leftmark} % 在偶數頁的右側顯示章名
/fancyhead[LO]{/rightmark} % 在奇數頁的左側顯示小節名
/fancyhead[LE,RO]{~/thepage~} % 在偶數頁的左側,奇數頁的右側顯示頁碼
% 設定頁尾:在每頁的右下腳以斜體顯示書名
/fancyfoot[RO,RE]{/it Typesetting with /LaTeX}
/renewcommand{/headrulewidth}{0.7pt} % 頁首與本文之間的水平線粗細
/renewcommand{/footrulewidth}{0pt}
}
/pagestyle{fancy} % 選用 fancy style
% 其餘同 plain style
/fancyhf{}
/fancyhead[RE]{/leftmark}
/fancyhead[LO]{/rightmark}
/fancyhead[LE,RO]{~/thepage~}
/fancyfoot[RO,RE]{/it Typesetting with /LaTeX}
/renewcommand{/headrulewidth}{0.7pt}
/renewcommand{/footrulewidth}{0pt}
% 設定章名和節名的顯示方式
/renewcommand{/chaptermark}[1]{/markboth{~第~/thechapter~章~~~#1~}{}}
/renewcommand{/sectionmark}[1]{/markright{~/thesection~~#1~}{}}
4. 章區段標頭
我通常用titlesec宏包來設定本文中出現的章區段標頭的格式:
/usepackage{titlesec}
設定章名為靠右對齊,字型大小為/Huge,字型為黑體,章號用粗體,並設定間距:
/titleformat{/chapter}{/flushright/Huge/hei}{{/bf /thechapter}}{0pt}{}
/titlespacing{/chapter}{0pt}{-20pt}{25pt}
設定節名的字型大小為/Large,字型為黑體,節號用粗體,並設定間距:
/titleformat{/section}{/Large /hei }{{/bf /thesection/space}}{0pt}{}
/titlespacing*{/section}{0pt}{1ex plus .3ex minus .2ex}{-.2ex plus .2ex}
其中/hei的定義為:
/newcommand{/hei}{/CJKfamily{hei}}
5. 紙張大小
畢業論文要求用b5紙,單面列印,我用geometry宏包來設定紙張和版心大小:
/documentclass[10pt, b5paper]{report}
/usepackage[body={12.6cm, 20cm}, centering, dvipdfm]{geometry}
% 以上將版心寬度設為 12.6cm,高度 20cm,版心置中,且自動化佈建PDF檔案的紙張大小。