LaTeX 板


LINE

各位高手大家好,小弟又來請教了, 這次問題是有關 \addtocontents 這個命令 我想在 toc 的最後加上 附件一 的字樣,但 不要編號及頁碼,因此參考版上 po 文,加了 這一行 \addtocontents{toc}{\contentsline{chapter}{\numberline{}附件一}{}}% 可是在 XeLeTeX 下編譯,會出現以下錯誤 ! Argument of \contentsline has an extra }. <inserted text> \par l.174 ...sline{chapter}{\numberline{}附件一}{}} % 指出 \contentsline 多了個 } ,可是我怎麼看 都找不出是多那一個,曾試著從最右邊拿掉一個 } 但會編譯失敗,請各位高手幫小弟看看,到底原因 是出在那裏呢?附上原始碼,請參考。 謝謝,感激不盡。 =====原始碼 ========== %!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} % % %======================================================================== % \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 ======================== % \addtocontents{toc}{\contentsline{chapter}{\numberline{}附件一}{}}% % \end{document} --



※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.33.24.122
1F:→ uranusjr:\protect\contentsline{... 08/10 20:18







like.gif 您可能會有興趣的文章
icon.png[問題/行為] 貓晚上進房間會不會有憋尿問題
icon.pngRe: [閒聊] 選了錯誤的女孩成為魔法少女 XDDDDDDDDDD
icon.png[正妹] 瑞典 一張
icon.png[心得] EMS高領長版毛衣.墨小樓MC1002
icon.png[分享] 丹龍隔熱紙GE55+33+22
icon.png[問題] 清洗洗衣機
icon.png[尋物] 窗台下的空間
icon.png[閒聊] 双極の女神1 木魔爵
icon.png[售車] 新竹 1997 march 1297cc 白色 四門
icon.png[討論] 能從照片感受到攝影者心情嗎
icon.png[狂賀] 賀賀賀賀 賀!島村卯月!總選舉NO.1
icon.png[難過] 羨慕白皮膚的女生
icon.png閱讀文章
icon.png[黑特]
icon.png[問題] SBK S1安裝於安全帽位置
icon.png[分享] 舊woo100絕版開箱!!
icon.pngRe: [無言] 關於小包衛生紙
icon.png[開箱] E5-2683V3 RX480Strix 快睿C1 簡單測試
icon.png[心得] 蒼の海賊龍 地獄 執行者16PT
icon.png[售車] 1999年Virage iO 1.8EXi
icon.png[心得] 挑戰33 LV10 獅子座pt solo
icon.png[閒聊] 手把手教你不被桶之新手主購教學
icon.png[分享] Civic Type R 量產版官方照無預警流出
icon.png[售車] Golf 4 2.0 銀色 自排
icon.png[出售] Graco提籃汽座(有底座)2000元誠可議
icon.png[問題] 請問補牙材質掉了還能再補嗎?(台中半年內
icon.png[問題] 44th 單曲 生寫竟然都給重複的啊啊!
icon.png[心得] 華南紅卡/icash 核卡
icon.png[問題] 拔牙矯正這樣正常嗎
icon.png[贈送] 老莫高業 初業 102年版
icon.png[情報] 三大行動支付 本季掀戰火
icon.png[寶寶] 博客來Amos水蠟筆5/1特價五折
icon.pngRe: [心得] 新鮮人一些面試分享
icon.png[心得] 蒼の海賊龍 地獄 麒麟25PT
icon.pngRe: [閒聊] (君の名は。雷慎入) 君名二創漫畫翻譯
icon.pngRe: [閒聊] OGN中場影片:失蹤人口局 (英文字幕)
icon.png[問題] 台灣大哥大4G訊號差
icon.png[出售] [全國]全新千尋侘草LED燈, 水草

請輸入看板名稱,例如:Gossiping站內搜尋

TOP