Re: [問題] titletoc 之標題對齊
看板LaTeX (論文排版)作者ChenMeng0518 (Ch'enMeng)時間11年前 (2014/01/07 19:06)推噓1(1推 0噓 0→)留言1則, 1人參與討論串2/2 (看更多)
這裡隻講一下 chapter 的問題﹐section 和 subsection 當然也需要調整一下﹐
但是依樣畫葫蘆並不困難。
\documentclass{book}
% 加上必要的 CJK 支持
\usepackage{titletoc}
\newlength{\ChapterLabelWidth}
\titlecontents{chapter}
[0em]
{}
{\let\OLDthecontentslabel\thecontentslabel%
\renewcommand{\thecontentslabel}{第\CJKnumber{\OLDthecontentslabel}章}%
\settowidth{\ChapterLabelWidth}{\thecontentslabel\hspace*{1em}}%
\contentslabel{\ChapterLabelWidth}}
{\hspace*{0em}}{\titlerule*{.}\contentspage}
\begin{document}
\tableofcontents
\chapter{title title title title title title title title title title title title title title title title title title title title title title title title title }
\end{document}
※ 引述《birdhackor (夜殘狼)》之銘言:
: 各位好
: 由於我希望可以將目錄的 lable
: 從
: 1 chapter name ........ page
: 1.1 section name .. page
: 變成
: 第一章 chapter name ........ page
: 1.1 section name .. page
: 這樣的格式
: 所以我用 titletoc 進行處理
: 語法如下
: \titlecontents{chapter}
: [0em]
: {}
: {第\CJKnumber{\thecontentslabel}章~~}
: {}{\titlerule*{.}\contentspage}
: %
: \titlecontents{section}
: [28pt]
: {}
: {\thecontentslabel\quad}
: {}{\titlerule*{.} \contentspage}
: %
: \titlecontents{subsection}
: [56pt]
: {}
: {\thecontentslabel\quad}
: {}{\titlerule*{.} \contentspage}
: 但我發現
: 這樣會產生一個問題
: 原本如果標題過長
: 再換行之後應該會對齊標題
: 像這樣
: 1.1 xxxxxxxxxxxxx
: xxxxx ....... 3
: 1.2 sssss ....... 4
: 用了上面的方式之後變成
: 1.1 xxxxxxxxxxxxx
: xxxxx ............ 3
: 1.2 sssss ....... 4
: 請問如何讓它恢復對齊呢?
--
來自萌氣四溢的 M 君~
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 183.217.25.49
※ 編輯: ChenMeng0518 來自: 183.217.25.49 (01/07 19:44)
※ 編輯: ChenMeng0518 來自: 183.217.25.49 (01/07 19:49)
推
01/07 22:39, , 1F
01/07 22:39, 1F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 2 篇):
LaTeX 近期熱門文章
PTT數位生活區 即時熱門文章