![Creando un ToC muy personalizado para moderncv](https://rvso.com/image/305769/Creando%20un%20ToC%20muy%20personalizado%20para%20moderncv.png)
Mi universidad tiene una plataforma de búsqueda de empleo que permite subir un solo currículum vitae. Sin embargo, quiero cargar varios planes de estudio, cada uno en un idioma diferente (vivo en Europa y hablo tres idiomas, y cada uno de ellos tiene diferentes convenciones para los planes de estudio), así que se me ocurrió un archivo grande (en realidad, un archivo maestro con docmute
y tres archivos que se pueden compilar de forma independiente) que tiene tres planes de estudio integrados, con \part
comandos invisibles que proporcionan generación de entradas ToC.
He vistoesta respuestae intenté alterar titletoc
, obteniendo una especie de ToC de LaTeX clásico, con hipervínculos en los títulos de las partes pero no en los números de página.
Pero prefiero una ToC como
\section{Contents}
\cvitem{Page}{Language}
\cvitem{2}{Afrikaans}
\cvitem{3}{Zulu}
(obviamente con algo de formato, pero por el momento espera) yambosel texto y el número de página con hipervínculos.
El código que tengo hasta ahora es (más o 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}
Respuesta1
encontre eso
\newcommand\l@part[2]{\cvitem{\tocpagefont #2}{\tocentryfont #1}}
\newcommand\l@section[2]{}
\newcommand\l@subsection[2]{}
con comandos de formato adecuados \tocpagefont
y \tocentryfont
hace el trabajo, sin cargar archivos titletoc
.
La próxima vez debería leer mejor book.cls
:-)
Para crear un hipervínculo tanto para el título como para el número, simplemente pase linktoc=all
a moderncv
: se pasará a hyperref
.