1

I would like to move the local mini table of contents to the top corner of the page, like this:

enter image description here

Also, how do you make the section numbers bold? Thank you!

Here is the code:

\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} 
2

You can include the additional parameters above left=\topmargin, anchor=north west, above left=\topmargin, anchor=north west and at (current page.north west), as follows:

\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}}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.