0

When the documentclass is article, I can do \newtheorem*{example}{Example} so examples are not numbered. But when the documentclass is a book it show me error that says "Command * is already defined". Does anyone why it happens?

Also, is there any way so that the Example is not in italic?

The code:

\documentclass[12pt]{book}
\usepackage[spanish]{babel}
\usepackage[width=13cm, height=19cm, top=2cm, papersize={16.5cm,24cm}]{geometry}
\usepackage[pdftex]{graphicx}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{appendix}
\usepackage[titletoc]{appendix}
\usepackage{amssymb}
\usepackage{tipa}
%\usepackage{txfonts}
\usepackage{textcomp}
%\usepackage{amsthm}
%\usepackage{array}
%\usepackage{xy}
\usepackage{fancyhdr}

\newtheorem{example}{Example}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
\fancyhf{}
\fancyhead[LE,RO]{\bfseries\thepage}
\fancyhead[LO]{\bfseries\rightmark}
\fancyhead[RE]{\bfseries\leftmark}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0pt}
\addtolength{\headheight}{0.5pt}
\setlength{\footskip}{0in}
\renewcommand{\footruleskip}{0pt}
\fancypagestyle{plain}{%
\fancyhead{}
\renewcommand{\headrulewidth}{0pt}
}
%
\parindent 0in
%\parskip 0.05in
%
\begin{document}
Hello, there!
\end{document}
1

1 Answer 1

1

I do not think the book class is the issue, so without your code it's difficult to see what the issue is, but this might help:

\documentclass{book}
\usepackage{amsthm}
\theoremstyle{definition}
\newtheorem*{example}{Example}
\begin{document}
This is a test.
\begin{example}
This is an example.
\end{example}
\end{document}

enter image description here

3
  • Thanks, but that's what I've been trying. I wrote the code in the question.@Fintan
    – mug_donut
    May 12, 2020 at 22:21
  • Try uncommenting \usepackage{amsthm}. Also, you are calling the appendix package twice, which is tripping my machine, so you should remove the duplicate in case it causes issues for anyone else trying to compile your code.
    – Fintan
    May 12, 2020 at 22:27
  • Thanks it worked!
    – mug_donut
    May 12, 2020 at 22:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .