我想将本地迷你目录移动到页面的顶角,如下所示:
另外,如何使章节编号加粗?谢谢!
以下是代码:
\documentclass{report}
\RequirePackage{polyglossia}
\RequirePackage{calc}
\RequirePackage[usenames,dvipsnames,svgnames,table]{xcolor}
\RequirePackage{amsmath, amsfonts, amssymb}
\RequirePackage{ragged2e}
\RequirePackage{eso-pic}
\RequirePackage{fancyhdr}
\RequirePackage{marginfix}
\RequirePackage{titletoc}
\RequirePackage{mdframed}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Layout
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage{changepage}
\patchcmd{\part}{\thispagestyle{plain}}{\thispagestyle{empty}}{}{\errmessage{Cannot patch \string\part}}
\setlength{\parindent}{0pt}
\setlength{\parskip}{\baselineskip}
\setlength{\marginparpush}{1.5\baselineskip}
\RequirePackage[
xetex,
a4paper,
% showframe,
twoside,
top=27mm,
bottom=27mm,
inner=20mm,
outer=20mm,
ignorehead,
ignorefoot,
includemp,
marginparwidth=52mm,
marginparsep=8mm,
headsep=7mm,
footskip=14mm,
headheight=12.2pt,
]{geometry}
% Commands for changing the page layout mid-document
\newcommand{\symmetricalPage}{
\fancyhfoffset[OR, EL]{0mm}
\newgeometry{
top=20mm,
bottom=20mm,
inner=20mm,
outer=20mm,
includehead,
ignorefoot,
nomarginpar,
headsep=10mm,
footskip=10mm,
}
}
\newcommand{\asymmetricalPage}{
\restoregeometry
\fancyhfoffset[OR, EL]{\marginparsep + \marginparwidth}
}
\setlength{\columnsep}{\marginparsep}
% Saving some length as commands
\newlength{\wholeMargin}
\setlength{\wholeMargin}{\marginparwidth}
\addtolength{\wholeMargin}{\marginparsep}
\newlength{\wholeWidth}
\setlength{\wholeWidth}{\textwidth}
\addtolength{\wholeWidth}{\wholeMargin}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Titling
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{etoc}
\RequirePackage{titlesec}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Hyper-references
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage{hyperref}
\hypersetup{
pdftoolbar=false,
pdfmenubar=true,
pdffitwindow=false,
pdfborder={0 0 0},
pdfcreator=LaTeX,
colorlinks=true,
linkcolor=black,
linktoc=all,
urlcolor=blue,
citecolor=blue,
filecolor=blue,
breaklinks
}
\usepackage{lipsum}
\usepackage{tikz}
\usetikzlibrary{shadows.blur}
\usepackage{titletoc}
\usepackage{calc}
\usepackage[]{titlesec}
\definecolor{lightGrey}{gray}{0.94}
\colorlet{chpnumbercolor}{blue}
\makeatletter
\let\oldl@chapter\l@chapter
\def\l@chapter#1#2{\oldl@chapter{#1}{\textcolor{black}{\textbf{#2}}}}
\let\old@dottedcontentsline\@dottedtocline
\def\@dottedtocline#1#2#3#4#5{%
\old@dottedcontentsline{#1}{#2}{#3}{#4}{{\textcolor{black}{#5}}}}
\makeatother
%command to print the acutal minitoc
\newcommand{\printmyminitoc}{%
\noindent\hspace{-2cm}%
\colorlet{chpnumbercolor}{white}%
\begin{tikzpicture}
\node[rounded corners,align=left,fill=lightGrey, blur shadow={shadow blur steps=5}, inner sep=5mm]{%
\color{black}%
\begin{minipage}{8cm}%minipage trick
\hfill\rule{\linewidth}{.5mm}
\printcontents[chapters]{}{1}{}
\hfill\rule{\linewidth}{.5mm}
\end{minipage}};
\end{tikzpicture}}
\begin{document}
\chapter{Introduction}
\startcontents[chapters]
\printmyminitoc
\section{Lorem Ipsum Dolor}
\lipsum[2]
\subsection{Test Subsection}
\lipsum[1]
\section{Nam dui ligula}
\lipsum[3]
\chapter{Content}
\startcontents[chapters]
\printmyminitoc
\lipsum[2]
\lipsum[3]
\section{First Section}
\subsection{Subsection}
\lipsum[2]
\lipsum[2]
\lipsum[3]
\end{document}
答案1
您可以包含附加参数above left=\topmargin, anchor=north west
、above left=\topmargin, anchor=north west
和at (current page.north west)
,如下所示:
\newcommand{\printmyminitoc}{%
\noindent\hspace{-2cm}%
\colorlet{chpnumbercolor}{white}%
\begin{tikzpicture}[remember picture, overlay, transform shape]
\node[above left=\topmargin, anchor=north west, rounded corners, align=left, fill=lightGrey, blur shadow={shadow blur steps=5}, inner sep=5mm] at (current page.north west)
{%
\color{black}%
\begin{minipage}{8cm}%minipage trick
\hfill\rule{\linewidth}{.5mm}
\printcontents[chapters]{}{1}{}
\hfill\rule{\linewidth}{.5mm}
\end{minipage}
};
\end{tikzpicture}}