why do I get 'Undefined control sequence' for KOMAoptions?

5,389

The preamble of LaTeX files usually starts with \documentclass. You use the documentclass report, which is included in LaTeX. The KOMA-script bundle offers its own documentclasses: scrartcl instead of article, screprt instead of report and scrbook instead of book.

So please switch from report to screprt for using KOMA-script commands. You don't need to load typearea, if you do this. In case you just need some features of KOMAscript, have a look at the package scrextend.

I did not test your example regarding the size of the included page. But it is a bad idea to mix geometry and typearea. Choose one of them and stick to it.

Share:
5,389

Related videos on Youtube

Marcus Junius Brutus
Author by

Marcus Junius Brutus

Updated on May 23, 2020

Comments

  • Marcus Junius Brutus
    Marcus Junius Brutus over 3 years

    I am trying to include A3 pages in an A4 LaTeX document (following this answer) but get the following when I run pdflatex:

    Chapter 1.
    [1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] [2]
    ! Undefined control sequence.
    \AP@ ->{ \clearpage \KOMAoptions 
                                 {paper=a3,paper=landscape} \recalctypearea ...
    l.27 \end{document}
    
    ?
    

    SSCCE below:

    \documentclass[11pt,twoside,a4paper,pagesize]{report}
    \usepackage{pslatex,palatino,avant,graphicx,color,nextpage,afterpage,comment}
    \usepackage[margin=2cm]{geometry}
    \usepackage[absolute]{textpos}
    \usepackage[hyphens]{url}
    \PassOptionsToPackage{hyphens}{url}
    
    \begin{document}
    \chapter{Introduction}
    foo
    \clearpage
    bar
    
    \afterpage{ % Insert after the current page
    \clearpage
    \KOMAoptions{paper=a3,paper=landscape}
    \recalctypearea
    A3 stuff goes here ...
    \clearpage
    \KOMAoptions{paper=A4,pagesize}
    \recalctypearea
    }
    
    
    \end{document}
    

    I understand that "undefined control sequence" means I've forgotten to use some package on my document preamble. However it is not clear to me what's wrong in this case.

    • Mario S. E.
      Mario S. E. over 9 years
      You are not using the KOMA version of report, scrreprt, and I think that's why your code is not reading the \recalctypearea... you either load the package or you change your documentclass to include the KOMA versio of report
    • Marcus Junius Brutus
      Marcus Junius Brutus over 9 years
      @MarioS.E. which package should I load?
    • Mario S. E.
      Mario S. E. over 9 years
      It's the typearea package