0

I want to suppress the page number on a specific page (not the title page) that has a box defined with mdframed, and then be able to refer to the suppressed page number. There is text on this page that is boxed (with mdframed) and I don't want this text to run into the pagenumber. The page numbers on subsequent pages would thus be as follows: 1, [suppressed], 3, ...

I would like to then write "as discussed in Box 1 (p. 2)". Unfortunately, if I put "\thispagestyle{empty}" anywhere within the mdframed, it suppresses the page number of the previous page instead (see MWE). If I put "\thispagestyle{empty}" just after the mdframed, it suppresses the page number of the next page instead. How can I suppress the page number of the page with the mdframed, to avoid the frame from colliding with the page number (and then refer to the suppressed page number with \pageref)?

MWE:

\documentclass{article} 
\usepackage{lipsum}
\usepackage[framemethod=TikZ]{mdframed}
\newenvironment{Frame}[1][]{%
    \begin{mdframed}[%
        frametitle={#1},
        skipabove=\baselineskip plus 2pt minus 1pt,
        skipbelow=\baselineskip plus 2pt minus 1pt,
        linewidth=0.5pt,
        frametitlerule=true,
        frametitlebackgroundcolor=gray!30
    ]%
}{%
    \end{mdframed}
}

\begin{document} 
Refer to box~1 (p.~\pageref{Box:TheBox}).
\begin{mdframed}[style=MyFrame,nobreak=true,align=center,userdefinedwidth=0.9\textwidth]{
\label{Box:TheBox}
\thispagestyle{empty}
\lipsum[1-5]
}
\end{mdframed}
\end{document}
4
  • use \thispagestye{empty} and then \label and\pageref as usual Commented Oct 16, 2023 at 20:15
  • @DavidCarlisle Hmm, wherever on my page (in the mdframe) I put \thispagestyle{empty}, it suppresses the page number of the previous page instead of the current page.
    – Pertinax
    Commented Oct 16, 2023 at 20:42
  • Well as you have provided no example . mdframe is old and somewhat unsupported but I would guess if you made an example someone would help. (but then your question is really all about mdframed, as \thispagestyle{empty} is the answer to the question as it appears in the title.. Commented Oct 16, 2023 at 20:48
  • @DavidCarlisle Thank you, I have edited the question to reflect your comment.
    – Pertinax
    Commented Oct 16, 2023 at 21:04

0

You must log in to answer this question.

Browse other questions tagged .