add tag
निरंजन
I have seen some questions around this on SE and many seem to mention that this is reliably only done when `\label` and `\ref` is used. I have some code that uses the hook `shipout/after`. Even if I use that, the results are not perfect. Why is this happening?

```
\documentclass{article}
\usepackage{microtype}
\usepackage{lipsum}

\begin{document}
\ExplSyntaxOn
\cs_new_protected:Npn \__tmp_save_page_number: {
  \hook_gput_next_code:nn { shipout / after } {
    \seq_gput_right:Ne \g_tmpa_seq { \thepage }
  }
}

\cs_gset_eq:NN \savepageno \__tmp_save_page_number:
\ExplSyntaxOff

\lipsum[1-1]

\lipsum[1-1]

\lipsum[1-1]

\lipsum[1-1]

foo, bar, foobaz, foo, bar, foobaz, foo, bar, foobaz, foo,
bar, foobaz, foo, bar, foobaz, foo, bar, foobaz, foo, bar,
foobaz, foo, bar, foobaz, foo, bar, foobaz, \textit{foo},
\savepageno\ \textit{bar},\savepageno\ foobaz, foo, bar,
foobaz, foo, bar, foobaz

\lipsum[1-1]

\ExplSyntaxOn
\seq_use:Nn \g_tmpa_seq { \par }
\ExplSyntaxOff
\end{document}
```

Is there _really_ no way to do it without using labels and relying on another run?

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.