GeneralUndefined control sequence in new chapter

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

Undefined control sequence in new chapter

Post by ziselos »

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

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Undefined control sequence in new chapter

Post by Johannes_B »

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

Undefined control sequence in new chapter

Post by ziselos »

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: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Undefined control sequence in new chapter

Post by Stefan Kottwitz »

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
LaTeX.org admin
ziselos
Posts: 15
Joined: Sun Mar 04, 2018 12:03 pm

Undefined control sequence in new chapter

Post by ziselos »

My main tex file is that (i use greek language):

Code: Select all

\documentclass[a4paper]{article}
\usepackage{xltxtra}
\usepackage{xgreek}
\usepackage{unicode-math}
\begin{document}
\setmainfont[Mapping=tex-text,Ligatures=Common]{Garamond Premier Pro}
\setsansfont[Mapping=tex-text,Scale=MatchLowercase]{Myriad Pro}
\setmonofont[Scale=MatchLowercase]{Consolas}
\setmathfont[Scale=MatchUppercase]{Asana Math}
\graphicspath{ {images/} }
   \begin{titlepage}
     \centering
     %\vspace*{11\baselineskip}
     \large
     \bfseries
     \textbf{Thesis Title} \\[3\baselineskip]
     \normalfont
         \textbf{\today} \\[2\baselineskip]
   \end{titlepage}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{abstract}
Abstract
\end{abstract}

\include{chapterOne}

\end{document}[/latex]

and the chapterOne file :
[latex]\chapter{Chapter One}
Content of chapter one.....
ziselos
Posts: 15
Joined: Sun Mar 04, 2018 12:03 pm

Undefined control sequence in new chapter

Post by ziselos »

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: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Undefined control sequence in new chapter

Post by Johannes_B »

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

Undefined control sequence in new chapter

Post by ziselos »

Thanks a lot.
Post Reply