![Criando um ToC muito personalizado para moderncv](https://rvso.com/image/305769/Criando%20um%20ToC%20muito%20personalizado%20para%20moderncv.png)
Minha universidade possui uma plataforma de busca de emprego que permite o upload de apenas um curriculum vitae. No entanto, quero carregar vários currículos, cada um em um idioma diferente (moro na Europa e falo três idiomas, e cada um deles tem convenções diferentes para currículos), então criei um arquivo grande (na verdade, um arquivo mestre com docmute
e três arquivos que podem ser compilados de forma independente) que possui três currículos incorporados, com \part
comandos invisíveis que fornecem geração de entradas de ToC.
Eu tenho vistoesta respostae tentei mexer titletoc
, obtendo uma espécie de ToC clássico do LaTeX, com hiperlink nos títulos das partes, mas não nos números das páginas.
Mas eu prefiro um ToC como
\section{Contents}
\cvitem{Page}{Language}
\cvitem{2}{Afrikaans}
\cvitem{3}{Zulu}
(obviamente com alguma formatação, mas por enquanto espere) eamboso texto e o número da página com hiperlink.
O código que tenho até agora é (mais ou menos mínimo WE):
\documentclass[a4paper,11pt,sans]{moderncv}
\usepackage{etoolbox}
\name{John}{Doe}
\title{Bank magician}
\moderncvstyle{classic}
\moderncvcolor{blue}
% For issuing \makecvtitle more than once
\patchcmd{\makecvtitle}{\newlength{\makecvtitledetailswidth}}{\let\makecvtitledetailswidth\relax\newlength{\makecvtitledetailswidth}}{}{}
\patchcmd{\makecvtitle}{\newlength{\makecvtitlepicturewidth}}{\let\makecvtitlepicturewidth\relax\newlength{\makecvtitlepicturewidth}}{}{}
\newcommand{\part}[1]{%
\clearpage%
\phantomsection%
\addcontentsline{toc}{part}{#1}%
}
\makeatletter % Table of Contents definition from Gonzalo Medina's answer
\newcommand\@pnumwidth{1.55em}
\newcommand\@tocrmarg{2.55em}
\newcommand\@dotsep{8}
\newcommand\contentsname{Contents}
\setlength\columnsep{20pt}
\setcounter{tocdepth}{0}
\newcommand\tableofcontents{%
\addtocontents{toc}{\protect\setcounter{tocdepth}{0}}
\newbox{\makecvtitlenamebox}
\savebox{\makecvtitlenamebox}{%
\namestyle{\@firstname\ \@lastname}%
}
\usebox{\makecvtitlenamebox}%
\par\nobreak % don't break a page here
\kern\the\prevdepth % don't take into account the depth of the preceding line
\kern 4pt % space before the rule
{ \color{gray!50}\hrule height 0.4ex width \textwidth } %1.05\wd\makecvtitlenamebox} % the rule
\kern 0.75em % space after the rule
\nointerlineskip % no additional space after the rule\hrule height 1ex width \wd\makecvtitlenamebox %
\ifthenelse{\equal{\@title}{}}{}{\titlestyle{\@title}}%
\vspace*{2\baselineskip}
\section*{\contentsname}
%\addtocontents{toc}{\protect\setcounter{tocdepth}{2}}
\@starttoc{toc}%
\clearpage
}
\usepackage{titletoc}
\titlecontents*{section}[0pt]
{}{}{\textbullet}
{\ \thecontentspage}[\\][]
\titlecontents{part}[0pt]
{}{}{\hspace*{5em}\Large}
{\leaders\hbox{\normalfont$\m@th\mkern \@dotsep mu\hbox{.}\mkern \@dotsep mu$}\hfill\Large\thecontentspage\hspace*{2em}}[]
\renewcommand\l@subsection[2]{}
\makeatother
\begin{document}
\tableofcontents
\part{Language 1}
\makecvtitle
\section{Section 1}
Some text
\part{Language 2}
\makecvtitle
\section{Section 1}
Some text
\end{document}
Responder1
eu achei aquilo
\newcommand\l@part[2]{\cvitem{\tocpagefont #2}{\tocentryfont #1}}
\newcommand\l@section[2]{}
\newcommand\l@subsection[2]{}
com comandos de formatação adequados \tocpagefont
e \tocentryfont
faz o trabalho, sem carregar arquivos titletoc
.
Da próxima vez devo ler melhor book.cls
:-)
Para hiperlinkar o título e o número, basta passar linktoc=all
para moderncv
: será passado para hyperref
.