I have a probem with the ifthen package. I use it with the fancyhdr package like this :
Code: Select all
\usepackage{nopageno}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\lhead{\ifthenelse{\thechapter > 0}{Expérience \thechapter}{}} \rhead{\thepage} \chead{}
The problem is that at the end of my document, I use an appendices environment and at this moment, latex sent me the error :
I imagine that this problem comes because at some points of my document, \thechapter is undefined but I don't know who to surpass this problem.! Missing number, treated as zero.
<to be read again>
>
l.x \begin{appendices}
I would really appreciate your help.
Regards,
Anthard_
My code :
Code: Select all
\documentclass[12pt,a4paper]{book}
\usepackage[french]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[margin=3cm]{geometry}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\everymath{\displaystyle\everymath{}}
\usepackage{graphicx}
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
\renewcommand{\baselinestretch}{1.2}
\usepackage{epsfig}
%%% Caption : %%%
\usepackage[margin=10pt,font=small,labelfont=bf,textfont=sl,labelsep=endash]{caption}
%%% Tableau : %%%
\setlength{\doublerulesep}{\arrayrulewidth}
%%% Chapitre : %%%
\addto\captionsfrench{\renewcommand\chaptername{Expérience}}
%%% Fancyhdr : %%%
\usepackage{nopageno}
\usepackage{fancyhdr}
\usepackage[Lenny]{sty/fncychap}
\pagestyle{fancy}
\fancyhf{}
\usepackage{ifthen}
\usepackage{calc}
\renewcommand{\headrulewidth}{0.4 pt}
\renewcommand{\footrulewidth}{0.4 pt}
\lhead{\ifthenelse{\thechapter > 0}{Expérience \thechapter}{}} \rhead{\thepage} \chead{}
%%% Appendices : %%%
\usepackage[toc,page]{appendix}
\begin{document}
\chapter{Expérience 1}
\chapter{Expérience 2}
\chapter{Expérience 3}
\begin{appendices}
\section{App1}
\section{App2}
\end{appendices}
\end{document}