Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

A lot of buildings have no 13th floor, some planes have no 13th row etc.

How do I set up a document that automatically suppresses page 13, figure 13, chapter 13 and so on, say, by jumping the counter. Bonus points if it does not break the odd/even page constructions of the book class.

share|improve this question
4  
how about simply not printing the page number on p.13? of course, that wouldn't be too helpful if you happen to have a cross reference by page number that fell on that page. "12a" has been suggested, and "12^\prime" might also be considered. if you omit two page numbers (13 and 14, to keep the expected spread) i predict that a publisher of such a book might get complaints from buyers that their copy is faulty, and ask for their money back. –  barbara beeton Dec 19 '12 at 13:27
4  
+1 for the triskaidephobia tag, that unfortunately might not survive automatic purges of single-use tags. –  gerrit Dec 19 '12 at 14:18
3  
What about next years date? I guess triskaidekaphobics will stay home for the year? –  Yiannis Lazarides Dec 19 '12 at 19:31
1  
@barbarabeeton I fully agree with everything you said. I tried to look into the books about triskaidekaphobia on amazon to see how they do that, but alas, amazon did not show page 13 for me. –  mafp Dec 19 '12 at 20:45
1  
@YiannisLazarides Next year is 2013, not 13, that is perhaps a difference for the triskaidekaphobics. –  mafp Dec 19 '12 at 20:46

3 Answers 3

up vote 37 down vote accepted

The following example redefines \@arabic to change the behaviour of \arabic. If the number is 13 or larger, the increased number is printed instead:

1, 2, ... 11, 12, 14, 15, ...

The oddness test of \cleardoublepage is based on the counter value, that is not changed by the redefined \@arabic.

Example file:

\documentclass{book}

\makeatletter
\renewcommand*{\@arabic}[1]{%
  \ifnum#1<13
    \the\numexpr(#1)\relax
  \else
    \the\numexpr(#1)+1\relax
  \fi
}
\makeatother

\begin{document}
\chapter{First chapter}
\addtocounter{chapter}{10}
\newpage\null
\newpage\null
\newpage\null
\newpage\null
\newpage\null
\newpage\null
\newpage\null
\newpage\null
\newpage\null
\chapter{Chapter before 13}
\chapter{Chapter after 13}
\end{document}

An alternative is using 12a instead of 13 to avoid messing up the oddness too much:

\makeatletter
\renewcommand*{\@arabic}[1]{%
  \ifnum#1=13 %
    12a%
  \else
    \the\numexpr(#1)\relax
  \fi
}
\makeatother
share|improve this answer
1  
yes but I think you do want to bump twice in the case of {page} so that the (printed) odd page on the right is preserved. (I didn't notice until after I posted my answer the OP wanted all counters to skip 13, I'd have done it on stepcounter but arabic is an interesting alternative (presumably people who can read roman numerals are not superstitious:-) –  David Carlisle Dec 19 '12 at 12:43
2  
@DavidCarlisle Bumping twice means also skipping 14? An alternative would be 12a instead of 13. –  Heiko Oberdiek Dec 19 '12 at 12:57
1  
skipping 14 is what I did, not sure what the OP needs. Of course an alternative would be to not increment at all, and just not print 13 perhaps printing ☠ instead. –  David Carlisle Dec 19 '12 at 13:31
    
@DavidCarlisle I did not think too much about it, it was really a fun question. But I think barbara beeton is right that skipping 13 and 14 might be too much for any serious application. Printing 12a or ☠ is actually a neat idea, too. –  mafp Dec 19 '12 at 20:33
    
nice example of working with counters! –  Uwe Ziegenhagen Dec 25 '12 at 19:54
[1{/usr/local/texlive/2012/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
[2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [15] [16] [17] [18] (./bk.aux) )
                                             ^^^^^

\documentclass[twoside]{book}

\makeatletter
\let\saved@oddhead\@oddhead
\def\@oddhead{%
\ifnum\c@page=\active
\global\advance\c@page\@ne
\if@twoside
\global\advance\c@page\@ne
\fi
\fi
\saved@oddhead}
\makeatletter

\begin{document}

abc\clearpage
abc\clearpage
abc\clearpage
abc\clearpage
abc\clearpage
abc\clearpage
abc\clearpage
abc\clearpage
abc\clearpage
abc\clearpage
abc\clearpage
abc\clearpage
abc\clearpage
abc\clearpage
abc\clearpage
abc\clearpage

\end{document}
share|improve this answer
11  
\ifnum\c@page=\active is wonderful. :) –  egreg Dec 19 '12 at 12:36
    
But, in two page mode that also suppressed Page 14? –  Peter Grill Dec 19 '12 at 12:36
    
Yes it went to some effort to do that. I think you want to preserve that in a two page spread the page on the right is odd, so in [oneside] it skips 13 but in [twoside] it skips 14 as well otherwise all following spreads are out of sync –  David Carlisle Dec 19 '12 at 12:46
    
Missing 14 as well solves the problem with chinese phobias:) –  Yiannis Lazarides Dec 19 '12 at 19:34
2  
\@oddhead is executed on every page to insert the heading (every other page for two side documents). It is executed in the output routine where the page number is reliably known, If the page number is 13 it adds 1 (or 2 depending on \f@twoside) so by the time the original page head is set (\saved@odhead) the page number will not be 13. –  David Carlisle Dec 26 '12 at 2:10

You may try this, but everything using counters will be affected.

\documentclass{article}
\makeatletter
\def\addtocounter#1#2{\@ifundefined {c@#1}{\@nocounterr {#1}}{\global
    \advance \csname c@#1\endcsname #2\relax \expandafter\ifnum\csname
    c@#1\endcsname=13 \global\advance \csname c@#1\endcsname\@ne}}
\makeatother
\begin{document}
1\clearpage
2\clearpage
3\clearpage
4\clearpage
5\clearpage
6\clearpage
7\clearpage
8\clearpage
9\clearpage
10\clearpage
11\clearpage
12\clearpage
14\clearpage
15
\end{document}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.