1

I'm writing a (kind of) book, with several chapters. Maybe it's not the right choice, but I'm using the subfile package to create a main.tex file and a "custom style" using the mystyle package. I've trouble with the page number behavior. What I want is: TOC and introduction sections without any header nor page numbers, all the other chapters with "normal" page numbers. Here are my files:

main.tex:

\documentclass[12pt, openright, twoside, a4paper]{report}
\usepackage{subfiles}
\usepackage{mystyle} %/Users/.../texmf/tex/latex/misc/mystyle.sty
\setcounter{tocdepth}{3}

\begin{document}
\subfile{./titre}
\tableofcontents
\subfile{./Introduction}
\subfile{./Ch1}
\subfile{./Ch2}
\subfile{./Ch3}
... other chapters
\clearpage
\addcontentsline{toc}{chapter}{Références}
\end{document}

mystyle.sty:

\ProvidesPackage{mystyle}
\usepackage[margin=3.5cm]{geometry}
... some stuffs
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{\thechapter. \ #1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection. \ #1}{}}
\fancyhf{}
\fancyfoot[RO,LE]{\thepage}
\fancyhead[RO,LE]{{\bfseries \leftmark}\\\rightmark}
\renewcommand{\headrulewidth}{0.5pt}% filet en haut de page
\addtolength{\headheight}{0.5pt}    % espace pour le filet
\renewcommand{\footrulewidth}{0.5pt}  % filet en bas
...other stuffs
\endinput

and the introduction file:

\documentclass[./main.tex]{subfiles}
\begin{document}
\pagenumbering{gobble} % Remove page numbers (and reset to 1) (http://tex.stackexchange.com/questions/54333/no-page-numbering)
%\clearpage
\thispagestyle{empty}
\chapter*{Introduction} % Major section
... some text
\end{document}

And it doesn't work. Well, page headers and decorations are just fine, but page numbers appear nowhere! I really don't understand what happens here. I though that for each "call" of a ChX file, the style mystyle file was re-read. Is it the case? Any ideas? Thanks!

10
  • What happens if you remove the \pagenumbering{gobble} % Remove page numbers (and reset to 1)? Mar 6 '17 at 18:47
  • Please don't write ...some stuffs in the package code ... it is not compilable and requires us to remove it
    – user31729
    Mar 6 '17 at 18:49
  • @Ulrike Fisher If I do that, page number appear everywhere
    – ariel67
    Mar 6 '17 at 19:02
  • 1
    @ Christian Hupfer Sorry... I'll remember for the next time
    – ariel67
    Mar 6 '17 at 19:03
  • So you know now why they disappear. Try out \pagenumbering{arabic} at the point where they should appear (this will reset the number to 1, if you don't want this, you should redefine only \thepage, or define a special page style). Mar 6 '17 at 19:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.