
В моем университете есть платформа для поиска работы, которая позволяет загружать только одно резюме. Однако я хочу загрузить несколько учебных программ, каждую на другом языке (я живу в Европе и говорю на трех языках, и на каждом из них существуют разные соглашения для учебных программ), поэтому я придумал большой файл (фактически мастер-файл с docmute
тремя файлами, которые можно скомпилировать отдельно), в который встроены три учебных программы с невидимыми \part
командами, обеспечивающими генерацию записей ToC.
Я виделэтот ответи попытался повозиться с titletoc
, получив своего рода классический LaTeX ToC, с гиперссылкой на названия частей, но не на номера страниц.
Но я бы предпочел ToC как
\section{Contents}
\cvitem{Page}{Language}
\cvitem{2}{Afrikaans}
\cvitem{3}{Zulu}
(очевидно, с некоторым форматированием, но пока подождите) иобатекст и номер страницы гиперссылаются.
Код, который у меня есть на данный момент (более-менее минимальный 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}
решение1
я нашел это
\newcommand\l@part[2]{\cvitem{\tocpagefont #2}{\tocentryfont #1}}
\newcommand\l@section[2]{}
\newcommand\l@subsection[2]{}
с подходящими командами форматирования \tocpagefont
и \tocentryfont
делает свою работу, без загрузки titletoc
.
В следующий раз мне следует читать лучше book.cls
:-)
Для создания гиперссылки на заголовок и номер просто передайте linktoc=all
: moderncv
она будет передана hyperref
.