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!

ariel67
  • 23
  • What happens if you remove the \pagenumbering{gobble} % Remove page numbers (and reset to 1)? – Ulrike Fischer Mar 06 '17 at 18:47
  • Please don't write ...some stuffs in the package code ... it is not compilable and requires us to remove it –  Mar 06 '17 at 18:49
  • @Ulrike Fisher If I do that, page number appear everywhere – ariel67 Mar 06 '17 at 19:02
  • 1
    @ Christian Hupfer Sorry... I'll remember for the next time – ariel67 Mar 06 '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). – Ulrike Fischer Mar 06 '17 at 19:12
  • It doesn't work. I obtain again a page number on the introduction page. :( – ariel67 Mar 06 '17 at 20:24
  • Uncomment the \pagenumbering{gobble} as well ... That makes them disappear. Then \pagenumbering{arabic} to make them appear ... – cfr Mar 07 '17 at 02:20
  • @cfr The page number still appears on the TOC and the introduction page. What's wrong? – ariel67 Mar 07 '17 at 06:55
  • If \pagenumbering{gobble} makes then disappear, they can't reappear before \pagenumbering{arabic}. Are you sure you put these commands in just the right places? – cfr Mar 07 '17 at 17:32
  • Thanks to you all. Finally, I've redefined the plain style in the mystyle file, inserting a \fancyhf{} command, and it works. Maybe not the really right way to do, but I'm definitevely not a purist. Thanks for helping! – ariel67 Mar 08 '17 at 06:57

0 Answers0