帮助在章节开始页上的 TikZ 节点内添加迷你目录

帮助在章节开始页上的 TikZ 节点内添加迷你目录

章节开始页上的 TikZ 节点内的迷你目录

嗨,这是关于上述问题和解决方案的问题。我希望有人能帮助我解决我遇到的错误(毫无疑问是由于我的技术不足)。

当我有多个章节时,它会以纯文本格式在迷你目录下方或上方打印来自之前和之后章节的部分。我附上了一张照片作为示例。

下面是我使用过的代码。

如果有人能帮忙,我将非常感激!

[![%\documentclass\[a4paper\]{report}
\documentclass\[a4paper\]{report}

\usepackage{wrapfig} % Allows in-line images such as the example fish picture
\usepackage{graphicx}
\graphicspath{{figures/}} %Setting the graphicspath
\usepackage{caption}
\usepackage{subcaption}\usepackage{ifdraft}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{color}
\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0.82}
\usepackage\[natbibapa\]{apacite}
\usepackage{rotating}
\usepackage{array}
\usepackage{hyperref}
\usepackage{tipa}
\usepackage{clrscode}
\usepackage{setspace}
\usepackage\[absolute\]{textpos} 
\usepackage{multirow}
\usepackage{colortbl}
\usepackage{afterpage}
\usepackage{xcolor}
\usepackage{booktabs}

\renewcommand{\rmdefault}{ptm}

%%%% allows you to manually change chapter number for submissions
\setcounter{chapter}{4}
%%%%%%%%%%%%%%%%%%%%%

%%%% allows you to have sections start as 1 instead of 1.1
\renewcommand\thesection{\arabic{section}}
%%%%%%%%%%%%%%%%%%%%%

%------------------------------------------------------------------------------------------------------------------------------------------    
%------------------------------------------------------------------------------------------------------------------------------------------    
%This is for The mini table of contents
%------------------------------------------------------------------------------------------------------------------------------------------   


\usepackage{tikz}
\usetikzlibrary{shadows.blur}
\usepackage{titletoc}
\usepackage{lipsum}
\usepackage{calc}
\usepackage\[\]{titlesec}
\usepackage{setspace}

\definecolor{yourcolor}{HTML}{D3D3D3}

\colorlet{chpnumbercolor}{black}
\makeatletter
\let\oldl@chapter\l@chapter
\def\l@chapter#1#2{\oldl@chapter{#1}{\textcolor{chpnumbercolor}{#2}}}

\let\old@dottedcontentsline\@dottedtocline
\def\@dottedtocline#1#2#3#4#5{%
\old@dottedcontentsline{#1}{#2}{#3}{#4}{{\textcolor{chpnumbercolor}{#5}}}}
\makeatother

\titleformat{\chapter}\[display\]
  {\normalfont\color{black}}
  {\filleft\Huge\rmfamily\bfseries\chaptertitlename\hspace*{2mm}%
  \begin{tikzpicture}\[baseline={(\[yshift=-.6ex\]current bounding box.center)}\]
    \node\[fill=black,circle,text=white\] {\thechapter};
  \end{tikzpicture}}
  {1ex}
  {\titlerule\[1.5pt\]\vspace*{5ex}\huge\rmfamily\itshape}
  \[\]

\titleformat{name=\chapter,numberless}\[display\]
  {\normalfont\color{black}}
  {}
  {1ex}
  {\vspace*{5ex}\huge\rmfamily\itshape}
  \[\]

%command to print the acutal minitoc
\newcommand{\printmyminitoc}{%
    \noindent\hspace{0cm}%
    \colorlet{chpnumbercolor}{black}%
    \begin{tikzpicture}
    \node\[rounded corners=0,align=left,fill=white, inner sep=4mm\]{%
        \color{black}%
        \begin{minipage}{11cm}%minipage trick
        \printcontents\[chapters\]{}{1}{}%this last piece \vspace{-8pt}\hspace{-2000pt} is to remove the weird chapter.# heading. Could not figure out any other way!
        \end{minipage}};
    \end{tikzpicture}}
%------------------------------------------------------------------------------------------------------------------------------------------    
%------------------------------------------------------------------------------------------------------------------------------------------    


\begin{document}


\chapter{Contextualizing rhythm in Stockholm}\label{chapter_rhythm}
\startcontents\[chapters\]
%print minitoc
{\setstretch{1.0}
\begin{scriptsize}
\printmyminitoc
\end{scriptsize}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%  RHYTHM IN STOCKHOLM
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Introduction: Rhythm in Stockholm}

In this chapter, I demonstrate that low rhythmic alternation is a feature in Stockholm's multiethnolect. I also provide data that shows that rhythmic alternation is stylistically sensitive; alternation increases with formality for speakers of multiethnolect. I define rhythm as the alternation of strong and weak elements and operationalize it using the \textit{normalized pairwise variability index of vowels} (\textit{nPVI-V}) \citep{lowetal2000}. I also show that high alternation is a feature of Stockholm's white \textit{svensk} working class and that this too is stylistically sensitive; alternation decreases with formality for working-class \textit{svensk} speakers. Independent of other social factors, younger speakers have lower prosodic alternation than older speakers. I interpret this to mean that low alternation is diffusing into mainstream Stockholm speech.

\subsection{Blah}
\section{Blah}

\subsection{Blah}
\section{Blah}
\subsection{Blah}

\chapter{Rhythm in Stockholm's vernacular}\label{chapter_rhythm}
\startcontents\[chapters\]
%print minitoc
{\setstretch{1.0}
\begin{scriptsize}
\printmyminitoc
\end{scriptsize}
}

\subsection{Blah}
\section{Blah}

\subsection{Blah}
\section{Blah}
\subsection{Blah}


\end{document}]

在此处输入图片描述

相关内容