0
\documentclass[11pt,twoside]{book}
\input{Brillpreamble}
\begin{document}
\frontmatter
\include{titleBrill}
\include{abbrevBrill}
\include{prefaceandintroBrill}
\mainmatter
\input{./title1.tex}
\include{text1}
\input{./title2.tex}
\include{text2}
\backmatter
\printindex[nominum]
\printindex[rerum]
\pagestyle{myheadings}
\include{Biblio}
\end{document}

this is my preambleBrill code:

% XeLaTeX can use any Mac OS X font. See the setromanfont command below.
% Input to XeLaTeX is full Unicode, so Unicode characters can be typed directly into the source.

% The next lines tell TeXShop to typeset with xelatex, and to open and save the source with Unicode encoding.

%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode

\usepackage{booktabs}
\usepackage{ledmac}
\linenummargin{inner}
\sidenotemargin{outer}
\usepackage{fancyhdr}
\usepackage{adforn}
\usepackage{amsmath}
\usepackage{lmodern}
\pagestyle{myheadings}
\usepackage{hanging}
\usepackage{pdfpages}
\textheight = 180.5 mm
\textwidth = 108.5 mm
\pagenumbering{arabic}
\usepackage[hang]{footmisc}
\setlength{\footnotemargin}{12pt}
\makeatletter
\renewcommand\@makefntext[1]{%
  \noindent\makebox[1em][r]{\@makefnmark}#1}
\makeatother
\usepackage{imakeidx} 
\makeindex[name=nominum, title=Index nominum, columns=2]
\makeindex[name=rerum, title=Index rerum, columns=2]
\pretolerance=100
\usepackage{microtype}
\makeatletter
% And in the paragraphed footnotes, I'd like no colon too:
\def\parafootfmt#1#2#3{%
  \normal@pars
  \parindent=0pt \parfillskip=0pt plus 1fil
  {\bf\printlines#1|}%
  {\select@lemmafont#1|#2}~%
  #3\penalty-10 }
\makeatother
\let\Afootfmt\parafootfmt

%\newcommand{\rhet}[2]{\edtext{#1}{\Afootnote{#2}}}
\newcommand{\rhet}[2]{\edtext{ #1}{\Afootnote{] #2}}}
\newcommand{\oed}[2]{\edtext{ #1}{\Bfootnote{] #2}}}
\footparagraph{A}
\footparagraph{B}

%%%%%%%%%%%%%%%%
\raggedbottom


\newcommand*{\LeftWidth}{3.0cm}%
\newcommand*{\RightWidth}{\dimexpr\linewidth-\LeftWidth-2em\relax}%
\newcommand{\AlignedBrace}[2]{%
    \medskip\par\noindent%
    \parbox{\LeftWidth}{\raggedleft\textbf{#1}\strut~}%
    $\left\{~\parbox{\RightWidth}{\strut\textit{#2}\strut}\right.$%
}%


%\usepackage{geometry}                % See geometry.pdf to learn the layout options. There are lots.
%\geometry{a4paper}                   % ... or a4paper or a5paper or ... 
%\geometry{landscape}                % Activate for for rotated page geometry
%\usepackage[parfill]{parskip}    % Activate to begin paragraphs with an empty line rather than an indent
\usepackage{graphicx}

\usepackage{amssymb}
%\renewcommand %These two commands are for double-spacing
%\baselinestretch{2}

% Will Robertson's fontspec.sty can be used to simplify font choices.
% To experiment, open /Applications/Font Book to examine the fonts provided on Mac OS X,
% and change "Hoefler Text" to any of these choices.

\usepackage{fontspec,xltxtra,xunicode}
\defaultfontfeatures{Mapping=tex-text}
\setromanfont[Mapping=tex-text]{Brill}
\setsansfont[Scale=MatchLowercase,Mapping=tex-text]{Gill Sans}
\setmonofont[Scale=MatchLowercase]{Andale Mono}
\frenchspacing

\newfontfamily{\H}[Scale=0.9]{Lucida Grande}
\usepackage{caption}
\captionsetup{aboveskip=5pt}

\def\changemargin#1#2{\list{}{\rightmargin#2\leftmargin#1}\item[]}
\let\endchangemargin=\endlist
Johannes_B
  • 24,235
  • 10
  • 93
  • 248
Guillaume Coatalen
  • 491
  • 1
  • 4
  • 11
  • 1
    And what's behind titleBrill? And in abbrevBrill? What are you doing there? How should we guess what we could do? I suppose some \maketitle in there, but ... it's a guess –  Jul 29 '15 at 17:54
  • 2
    The titlepage environment isn't doing a lot. Checks for one/twocolumn, sets the pagestyle to empty and sets the pagenumber. Just don't use it and you will be fine (keep \thispagestyle{empty} though). On the other hand, KOMA-classes have that thing which is a leftover of an almost 30 years old bug. – Johannes_B Jul 29 '15 at 17:57
  • @Johannes_B: On the other hand, no one is forced to use \maketitle or the titlepage environment ;-) –  Jul 29 '15 at 18:00
  • @ChristianHupfer The whole point of my comment. Looking at it again, it misses a don't which makes it sound like KOMA has the compat-feature. I am very in favour of not using \maketitle. It is probably one of the most missleading commands a starter can encounter. – Johannes_B Jul 29 '15 at 18:07
  • @Johannes_B: I understood it basically that way, however, my language was wrong. I wanted to emphasize your statement, but reading it again, it's sound like objection ;-) –  Jul 29 '15 at 18:10
  • so what do you suggest I do? I'd like to keep the same pagination in the mainmatter. – Guillaume Coatalen Jul 29 '15 at 19:10
  • 1
    @GuillaumeCoatalen: We can't suggest anything as long we do not know what you have written actually. Code in \include{...} is invisible to us –  Jul 29 '15 at 19:55
  • @ChristianHupfer I've added the preamble, but the rest is awfully long, this is a 300 page long book. – Guillaume Coatalen Jul 29 '15 at 20:05
  • this is my "titleBrill" file: \title{Two treatises} \author{Guillaume Coatalen} \date{} \maketitle – Guillaume Coatalen Jul 29 '15 at 20:11
  • 1
    Read How to customize my titlepage? and create them on your own. Don't use titlepage though, as this will lead to the described behaviour. – Johannes_B Jul 29 '15 at 20:14
  • thanks, but what about the pagination? Could I keep the same one in the mainmatter? – Guillaume Coatalen Jul 29 '15 at 20:21
  • Yes. Just don't change it. You don't have to use \frontmatter or \mainmatter at all. This is off-topic but your preamble is a mess. Why are you loading lmodern? Or fancyhdr? It is better not to use single character names for custom commands. It would also be better to use geometry to specify the page layout dimensions rather than doing it manually. – cfr Jul 29 '15 at 21:08
  • I thought I needed fancyhdr for headers notably in the indexes. – Guillaume Coatalen Jul 29 '15 at 21:30
  • and \frontmatter for Latin numerals. – Guillaume Coatalen Jul 29 '15 at 21:42
  • @cfr, better use whatever mechanism your format uses to select a standard page layout. The layouts in use are the result of centuries of experience, you shouldn't go against handed down wisdom without solid reasons. – vonbrand Jul 30 '15 at 00:18
  • @vonbrand I was talking about the best way to change them given that they are being changed. Whether they should be changed and, if so, what they should be changed to is surely a different question. But, actually, I doubt very much that the formats in use by LaTeX for standard paper sizes are the result of 'centuries of experience'. Were they really using A4 or US letter paper in the 1500s? I might be mistaken, but it seems rather unlikely. In fact, the standard classes do not layout pages according to such conventions - see the manuals for KOMA and memoir for complaints about this! – cfr Jul 30 '15 at 00:47
  • In the meantime, this same question was introduced in http://latex-community.org/forum/viewtopic.php?f=47&t=26520&p=90831#p90831 – Johannes_B Jul 30 '15 at 20:01
  • for which I still haven't got an answer. – Guillaume Coatalen Jul 30 '15 at 21:27
  • 1
    You've still not provided a Minimum Working Example (MWE) either. – cfr Jan 09 '16 at 21:39

2 Answers2

5

The problem with \maketitle is, that it is a command that disables itself after being called by using \global\let\maketitle\relax (the same is true for \title, \author etc.

This can be disabled either be redefining \maketitle or using \xpatch and removing the relevant code.

This will prevent the restart of the pagenumbering anyway.

The next culprit is that book uses titlepage implicitly. If this option is used, the maketitle uses \begin{titlepage}...\end{titlepage} which will automatically reset the page number.

I provide the notitlepage version here for the moment and try to get the titlepage beast later on.

\documentclass[notitlepage]{book}



\usepackage{xpatch}

\newcounter{titlescntr}

\makeatletter

\xpatchcmd{\maketitle}{\par
}{%
  \par%
  \stepcounter{titlescntr}
  \ifnum\value{titlescntr} > 0 
  \cleardoublepage
  \fi
}{}{}

\xpatchcmd{\maketitle}{%
  \global\let\thanks\relax
  \global\let\maketitle\relax
  \global\let\@maketitle\relax
  \global\let\@thanks\@empty
  \global\let\@author\@empty
  \global\let\@date\@empty
  \global\let\@title\@empty
  \global\let\title\relax
  \global\let\author\relax
  \global\let\date\relax
  \global\let\and\relax
}{%
  \clearpage
}{\typeout{Patched!}}{\typeout{Patching failed!}}

\makeatother

\title{Two treatises} 
\author{Guillaume Coatalen} 
\date{} 

\usepackage{blindtext}

\begin{document}

\maketitle 

\title{Theory of Brontosaurs}
\author{Ann Elk}
\maketitle

\blindtext


\end{document}

Updated: Removing the resetting of the page number if titlepage is used

\documentclass[titlepage]{book}
\usepackage{xpatch}
\newcounter{titlescntr}

\makeatletter

\if@titlepage
\xpatchcmd{\maketitle}{%
  \global\let\thanks\relax
  \global\let\maketitle\relax
  \global\let\@thanks\@empty
  \global\let\@author\@empty
  \global\let\@date\@empty
  \global\let\@title\@empty
  \global\let\title\relax
  \global\let\author\relax
  \global\let\date\relax
  \global\let\and\relax
}{%
}{\typeout{patched maketitle for titlepage}}{}

\xpatchcmd{\titlepage}{%
  \setcounter{page}\@ne
}{%
}{\typeout{patched titlepage}}{}

\xpatchcmd{\endtitlepage}{%
  \setcounter{page}\@ne
}{%
}{\typeout{patched endtitlepage}}{}

\else

\xpatchcmd{\maketitle}{\par
}{%
  \par% 
  \stepcounter{titlescntr}
  \ifnum\value{titlescntr} > 0 % Make a new page for the next title
  \cleardoublepage
  \fi
}{}{}

\xpatchcmd{\maketitle}{%
  \global\let\thanks\relax
  \global\let\maketitle\relax
  \global\let\@maketitle\relax
  \global\let\@thanks\@empty
  \global\let\@author\@empty
  \global\let\@date\@empty
  \global\let\@title\@empty
  \global\let\title\relax
  \global\let\author\relax
  \global\let\date\relax
  \global\let\and\relax
}{%
  \clearpage
}{\typeout{Patched!}}{\typeout{Patching failed!}}
\fi

\makeatother

\title{Two treatises} 
\author{Guillaume Coatalen} 
\date{} 

\usepackage{blindtext}

\begin{document}

\maketitle 

\title{Theory of Brontosaurs}
\author{Ann Elk}
\maketitle

\blindtext


\end{document}
5

I'm lazy. If somebody else has already done the work and I can use theirs, I figure there's no need for me to spend time poring over different designs for the newfangled invention they call a 'wheel'.


I would use etoolbox to patch the titlepage environment which book uses for titles by default, and let titling do the rest.

\usepackage{etoolbox,titling}
\makeatletter
\patchcmd{\titlepage}{\setcounter{page}\@ne}{}{\message {Successfully patched titlepage.}}{\message {Failed to patch titlepage.}}
\makeatother

The patch simply stops the use of titlepage by \maketitle from restarting the numbering scheme. However, we'll still get numbering from 1 when we first switch to Arabic numerals in the main matter because \mainmatter takes care of that automatically.

Loading titling allows us to use the regular \title, \author, \date, \maketitle commands as many times as we like in the document.

\title{Title 1}
\author{Author 1}
\date{Date 1}
\maketitle

\title{Title 2}
\author{Author 2}
\date{Date 2}
\maketitle

[I'm not against the use of \maketitle although it can, obviously, have unwanted effects when misunderstood and is, perhaps, unfortunately named. In any case, since it is easy to use and keeps my code here simple, I would see no reason to look a gift horse in the mouth, even if I had general doubts about the horse's value in other contexts.]

Because you are already using \frontmatter and \mainmatter, there's no need to worry about setting the kind of page numbering as the book class uses lower-case Roman numerals for the front matter and Arabic numerals for the main matter by default.

\frontmatter

switches to lower-case Roman numerals, starting from 1.

\mainmatter

then switches to Arabic numerals, restarting the count from 1.

two title pages, lower-case Roman and continuous Arabic numbering

Complete code:

\documentclass[11pt]{book}
\usepackage{etoolbox,titling}
\makeatletter
\patchcmd{\titlepage}{\setcounter{page}\@ne}{}{\message {Successfully patched titlepage.}}{\message {Failed to patch titlepage.}}
\makeatother
\pagestyle{myheadings}
\usepackage{kantlipsum}
\begin{document}
\frontmatter
\kant[1-5]
\mainmatter
\title{Title 1}
\author{Author 1}
\date{Date 1}
\maketitle
\kant[6-10]
\title{Title 2}
\author{Author 2}
\date{Date 2}
\maketitle
\kant[11-15]
\backmatter
\kant[16-20]
\end{document}
cfr
  • 198,882