Page Layout ⇒ Instead of invoking \clearpage, how to update \thepage soon?
Instead of invoking \clearpage, how to update \thepage soon?
Dear all,
I want to invoke \thepage in any pages. Unfortunately, sometimes the printed page number is out of sync with the \thepage.
Actually we can flush the buffer by calling \clearpage, but this way will sacrifice the benefit of latex auto paging.
Is there any other method to update the counter page wherever I want it?
Thank you in advance.
Yuko
I want to invoke \thepage in any pages. Unfortunately, sometimes the printed page number is out of sync with the \thepage.
Actually we can flush the buffer by calling \clearpage, but this way will sacrifice the benefit of latex auto paging.
Is there any other method to update the counter page wherever I want it?
Thank you in advance.
Yuko
NEW: TikZ book now 40% off at Amazon.com for a short time.
Re: Instead of invoking \clearpage, how to update \thepage s
out of sync how? minimal example please
Instead of invoking \clearpage, how to update \thepage soon?
Code: Select all
\documentclass[a4paper,twoside,11pt,final]{book}
\usepackage[margin=3cm]{geometry}
\usepackage{lipsum,multido}
\newcommand{\tablefactory}
{
\begin{table}
\centering
\begin{tabular}{|c|}\hline
\Huge\thepage \\\hline
\end{tabular}
\caption{Compare it with the page number. Sometimes they are out of sync.}
\end{table}
}
\begin{document}
\multido{\i=1+1}{20}{
\tablefactory
\lipsum[1]
\tablefactory
}
\end{document}
Instead of invoking \clearpage, how to update \thepage soon?
Hi,
I've explained a typical workaround for this in some other threads. The idea is to use the \label, \pageref mechanism:
I've explained a typical workaround for this in some other threads. The idea is to use the \label, \pageref mechanism:
Code: Select all
\documentclass{article}
\usepackage[margin=3cm]{geometry}
\usepackage{lipsum,multido}
\newcounter{mycount}
\newcommand{\tablefactory}{%
\begin{table}
\stepcounter{mycount}
\label{tab:\themycount}
\centering
\begin{tabular}{|c|}\hline
\Huge\pageref{tab:\themycount} \\\hline
\end{tabular}
\caption{Compare it with the page number. It's OK now.}
\end{table}}
\begin{document}
\multido{\i=1+1}{20}{%
\tablefactory
\lipsum[1]
\tablefactory
}
\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Re: Instead of invoking \clearpage, how to update \thepage s
Thanks gmedina.
However calling \thepage is mandatory not only inside the table but also other places.
Yuko
However calling \thepage is mandatory not only inside the table but also other places.
Yuko
Instead of invoking \clearpage, how to update \thepage soon?
Can't you just apply a variation of my proposed solution?yoyoimut wrote:...However calling \thepage is mandatory not only inside the table but also other places...
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Instead of invoking \clearpage, how to update \thepage soon?
gmedina wrote:
Can't you just apply a variation of my proposed solution?
Because I don't need labeling so the \pageref is irrelevant in my situation.
Thank you.
Re: Instead of invoking \clearpage, how to update \thepage s
What is the need for \thepage inside the table anyways?
Instead of invoking \clearpage, how to update \thepage soon?
daleif wrote:What is the need for \thepage inside the table anyways?
for the sake of example.
Instead of invoking \clearpage, how to update \thepage soon?
You don't need it, but you might use it to solve your problem, so it doesn't seem to be irrelevant.yoyoimut wrote:...Because I don't need labeling so the \pageref is irrelevant in my situation...
1,1,2,3,5,8,13,21,34,55,89,144,233,...