0

I'd like to ToC generated by \parttoc start at the top of the page, removing the default top margin, without using \titlesecpackage. I was be able to remove top margin from a general ToC, but not from a part ToC.

I let my test code here:

\documentclass{report}
\usepackage{minitoc}
\usepackage[spanish]{babel}
\usepackage{tocvsec2}

\begin{document}
\doparttoc

%Removing top margin above ToC
\begingroup
\makeatletter
% Redefine the \chapter* header macro to remove vertical space
\def\@makeschapterhead#1{%
%\vspace*{50\p@}% Remove the vertical space
{\parindent \z@ \raggedright
\normalfont
\interlinepenalty\@M
\Huge \bfseries  #1\par\nobreak
\vskip 40\p@
}}
\makeatother
\tableofcontents
\endgroup

\part{MEMORIA}

%Trying to remove part ToC top margin as the previous one (doesn't work)
\begingroup
\makeatletter
% Redefine the \chapter* header macro to remove vertical space
\def\@makeschapterhead#1{%
%\vspace*{50\p@}% Remove the vertical space
{\parindent \z@ \raggedright
\normalfont
\interlinepenalty\@M
\Huge \bfseries  #1\par\nobreak
\vskip 40\p@
}}
\makeatother
\parttoc
\endgroup

\chapter{Chapter1}
\section{Section1.1}
\chapter{Chapter2}
\section{Section2.1}

\end{document}

Could someone help me?

1

If you want the heading moved up but the space between the heading and the table to be the same (I honestly didn't understand which space you want to reduce), you can do so by redefining \mtcgapbeforeheads:

\documentclass{report}
\usepackage{minitoc}
\usepackage[spanish]{babel}
\usepackage{tocvsec2}

\renewcommand\mtcgapbeforeheads{0pt}

\begin{document}
\doparttoc

%Removing top margin above ToC
\begingroup
\makeatletter
% Redefine the \chapter* header macro to remove vertical space
\def\@makeschapterhead#1{%
%\vspace*{50\p@}% Remove the vertical space
{\parindent \z@ \raggedright
\normalfont
\interlinepenalty\@M
\Huge \bfseries  #1\par\nobreak
\vskip 40\p@
}}
\makeatother
\tableofcontents
\endgroup

\part{MEMORIA}

%Trying to remove part ToC top margin as the previous one (doesn't work)
\begingroup
\makeatletter
% Redefine the \chapter* header macro to remove vertical space
\def\@makeschapterhead#1{%
%\vspace*{50\p@}% Remove the vertical space
{\parindent \z@ \raggedright
\normalfont
\interlinepenalty\@M
\Huge \bfseries  #1\par\nobreak
\vskip 40\p@
}}
\makeatother
\parttoc
\endgroup

\chapter{Chapter1}
\section{Section1.1}
\chapter{Chapter2}
\section{Section2.1}

\end{document}

Result (from the top of the page, but cut off after the table):

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.