In LyX, how can I make the pages numbers start from the second page? (i.e., making the first page, which is the table of contents in my case, not having a page number on it)
-
Welcome to TeX.SX! Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Accepting and upvoting is the preferred way here to say "thank you" to users who helped you. – e-birk Feb 26 '13 at 22:00
-
1What document class are you using? Do you have any contents before the ToC? What about the ToC length (only 1 page)? – Werner Feb 26 '13 at 23:58
1 Answers
Since LyX (up to recent version 2.0.x) only supports globally changing the pagestyle (in "Document > Setting... > Page Layout") using TeX code/ERT is a workaround.
If the first page should not be numbered then insert the TeX code/ERT
\thispagestyle{empty}
at the beginning of your document (before the table of contents(TOC)). This will clear the page number of that page (see also https://tex.stackexchange.com/a/44153).
(To suppress page numbers for the whole TOC \pagestyle{empty} before TOC and \pagestyle{plain} after TOC can be used. Note that the last \pagestyle command on a page will take precedence over all \pagestyle commands on that page. Depending on your case another \thispagestyle{empty} after \pagestyle{plain} might be used.)
If the page numbers should be reset at some point, you can add the TeX code
\setcounter{page}{1}
on a (new) page / after a page break.
-
Is this also valid if you have contents (whatever... perhaps a dedication page) before the ToC? And what if the ToC spans more than one page? Then
\pagestyle{plain}will make the entire ToC be void of page numbers. The OP only wants the first ToC page to be without a page number. – Werner Feb 26 '13 at 22:30 -
@Werner Every page before
\pagestyle{empty}will have a page number. As far as I know, the last\pagestyleon a page will take precedence over all\pagestylecommands on that page. – e-birk Feb 26 '13 at 22:40 -
Yes, the last one will prevail. But since you're placing
\pagestyle{empty}before the ToC, that may fall on the last page before the ToC is set. – Werner Feb 26 '13 at 22:42 -
-
-
@Werner Thanks for your comments! The OP mentioned that the TOC is on the first page. In the situation when having text followed by TOC probably without page break instructions and where the page before the TOC should be numbered, one could insert
\thispagestyle{plain}at a suitable point (not just before\pagestyle{empty}but earlier to avoid it falling on the TOC page). Furthermore, if the first page were the beginning of a chapter - that is not the case here - one had to do more... – e-birk Feb 27 '13 at 12:06 -
The page number on the first page of the TOC was still visible in my case, so I had to use
\addtocontents{toc}{\protect\thispagestyle{empty}}besides\pagestyle{empty}– Raiyan Jan 13 '14 at 04:25