I am using RMarkdown in RStudio to compile a book written in Markdown. I am using the memoir class and it all works fine as long as I set toc: false. When I try to compile with toc I get the followin error:

! Undefined control sequence.
<argument> ...link}{\Hy@tocdestname }{\tocchapter 
                                                  {Chapter}{1}{Βασικές Έννοι...
l.1 ...Chapter}{1}{Βασικές Έννοιες}}{5}{chapter.1}

I don't really know much about latex so I am at a loss on how to debug this. Would be grateful for any pointers.

EDIT: Looking around after @daleif 's suggestion I found that the text in the error is from a .toc file. It contains three lines:

\contentsline {chapter}{\tocchapter {Chapter}{1}{Βασικές Έννοιες}}{5}{chapter.1}%
\contentsline {section}{\tocsection {}{1}{Το Ηχητικό Κύμα: Συχνότητα \& Πλάτος}}{5}{section.1.1}%
\contentsline {section}{\tocsection {}{2}{Το Πεδίο του Χρόνου}}{6}{section.1.2}%
  • 1
    Please show the generated .tex file. \tocchapter is not a known command from memoir so we need to know what else you are inserting into this.
    – daleif
    Commented Apr 13, 2021 at 13:52
  • Thank you for your comment @daleif . I 've added the tex file.
    – Dionysis
    Commented Apr 13, 2021 at 14:56
  • @daleif I found that \tocchapter was in a .toc file so I attached that as well.
    – Dionysis
    Commented Apr 13, 2021 at 15:03
  • @daleif OK, I solved it! the .toc file must have been left from a compilation before I started using the memoir class. Deleting it fixed the error! Thank you!
    – Dionysis
    Commented Apr 13, 2021 at 15:09
  • 1
    Put it into your question like with contentsline
    – daleif
    Commented Apr 13, 2021 at 15:59

1 Answer 1


The .toc file must have been leftover from a previous compilation without the memoir class. Deleting the file fixed the issue.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .