Search code examples
latextableofcontents

LaTeX table of contents using package curve


I'm struggling for some hours now on how to make a table of contents when using the CurVe class. The class hasn't defined commands such as \tableofcontents, \section, etc.

Any ideas on how to associate a toc to the rubrics? and display the toc with \tableofcontents or make the command "\tableofrubrics"?

E.g., I want to make the table of contents/rubrics in this example: https://github.com/ArwensAbendstern/CV-LaTeX/tree/master/full%20CurVe%20CV%20English.

Professional Experience .... 1
Education................... 1
etc.

thank you!


Solution

  • \NeedsTeXFormat{LaTeX2e}
    \documentclass[a4paper,skipsamekey,12pt,english]{curve} % your specs, esp the language of your CV
    
    \usepackage[T1]{fontenc} % special characters, etc.
    \usepackage[a4paper,nohead,nofoot,hmargin=2cm,vmargin=2cm]{geometry} % adapt to your specs
    
    \usepackage[english]{babel} % the language of your CV
    \usepackage{textcomp} % Trademarks and other symbols
    
    \usepackage{color} % e.g. for coloured links
    \usepackage[colorlinks]{hyperref} % clickable links in the PDF
    \definecolor{darkblue}{rgb}{0,0,.5}  % defines link colour
    
    %%% setup the options for the hyperref package
    \hypersetup{%
     pdftex=true,%
     colorlinks=true,% 
     breaklinks=true,%
     linkcolor=darkblue,%
     menucolor=darkblue,%
     urlcolor=darkblue,%
     }
    
    %%% if you want to include flavors:
    % \flavor{corp} % corp version of the experience rubric
    % \flavor{academic} % academic version of the experience rubric
    
    %%% if you want different title styles
    % \input{title.online.ltx}
    % \input{title.print.ltx}
    
    %%% if you don't need different title styles:
    
    \title{Graduate Student} % Who are you? e. g. Assistant Professor, Chief Engineer, Senior Executive 
    
    \subtitle{at the Peace Institute, Z\"urich, Switzerland} % a bit more info about you
    
    % vertical space after subrubric
    \setlength \subrubricspace{3ex} % CurVe default: 5pt
    
    % special characters as bullet point symbols
     \usepackage{pifont} % only if you need them
     \prefix{\ding{43}} % pointing finger as a bullet list item symbol 
    
    % if rubric is spread onto multiple pages, the rubric name is repeated and followed by:
    \continuedname{~~(continued)} % for a CV in English
    
    
    \makeatletter
    \renewenvironment{rubric}[1]{%
      \addcontentsline{toc}{section}{\newline#1\dotfill}%
      %% \begin{rubric}
      \def\raggedright{%
        \@rightskip\@flushglue\rightskip\@rightskip\leftskip\z@skip}%
      \def\raggedleft{%
        \rightskip\z@skip\leftskip\@flushglue\parfillskip\z@skip}%
      \gdef\@beforespace{0pt}%
      \gdef\@nextentry{}%
      \gdef\@previouskey{}%
      \global\let\old@newpage\newpage%
      \global\let\old@pagebreak\pagebreak%
      \global\let\old@nopagebreak\nopagebreak
      \begin{longtable}{@{}kl@{~}X@{}}
        \@rubrichead{#1}\\*[\rubricspace]
        \endfirsthead
        \@rubrichead{#1\@continuedname}\\*[\rubricspace]
        \endhead
        \noalign{\@rubricmark{#1}%
          \global\let\in@newpage\newpage%
          \global\let\in@pagebreak\pagebreak%
          \global\let\in@nopagebreak\nopagebreak%
          \gdef\newpage{\@nextentry\noalign{\gdef\@nextentry{}}\in@newpage}
          \gdef\pagebreak{\@nextentry\noalign{\gdef\@nextentry{}}\in@pagebreak}
          \gdef\nopagebreak{\@nextentry\noalign{\gdef\@nextentry{}}\in@nopagebreak}}}{%
        %% \end{rubric}
        \@nextentry
      \end{longtable}\par\vspace\rubricafterspace
      \global\let\newpage\old@newpage%
      \global\let\pagebreak\old@pagebreak%
      \global\let\nopagebreak\old@nopagebreak}
    
    
    
    \newcommand\tableofcontents{%
        \@starttoc{toc}%
        }
    \makeatother
    
    \begin{document}
    \maketitle
    
    \tableofcontents
    
    % call the rubric files in preferred order
    % make sure your file names are correct
    
    \makerubric{experience} % calls experience.ltx
    \makerubric{education}  % calls education.ltx
    \makerubric{skills} % calls skills.ltx
    \makerubric{references} % calls references.ltx
    \makerubric{publications} % calls publications.ltx
    
    \end{document} % end of main document CV.ltx
    

    enter image description here