LaTeX forum ⇒ Theses, Books, Title pagesLaTeX Error: \keyword undefined

Classicthesis, Bachelor and Master thesis, PhD, Doctoral degree
BraveRoger
Posts: 4
Joined: Mon Jul 18, 2016 11:54 am

LaTeX Error: \keyword undefined

Postby BraveRoger » Mon Jul 18, 2016 12:06 pm

So, the commands section in each of my chapter files looks like this:

Chapter 1:
  1. \newcommand{\keyword}[1]{\textbf{#1}}
  2. \newcommand{\tabhead}[1]{\textbf{#1}}
  3. \newcommand{\code}[1]{\texttt{#1}}
  4. \newcommand{\file}[1]{\texttt{\bfseries#1}}
  5. \newcommand{\option}[1]{\texttt{\itshape#1}}

Chapter 2:
  1. \renewcommand{\keyword}[2]{\textbf{#2}}
  2. \renewcommand{\tabhead}[2]{\textbf{#2}}
  3. \renewcommand{\code}[2]{\texttt{#2}}
  4. \renewcommand{\file}[2]{\texttt{\bfseries#2}}
  5. \renewcommand{\option}[2]{\texttt{\itshape#2}}

Chapter 3:
  1. \renewcommand{\keyword}[3]{\textbf{#3}}
  2. \renewcommand{\tabhead}[3]{\textbf{#3}}
  3. \renewcommand{\code}[3]{\texttt{#3}}
  4. \renewcommand{\file}[3]{\texttt{\bfseries#3}}
  5. \renewcommand{\option}[3]{\texttt{\itshape#3}}

Problem is, when I run the main.tex file, I get this error:
  1. --------------------------------------------------------
  2. ! LaTeX Error: \keyword undefined.
  3.  
  4. See the LaTeX manual or LaTeX Companion for explanation.
  5. Type H <return> for immediate help.
  6. ...
  7.  
  8. l.10 \renewcommand{\keyword}
  9. [3]{\textbf{#3}}
  10. --------------------------------------------------------

Any clues on what might be causing this? Any help is deeply appreciated.

Cheers

Tags:

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

Postby Johannes_B » Mon Jul 18, 2016 12:11 pm

I have a question: Why?

You can easily remove the blocks from every chapter file.

Also, i strongly advice you to read an introduction.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

BraveRoger
Posts: 4
Joined: Mon Jul 18, 2016 11:54 am

Postby BraveRoger » Mon Jul 18, 2016 12:23 pm

Well, this configuration came with with Vel's Masters/Doctoral Thesis template. I figured it had something to do with chapter/figure/table numbering. Plus it worked fine while I was writing my thesis, until the error kind of came out of nowhere.
My problem right now is that Chapter3's numbering just continues from Chapter2, i.e., Figure 2.28 and so on.

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

Postby Johannes_B » Mon Jul 18, 2016 12:42 pm

The blocks shown are only useful for the example chapter. I highly doubt, that you need them as you don't know what they do.
Your numbering problem has a different cause, please show us a minimal working example for us to reproduce your issue.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

BraveRoger
Posts: 4
Joined: Mon Jul 18, 2016 11:54 am

Postby BraveRoger » Mon Jul 18, 2016 1:31 pm

Well, I didn't have time to read a tutorial, so I just used this workaround:
On the main.tex file, I typed this:
  1. \mainmatter % Begin numeric (1,2,3...) page numbering
  2.  
  3. \pagestyle{thesis} % Return the page headers back to the "thesis" style
  4.  
  5. \include{Chapters/Chapter1}
  6. \include{Chapters/Chapter2}
  7.  
  8. \mainmatter
  9.  
  10. \include{Chapters/Chapter3}


This was to reset the numbering starting on Chapter 3. Next, I typed the following on Chapter3.tex:
  1. \setcounter{chapter}{2}
  2. \chapter{Chapter3}
  3. \label{}

I don't understand why it only works with the number "2", but I got what I wanted.

Thanks for your help on isolating the problem. I really appreciate it.

Cheers!

EDIT: I just realized the page numbering restarted on chapter 3...
Double EDIT: I typed \setcounter{page}{x} on the beginning of Chapter 3 to set page numbering manually

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

Postby Stefan Kottwitz » Mon Jul 18, 2016 2:06 pm

BraveRoger wrote:Well, I didn't have time to read a tutorial, so I just used this workaround


Writing a thesis but not having time to read something? I would expect some more effort for a scientific work. I would take the time to sharpen a pencil to get a better drawing...

BraveRoger wrote:I don't understand why it only works with the number "2", but I got what I wanted.


That's because you set the number of the previous chapter. Then, chapter 3 comes, which increases the chapter number by itself.

BraveRoger wrote:I just realized the page numbering restarted on chapter 3...


That's also because of your workaround. Remove that \mainmatter before chapter 3.

BraveRoger wrote:I typed \setcounter{page}{x} on the beginning of Chapter 3 to set page numbering manually


Such manual settings may cause problems later - you will have to verify later if that page number is still the correct one.

Perhaps let's fix the actual problem and not the problems introduced by workarounds.

Stefan
Site admin

BraveRoger
Posts: 4
Joined: Mon Jul 18, 2016 11:54 am

Postby BraveRoger » Mon Jul 18, 2016 2:24 pm

Thanks for your help Stefan. You too Johannes.

Cheers!


Return to “Theses, Books, Title pages”

Who is online

Users browsing this forum: No registered users and 1 guest