1

I'm deseperatly trying to change the colors of the rules in minitoc.

I tried differents things :

Try 1 : Change all hrule colors with

\makeatletter
\let\old@rule\@rule
\def\@rule[#1]#2#3{\textcolor{blue}{\old@rule[#1]{#2}{#3}}}
\makeatother

Result : Only change the end rule of minitoc. May be the first one is not a hrule.

EDIT : Try 2 : Disable rules and draw by myself

Result : It works but the rules are very bad handled and the vertical spacing is random... I managed to do this :

\documentclass[12pt,a4paper,twoside,openright]{book}
\usepackage{xcolor}
\usepackage{minitoc}

\begin{document}
\pagestyle{empty}
\mtcsettitle{minitoc}{}
\mtcsetrules{minitoc}{off}
\mtcsetfeature{minitoc}{after}{\vspace{-25pt}}
\mtcsetfeature{minitoc}{before}{\vspace{-35pt}}

\dominitoc
%\tableofcontents

\chapter{My Chapter}
{\large \bfseries \textcolor{red}{Sommaire}}
\noindent \textcolor{red}{\rule{\textwidth}{0.4pt}}
\minitoc
\noindent \textcolor{red}{\rule{\textwidth}{0.4pt}}

\section{Section 1}
\subsection{Subsection 1}
\subsection{Subsection 2}
\subsection{Subsection 3}

\section{Section 2}
\subsection{Subsection 2.1}
\end{document}

enter image description here

And I would like to remove space between the line "Sommaire" and the first rule. Do you know how to do that ?

Thanks !

  • Welcome to TeX.SX! Could you please post your desired output and a compilable code example (instead of or in addition to the fragments)? – TeXnician May 11 '18 at 8:27
  • 1
    Are you sure that your code produces two rules? For me there's only one rule (after adding the xcolor package and changing the color to a color which is predefined). – TeXnician May 11 '18 at 9:16
  • Yeah i'm pretty sure. I disabled the minitoc rules with \mtcsetrules{minitoc}{off} and replace the title by a top rule \mtcsettitle{minitoc}{\textcolor{primary_shade3}{\rule{\textwidth}{0.4pt}}} and added after the minitoc the end rule with \noindent \textcolor{primary_shade3}{\rule{\textwidth}{0.4pt}} – Maxouille May 11 '18 at 11:35
  • Please, do you have any ideas ? – Maxouille May 14 '18 at 7:39
  • 1
    Your MWE does not compile. – user36296 May 30 '18 at 11:51
2
+50

I could not compile your MWE as necessary packages and commands were missing.

The two lines are differently set. The top rule can be colourd using \arrayrulecolor{red}, for the bottom rule the definition can be adjusted.

\documentclass{book}

\usepackage{minitoc}
\usepackage{xcolor}
\usepackage{colortbl}

\makeatletter
\def\mtc@bottom@rule{%
  \ifx\mtc@rule\relax\relax\else
      \vskip -2.5ex
        \color{red}\rule[2.4\p@]{\columnwidth}{.4\p@}\vspace*{2.6\p@}\fi}    
\makeatother
\begin{document}

\faketableofcontents
\dominitoc

\chapter{Chapter}
\arrayrulecolor{red}
\minitoc

\section{Section}

\end{document}

enter image description here

  • It's working ! Thanks ! Do you know how to set the exact same vertical space between the top rule and the content and the bottom rule and the content ? Best ! – Maxouille May 30 '18 at 16:15
  • @Maxouille That is a new question. – user36296 May 30 '18 at 16:18
  • New question here : tex.stackexchange.com/questions/434264/… – Maxouille May 31 '18 at 7:51

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.