目前遇到一个需求,需要在章下添加小目录。 要实现的效果: ![](https://pics.latexstudio.net/data/images/202002/39c46ee8eefa025.png) 网络搜到,使用以下代码: ```tex \startcontents[chapters] \printcontents[chapters]{}{1}{\contentsmargin{1em}} ``` 实现了部分需求: ![](https://pics.latexstudio.net/data/images/202002/5b21ee1c1316531.png) 我想要的效果是第一张图的效果,但不知道怎么解决。 ```tex \chapter{卷第一 神仙一} \section{老子} \section{木公} \section{廣成子} \section{黄安} \section{孟岐} ```

2 回答2

0
你可以考虑去搜一下 elegantbook 实现的那个章目录样式。
0
目录设置主要通过`titlesec`,`titleps`,`titletoc`这几个包,可以在[手册](http://tug.ctan.org/macros/latex/contrib/titlesec/titlesec.pdf "手册")里仔细查命令。 这里有个例子,可以参考 [https://tex.stackexchange.com/a/56315/204863](https://tex.stackexchange.com/a/56315/204863)。 文字竖直排版不太了解,也许可以参考[黄帝内经](https://gitee.com/songjinghe/hall-of-light "黄帝内经")。

回答: 2020-02-14 12:44

一个利用tikz修改目录格式的例子。 [文字阴影](https://latexstudio.net/index/details/index/mid/67.html "文字阴影")的代码。 ```tex %!TEX encoding = utf8 %!TEX program = xelatex \documentclass[UTF8]{ctexbook} \usepackage{titletoc} \usepackage{titlesec} \usepackage{tikz} \usepackage{xcolor} \usepackage{zhlipsum} \usetikzlibrary{fadings} %文字倒影 %https://latexstudio.net/index/details/index/mid/67.html \newcommand{\tikzcontent}[1]{ \begin{tikzpicture}[transform shape] \draw (0,0) node { #1 }; \draw (-1em,-1ex) -- (1em,-1ex); \path[scope fading=south] (-1em,-0.25em) rectangle (1em,-3.75ex); \draw[yscale=-1] (0,2ex) node { #1 }; \end{tikzpicture} } \begin{document} \titleformat{\chapter}[block] {\normalfont\huge\bfseries} {\chaptertitlename\ \thechapter}{20pt} {\Huge \tikzcontent} [\vspace*{2pc}\titlerule\vspace*{1pc} \startcontents%\vbox{\Large\partialtocname}\vskip1ex \printcontents{l}{1}{\setcounter{tocdepth}{1}}\vspace*{1pc}\titlerule] \titlecontents*{lsection}[0pt] {\small\normalfont} {\thecontentslabel \tikzcontent }%章节标号 {} {\thecontentspage \textbullet }%页码 [\space] [] \titlecontents*{lsubsection}[0pt]{}{}{}{} \chapter{并不八佰伴} \section{第一节} \zhlipsum \section{第二节} \zhlipsum \section{第三节} \zhlipsum \section{第四节} \zhlipsum \chapter{从此曹操从} \section{第一节} \zhlipsum \section{第二节} \zhlipsum \section{第三节} \zhlipsum \section{第四节} \zhlipsum \end{document} ```

你的回答

请登录后回答

你的回答将会帮助更多人,请务必认真回答问题。