LaTeX forum ⇒ GeneralUndefined control sequence in new chapter Topic is solved

LaTeX specific issues not fitting into one of the other forums of this category.
ziselos
Posts: 15
Joined: Sun Mar 04, 2018 12:03 pm

Undefined control sequence in new chapter

Postby ziselos » Sun Mar 04, 2018 12:25 pm

Hello,
These are my first steps in LaTex and i would like to to ask about an error that i get. I use XeLateX in order to write my thesis. I wrote the main file (that contains title, auhor etc) without problems and now i want to make seperates files for each chapter (chapter one, chapter two) and include them in the main tex file. When i start writing the first chapter in a seperate file, i get error :
Undefined control sequence
The code i use is :
\chapter{Chapter One}
Text of Chapter One....


If i write the chapter directcly in the main file, then i get the output correctly with no error. What am i doing wrong?
I use TexShop editor in MacOS

Tags:

User avatar
Johannes_B
Site Moderator
Posts: 4077
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Sun Mar 04, 2018 12:44 pm

You have to go back to your main document to compile.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

ziselos
Posts: 15
Joined: Sun Mar 04, 2018 12:03 pm

Postby ziselos » Sun Mar 04, 2018 2:04 pm

Thanks for your respnonse. I tried going back and compile the main tex file but i still get the same error in the line where i included the chapter file.
I wrote
\include{chapter one}
and i get the same error (Undefined sequence l1. \chapter) in that line

User avatar
Stefan Kottwitz
Site Admin
Posts: 9501
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Sun Mar 04, 2018 2:27 pm

It seems you use a document class that doesn't support chapters, such as article or scrartcl. book and report classes support chapters.

Perhaps post your document preamble here, so we can see your code and settings.

Stefan
Site admin

ziselos
Posts: 15
Joined: Sun Mar 04, 2018 12:03 pm

Postby ziselos » Sun Mar 04, 2018 2:56 pm

My main tex file is that (i use greek language):
Code: [Select all] [Expand/Collapse] [Download] ({untitled.tex})
  1. \documentclass[a4paper]{article}
  2. \usepackage{xltxtra}
  3. \usepackage{xgreek}
  4. \usepackage{unicode-math}
  5. \begin{document}
  6. \setmainfont[Mapping=tex-text,Ligatures=Common]{Garamond Premier Pro}
  7. \setsansfont[Mapping=tex-text,Scale=MatchLowercase]{Myriad Pro}
  8. \setmonofont[Scale=MatchLowercase]{Consolas}
  9. \setmathfont[Scale=MatchUppercase]{Asana Math}
  10. \graphicspath{ {images/} }
  11. \begin{titlepage}
  12. \centering
  13. %\vspace*{11\baselineskip}
  14. \large
  15. \bfseries
  16. \textbf{Thesis Title} \\[3\baselineskip]
  17. \normalfont
  18. \textbf{\today} \\[2\baselineskip]
  19. \end{titlepage}
  20. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  21.  
  22. \begin{abstract}
  23. Abstract
  24. \end{abstract}
  25.  
  26. \include{chapterOne}
  27.  
  28. \end{document}[/latex]
  29.  
  30. and the chapterOne file :
  31. [latex]\chapter{Chapter One}
  32. Content of chapter one.....

ziselos
Posts: 15
Joined: Sun Mar 04, 2018 12:03 pm

Postby ziselos » Sun Mar 04, 2018 3:18 pm

I changed the document class from article to report and now i can compile the main file without errors.
Thanks for your help.

User avatar
Johannes_B
Site Moderator
Posts: 4077
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Sun Mar 04, 2018 3:36 pm

Concerning the title page, you might be interested in http://tex.stackexchange.com/questions/ ... 280#210280
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

ziselos
Posts: 15
Joined: Sun Mar 04, 2018 12:03 pm

Postby ziselos » Sun Mar 04, 2018 5:14 pm

Thanks a lot.


Return to “General”

Who is online

Users browsing this forum: No registered users and 13 guests