Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reseting the footnote counter with each page #1018

Open
mahmadzaid opened this issue Aug 8, 2020 · 8 comments
Open

Reseting the footnote counter with each page #1018

mahmadzaid opened this issue Aug 8, 2020 · 8 comments
Labels
bug Software bug issue documentation Documentation bug or improvement issue
Milestone

Comments

@mahmadzaid
Copy link

mahmadzaid commented Aug 8, 2020

Resetting the counter in newPage of a book class kind of works, but in some cases, the footnote counter is reset before late in the next new page, even though the footnote itself is in the right page; something like this:

2. Second footnote from the previous page.
1. First footnote in the current page.
2. Second footnote in the current page.

Is it possible to do some kind of rerun to fix the numbers? similar to what is done in tableofcontents.

EDIT: I previously got things mixed up, so I fixed this issue report.
MWE from @alerque below #1018 (comment)

@alerque
Copy link
Member

alerque commented Aug 8, 2020

Hmmm. This is probably an issue with pushBack(). It's possible that newPage() isn't the best place to do the reset. I'll look into this, but do you have an example as minimalist as possible that replicates the incorrect behavior?

@mahmadzaid
Copy link
Author

Unfortunately, I don't have a minimalist example, this was part of a book which I can't share excerpts from. I will try to find an example though.
Thanks for the help.

@alerque alerque added bug Software bug issue needs MWE Minimum working example needed for investigation documentation Documentation bug or improvement issue labels Aug 8, 2020
@simoncozens
Copy link
Member

If you can't narrow it down, load the debug package and disable pushback at the start of your document:

\script[src=packages/debug]
\disable-pushback

If that works, we know where the problem is.

@mahmadzaid
Copy link
Author

If you can't narrow it down, load the debug package and disable pushback at the start of your document:

\script[src=packages/debug]
\disable-pushback

If that works, we know where the problem is.

@simoncozens tried with your suggestion, sorry to report that it didn't work.

@alerque
Copy link
Member

alerque commented Aug 10, 2020

@IsaZ Don't be too sorry, in a round-about way that is actually good news. If the bug is not in pushBack() then it's much more likely to be an easy fix when we do find it.

@alerque
Copy link
Member

alerque commented Aug 12, 2020

I haven't replicated the issue you showed yet, but there is a related issue in the opposite direction that will take some fixing. When a line gets shaped but doesn't fit onto the page and gets postponed to the next page, it might already have the footnote counters in it. This makes sense and we have no way to backtrack the counter and re-fill the node content with new values before shaping on the new page. The problem looks something like this:

\begin[papersize=a6,class=book]{document}
\nofolios
\script[src=packages/lorem]
% \script[src=packages/debug]
% \disable-pushback
\define[command=foo]{\bar \bar \bar \bar \bar \bar \bar\par}
\define[command=bar]{\lorem[words=3]\footnote{\lorem[words=5]}}
\begin{script}
local _newPage = SILE.documentState.documentClass.newPage
SILE.documentState.documentClass.newPage = function (self)
  local ret = _newPage(self)
  SILE.call("set-counter", { id = "footnote", value = 1 })
  return ret
end
\end{script}
\foo
\foo
\foo
\foo
\foo
\end{document}

image

@alerque alerque added this to the v0.x.y milestone Dec 13, 2022
@mahmadzaid
Copy link
Author

I haven't replicated the issue you showed yet, but there is a related issue in the opposite direction that will take some fixing.

Coming back to this issue, I got it wrong, so I fixed the report above.

@alerque alerque removed the needs MWE Minimum working example needed for investigation label Jul 3, 2023
@alerque
Copy link
Member

alerque commented Jul 3, 2023

Thanks for the update. I'll put my thinking cap on again and see where we are at with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Software bug issue documentation Documentation bug or improvement issue
Projects
None yet
Development

No branches or pull requests

3 participants