I'm making a document with LaTeX and I wish to add a lateral index to each page with the first letters of the first and last words.

I implemented the solution given in this answer with the everyshi to reset a counter at the beginning of each page.

However, I still have a problem. My counter is not resetted axactly at the beginning of the page but a bit after. See bellow (The counter is printed at the beginning of the line) :

enter image description here

I'm using a multicols environnement from the multicol package and if I have this problem, it's certainly due to the columns balancing.

Is there a way to solve this problem ?

Is there a way to execute a command or reset a counter exactly at the beginning of a page inside a multicol environnement ?

closed as unclear what you're asking by Ruben, Zarko, Kurt, Werner, Au101 Jan 18 '17 at 20:25

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • it is hard to see exactly what you are trying to do here but page referees should always by via \pageref or the \mark system used to set page head and foot, then they are automatically synchronised with the page builder. – David Carlisle Jan 17 '17 at 23:00
  • 2
    the answer to the first question is yes, the answer to the second is no. with or without multicol, consider a long paragraph that might span more than a page all macros in the paragraph are executed before the paragraph is broken into lines, and a long time before those lines are split into pages, so the page counter has the same value even if the paragraph spans 5 pages. – David Carlisle Jan 17 '17 at 23:02
  • In the original question you are reffering to you did not mention that you need to reset a counter. And like in the other question you did not provide neither a full example, neither a full description of what you are trying to achieve. Rather than opening multiple questions that are virtually the same you should consider to have one proper question. You are more likely to get a proper solution by doing so. – Ruben Jan 18 '17 at 0:07
  • ...not that the additional information would affect the other solution. The problem persists in any scenario and regarding the problem: @David's comment explains it very well. The above comment was just a general notion. – Ruben Jan 18 '17 at 0:10
  • 1
    please fix your question to have a small document that shows a problem, as it is all we have is an image and the numbers 51,52,53,1,2,3 with no indication of what they are just a comment that some of them are wrong. The question is not answerable in this form. – David Carlisle Jan 18 '17 at 8:03