I am using tikz to customise my miniToc at each chapter. however I am having problems with the alignment of the TOC inside the node.
I have used \begin{flushright} inside the minipage, also to use \contentsmargin{0cm} before the \printcontents command, also \noindent. However, I have not gotten the desire result.
This is what I am after:
This is the code I am using for the customisation of the minitoc:
\newcommand{\printmyminitoc}{%
\begin{center}%
\begin{tikzpicture}%
\node[anchor=south,inner ysep=12.5pt,inner xsep=20pt,align=flush left] (s) at (current page.south) {
\begin{minipage}[c][][t]{0.90\textwidth}
\begin{flushright}
\renewcommand{\baselinestretch}{1.2}\selectfont
\startcontents[chapters]
\printcontents[chapters]{}{1}{}
\end{flushright}
\end{minipage}
};
\draw[bottom color = blue!80, top color= blue!10, draw=blue!90,fill opacity=0.1,decorate, decoration={random steps,segment length=3pt,amplitude=1pt},line width=1.25pt] (s.north west) rectangle (s.south east);
\end{tikzpicture}%
\end{center}%
}
Could I get any guidance on how to define the correct alignment?
Here is the MWE:
\documentclass[twoside,12pt,openright]{scrbook}
\usepackage[a4paper]{geometry}
\usepackage[dvipsnames]{xcolor}
\usepackage[sfdefault]{universalis}
\usepackage{titletoc}
\usepackage{lipsum}
\usepackage{tikz}
\usetikzlibrary{decorations, decorations.pathmorphing, decorations.pathreplacing}
\usepackage[linkcolor=black,colorlinks=true]{hyperref}
%% command to print the actual minitoc ---------------------------------------------
\newcommand{\printmyminitoc}{%
\begin{center}%
\begin{tikzpicture}%
\node[anchor=south,inner ysep=12.5pt,inner xsep=20pt,align=flush left] (s) at (current page.south) {
\begin{minipage}[c][][t]{0.90\textwidth}
\begin{flushright}
\renewcommand{\baselinestretch}{1.2}\selectfont
\startcontents[chapters]
\printcontents[chapters]{}{1}{}
\end{flushright}
\end{minipage}
};
\draw[bottom color = blue!80, top color= blue!10, draw=blue!90,fill opacity=0.1,decorate, decoration={random steps,segment length=3pt,amplitude=1pt},line width=1.25pt] (s.north west) rectangle (s.south east);
\end{tikzpicture}%
\end{center}%
}
\begin{document}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\frontmatter
\pagenumbering{roman}
\pagestyle{empty}
\setcounter{tocdepth}{2}
\tableofcontents
\cleardoublepage
\mainmatter
\pagenumbering{arabic}
\setcounter{page}{1}
\pagestyle{headings}
\chapter{Intro}
\printmyminitoc
\lipsum[1-3]
\section{Intro 1 - Section 1}
\lipsum[1-3]
\section{Intro 1 - Section 2}
\lipsum[1-3]
\section{Intro 1 - Section 3}
\lipsum[1-3]
\section{Intro 1 - Section 4}
\lipsum[1-3]
\section{Intro 1 - Section 5}
\lipsum[1-3]
\chapter{Literature}
\printmyminitoc
\lipsum[1-3]
\section{Literature - Section 1}
\lipsum[1-3]
\section{Literature - Section 2}
\lipsum[1-3]
\section{Literature - Section 3}
\lipsum[1-3]
\section{Literature - Section 4}
\lipsum[1-3]
\section{Literature - Section 5}
\lipsum[1-3]
\end{document}


