Re: [問題] 頁首頁尾及章節標題版面問題求教

看板LaTeX (論文排版)作者 (小九)時間14年前 (2011/08/03 21:32), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串5/5 (看更多)
謝謝 uranusjr 的幫助,missing number 的問題 解決了,不過這只解決了在正文中讓附件出現的要 求,但是在製作 table of contents 時就出現同樣 的錯誤,我看了一下, 應該是 \titlecontents 的問題,因為裏面我也用了 \xCJKnumber 來轉換數字為國字。 因上我如法炮製更改 \titleformat 的做法,在 \titlecontents 加入了判別式, 如下 ===== 更改前的 \titlecontents ======== \titlecontents{chapter}[0em] {}{\normalfont\normalsize\bfseries\makebox[4.1em][l] {第\xCJKnumber{\thecontentslabel}章}}{} {\titlerule*[0.7pc]{.}\contentspage} ===== 更改後的 \titlecontents ======== \titlecontents{chapter}[0em] {}{\normalfont\normalsize\bfseries\makebox[4.1em][l]% {\ifthenelse{\boolean{isAppendix}}% {附件\xCJKnumber{\thechapter}}% {第\xCJKnumber{\thecontentslabel}章}}% }{}% {\titlerule*[0.7pc]{.}\contentspage} 不過問題一樣會出現,在用 XeLaTeX 編輯二次後,會出現 錯誤訊息如下 ! Missing number, treated as zero. <to be read again> A l.4 ...{\numberline {A}測試 TEST}{3}{appendix.A} 我猜想是 isAppendix 在 XeLaTeX 編目錄時,仍是 false 的狀態,才會有上述錯誤。不過如果把 isAppendix=True 放在 \tableofcontents 之前,則目錄上所有章節都變成 '附件零', 也就是從原本'第一章' 變成 '附件零', '第二 章' '第三章' 都一樣變成 '附件零', 不過本文中的附件 標題不會有問題,出錯都是在 目錄 上面的名稱。 這個問題有解法嗎?感激不盡!! ======原始碼============================ %!TEX TS-program = xelatex %!TEX encoding = UTF-8 Unicode % \documentclass[12pt,a4paper,twoside]{report} \setcounter{secnumdepth}{3} %設定章節層級至 1.1.1.1 \setcounter{tocdepth}{3} % \usepackage{amsmath, amsthm, amssymb, txfonts, upgreek, amsbsy, mathrsfs} \usepackage{fontspec} \usepackage[a4paper,top=3.0cm,bottom=2.54cm,left=2cm,right=2cm,bindingoffset=1cm]{geometry} % 邊界設定,bindingoffset表示裝訂邊 \usepackage[unicode]{hyperref} % 為 pdf 設定頁籤,開啟 pdf 檔案檢視時左側會有 bookmark 可用 \usepackage{type1cm} % 使 Type1 字型可以無段放大縮小 \usepackage{graphicx} % 可直接插入圖片 \usepackage{float} \usepackage{caption} \usepackage{indentfirst} % 首段縮排 \usepackage{url} % 文稿中出現的 \url{網址} 能夠隨文斷行 \usepackage{natbib} % 增加更多文獻引用細節功能 \bibpunct{(}{)}{;}{a}{,}{,} \usepackage{fancyhdr} % 設定頁首頁尾用的套件 \usepackage{titlesec, titletoc} \usepackage{appendix} \usepackage{ifthen} % %====================================================================== %% use xeCJK \usepackage[BoldFont,SlantFont,CJKnumber,CJKchecksingle]{xeCJK} \usepackage{xCJKnumb} \setCJKmainfont{BiauKai}%{標楷體} \setromanfont{Times New Roman} \XeTeXlinebreaklocale "zh" \XeTeXlinebreakskip = 0pt plus 1pt % \newboolean{isAppendix} \setboolean{isAppendix}{false} % %\titleformat{\chapter}{\centering\Huge\bfseries}{第\,\xCJKnumber{\thechapter}\,章}{1em}{} %設定章標題 (\chapter) 格式 % \titleformat{\chapter}% %設定章標題 (\chapter) 格式 {\centering\Huge\bfseries}{% \ifthenelse{\boolean{isAppendix}}% {附件\thechapter}% {第\,\xCJKnumber{\thechapter} \,章}% }{1em}{} % \titlespacing{\chapter}{0pt}{0em}{2em} %設定章標題 (\chapter)上下間距 % %\titlecontents{chapter}[0em] % {}{\normalfont\normalsize\bfseries\makebox[4.1em][l] % {第\xCJKnumber{\thecontentslabel}章}}{} % {\titlerule*[0.7pc]{.}\contentspage} % \titlecontents{chapter}[0em] {}{\normalfont\normalsize\bfseries\makebox[4.1em][l]% {\ifthenelse{\boolean{isAppendix}}% {附件\xCJKnumber{\thechapter}}% {第\xCJKnumber{\thecontentslabel}章}}% }{}% {\titlerule*[0.7pc]{.}\contentspage} % % %======================================================================== % \renewcommand{\contentsname}{目\,\,\,錄} \renewcommand{\figurename}{圖} \renewcommand{\tablename}{表} \renewcommand{\listfigurename}{圖目錄} \renewcommand{\listtablename}{表目錄} \renewcommand{\bibname}{參考文獻} % % Redefine the second level of Enumerate \renewcommand{\theenumii}{(\arabic{enumii})} % (1) (2) (3) ... \renewcommand{\labelenumii}{\theenumii} % third level \renewcommand{\theenumiii}{\Alph{enumiii}、} % A, B, C... \renewcommand{\labelenumiii}{\theenumiii} % \def\bibpreamble{\protect\addcontentsline{toc}{chapter}{參考文獻}} %納入參考文獻 % %========================================================== \pagestyle{fancy} % 設定頁首頁尾 \renewcommand{\chaptermark}[1]{\markboth{}{}} % %== 設定標題頁出現頁首頁尾 \fancypagestyle{plain}{% \fancyhf[]{} \fancyhead[LE,RO]{系統擴增開發\\工作計畫書} \fancyhead[LO,RE]{} \fancyfoot[C]{\small\thepage} } % % == 設定本文頁首頁尾 \fancyhf[]{} \fancyhead[LE,RO]{系統擴增開發\\工作計畫書} \fancyhead[LO,RE]{} \fancyfoot[C]{\small\thepage} %\renewcommand{\headrule}{\hrule width\headwidth height\1pt} \renewcommand{\headrulewidth}{0.4pt} \renewcommand{\footrulewidth}{0.4pt} % % % %====================================================== %====== 開始本文 ======================================== \begin{document} % \pagenumbering{roman} \tableofcontents \listoffigures \listoftables \clearpage % % 正文開始的環境設定 % ================================================================================ \pagenumbering{arabic} % 頁碼改以阿拉伯數字表示 \captionsetup{labelsep=quad} %修改圖表號,拿掉冒號, eg. 圖1.1 \fontsize{12pt}{18pt}\selectfont % 行高 1.5 % % %=========================================================================== % for testing \chapter{第一名} 測試測試 test test test test 測試測試 test test測試測試 test test測試測試 test test測試測試 test test \section{Test 測試} test test 測試測試 test test測試測試 test test測試測試 test test測試測試 test test \clearpage \section{測試 Test} test test 測試測試 test test測試測試 test test測試測試 test test測試測試 test test 123456 ABCDFG $\alpha \beta$ 測試!測試!測試! % % %======= Appendix ======================== % \clearpage\newpage \appendix \setboolean{isAppendix}{true} \raggedbottom\sloppy % %\setcounter{chapter}{1} \chapter{測試 TEST} \section{test 測試} % \end{document} -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.33.24.29
文章代碼(AID): #1EEKtvB_ (LaTeX)
文章代碼(AID): #1EEKtvB_ (LaTeX)