Theses, Books, Title pagesLaTeX Error: \keyword undefined

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

LaTeX Error: \keyword undefined

Post by BraveRoger »

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

Chapter 1:

Code: Select all

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

Code: Select all

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

Code: Select all

\renewcommand{\keyword}[3]{\textbf{#3}}
\renewcommand{\tabhead}[3]{\textbf{#3}}
\renewcommand{\code}[3]{\texttt{#3}}
\renewcommand{\file}[3]{\texttt{\bfseries#3}}
\renewcommand{\option}[3]{\texttt{\itshape#3}}
Problem is, when I run the main.tex file, I get this error:

Code: Select all

--------------------------------------------------------
! LaTeX Error: \keyword undefined.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.10 \renewcommand{\keyword}
                            [3]{\textbf{#3}}
--------------------------------------------------------
Any clues on what might be causing this? Any help is deeply appreciated.

Cheers

Recommended reading 2024:

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

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

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

Re: \keyword undefined

Post by Johannes_B »

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

LaTeX Error: \keyword undefined

Post by BraveRoger »

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

LaTeX Error: \keyword undefined

Post by Johannes_B »

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

LaTeX Error: \keyword undefined

Post by BraveRoger »

Well, I didn't have time to read a tutorial, so I just used this workaround:
On the main.tex file, I typed this:

Code: Select all

\mainmatter % Begin numeric (1,2,3...) page numbering

\pagestyle{thesis} % Return the page headers back to the "thesis" style

\include{Chapters/Chapter1}
\include{Chapters/Chapter2} 

\mainmatter

\include{Chapters/Chapter3}
This was to reset the numbering starting on Chapter 3. Next, I typed the following on Chapter3.tex:

Code: Select all

\setcounter{chapter}{2}
\chapter{Chapter3}
\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: 10324
Joined: Mon Mar 10, 2008 9:44 pm

LaTeX Error: \keyword undefined

Post by Stefan Kottwitz »

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
LaTeX.org admin
BraveRoger
Posts: 4
Joined: Mon Jul 18, 2016 11:54 am

Re: \keyword undefined

Post by BraveRoger »

Thanks for your help Stefan. You too Johannes.

Cheers!
Post Reply