章目录的章编号无法移动到页面最左侧

发布于 2022-04-29 12:27:54

目录中我设计的章标题无法移动到页面最左侧,如图问题.JPG
请问我想将图中蓝色圈中内容移动到图中红圈位置,有办法做到吗?
以下是最小问题示例,请大佬解答下,试了很多办法都行不通,很无奈,谢谢大佬!

\documentclass{ctexbook}
\usepackage{titletoc}
\usepackage[svgnames]{xcolor}
\usepackage{tikz}
\usetikzlibrary{calc,backgrounds,shadows, shadings}
%%---------------------------------------CHAPTER TOC STYLE--------------------------------------%%
\def\ChapterName{ \thecontentslabel}
\titlecontents{chapter}%标题名
            [30pt]%左间距
            {\bf \large\addvspace{1pc}}%标题格式
            {\contentsmargin{0pt}%
            \tikz[overlay] \shade[left color=LightSkyBlue!80,right color=LightSkyBlue!10!white,rounded corners=1pt] (-2.5em,-1ex) rectangle (.95\textwidth,1em);%
            \begin{tikzpicture}[remember picture]
                \node[rectangle, %opacity=.3,
                    text=white,
                    drop shadow={opacity=.3, color=black!40!white,shadow xshift=0.1cm},
                    inner sep=1mm,fill=teal,
                    anchor=west,
                    rounded corners=1mm,
                    font=\normalsize] at (0,0) {\ChapterName};
            \end{tikzpicture}\hspace*{2pt}%
             \tikz[overlay] \shade[top color=magenta!80,bottom color=magenta!10!white,rounded corners=.3pt] (0,-1ex) rectangle (2.4pt,1em);%
            \hspace*{2pt}%
            }%标题标志
            {}%无序号标题
            {\titlerule*[1000pc]{$\cdot$}\contentspage\hspace*{0cm}\vspace*{.7ex}}  %指引线与页码
%%-----------------------------------------CHAPTER TOC STYLE---------------------------------------%%
\begin{document}
\tableofcontents
\chapter{测试}
\section{测试}
\subsection{测试}
\chapter{测试二}
\section{测试二}
\subsection{测试二}
\chapter{测试三}
\section{测试三}
\subsection{测试三}
\end{document}

查看更多

关注者
0
被浏览
1.1k
1 个回答
烟云幻梦
烟云幻梦 2022-04-29
数学系咸鱼一枚!
%%---------------------------------------CHAPTER TOC STYLE--------------------------------------%%
\def\ChapterName{ \thecontentslabel}
\titlecontents{chapter}%标题名
            [30pt]%左间距
            {\bf \large\addvspace{1pc}}%标题格式
            {\contentsmargin{0pt}%
            \tikz[overlay] \shade[left color=LightSkyBlue!80,right color=LightSkyBlue!10!white,rounded corners=1pt] (-2.5em,-1ex) rectangle (.95\textwidth,1em);%
            \hspace*{-30pt}\raisebox{-.8ex}{\begin{tikzpicture}[remember picture]
                \node[rectangle, %opacity=.3,
                    text=white,
                    drop shadow={opacity=.3, color=black!40!white,shadow xshift=0.06cm,shadow yshift=-0.06cm},
                    inner sep=1mm,fill=teal,
                    %anchor=west,
                    rounded corners=1pt,
                    font=\normalsize] at (0,0) {\ChapterName};
            \end{tikzpicture}}\hspace*{3pt}%
             \tikz[overlay] \shade[top color=teal!30!white,bottom color=teal!80!white,rounded corners=.3pt] (0,-1ex) rectangle (2.4pt,1em);%
            \hspace*{5pt}%
            }%标题标志
            {}%无序号标题
            {\titlerule*[1000pc]{$\cdot$}\contentspage\hspace*{0cm}\vspace*{.7ex}}  %指引线与页码
%%-----------------------------------------CHAPTER TOC STYLE---------------------------------------%%

撰写答案

请登录后再发布答案,点击登录

发布
问题

分享
好友

手机
浏览

扫码手机浏览