maieul / ledmac

package reledmac for latex
http://www.ctan.org/tex-archive/macros/latex/contrib/reledmac
54 stars 28 forks source link

footnoteXmark, footnoteXtext, and hyperref #954

Closed ajmisra closed 1 year ago

ajmisra commented 1 year ago

Version

reledmac dev branch: hyperrer_pb

TeX Engine

XeLateX

Regression

As far as I know, it's the first time its been pointed out.

Description

Different footnoteXmark, when applied separately from their corresponding footnoteXtext, produce the correct hyperlink (i.e., footnotemarkX), but the actual footnoteXtext are back-referenced (via bodyfootmarkX) to the same last footnoteXmark.

NB: This follows the discussion on TeX Stack Exchange (here)

Minimal Working Example

\documentclass[11pt,twoside,a4paper]{article}
\usepackage[nocritical,noeledsec, noend, series={A}]{reledmac}
\arrangementX[A]{twocol}
\colalignX{\relax }

\usepackage{hyperref}
\hypersetup{
    colorlinks,
    linkcolor={blue}
}

\begin{document}
\noindent This is a test sentence\footnoteAmark[1] 
and then his is a second test sentence\footnoteAmark[2] 
and then this is a third test sentence\footnoteAmark[3]\\

\footnoteAtext[1]{Footnote A1} \footnoteAtext[2]{Footnote A2} \footnoteAtext[3]{Footnote A3}
\end{document}

Workaround

None thus far.

maieul commented 1 year ago

Well, it is not so eays to solve, as we must deal with the fact that people can reset footnotecounter, and also that a same footnote can be called multiple time.

So please try the branch issue954_hyperref_footnote_manuel

ajmisra commented 1 year ago

I just tried the new branch and it works perfectly! Thank you so much, Maïeul. This is great!

maieul commented 1 year ago

Please don't close the branch. I have to do the release...

ajmisra commented 1 year ago

Oops, sorry about that. I hit the wrong button. :)

maieul commented 1 year ago

No problem. The package is ready to be sent on CTAN.

maieul commented 1 year ago

Please validate the answer in stackexchange.

maieul commented 1 year ago

Unfortunatly, there is a but in your use case, when dealing with footnote inside environment. I will release soon a v2.39.5

ajmisra commented 1 year ago

That's awesome. After writing to you, the only problem I discovered with the branch issue954_hyperref_footnote_manuel code was that the backreference in the xltabular environment doesn't work. The \footnoteXmark in the xltabular environment pointed to the right footnote, but the backreference of the \footnoteXtext didn't point back to the mark. Not a big problem for me, but I thought I'd mention it here.

maieul commented 1 year ago

Yes, that is the bug I though. You could have told me : I wouldn't have sent on CTAN a buged version to send again a fixed version...

maieul commented 1 year ago

(It is a just a problem of variable portees... I solve it now. Running the tests, and then release.

ajmisra commented 1 year ago

I'm sorry I didn't notice the bug: it seems only to affect the xltabular environment, when I checked with the paracol environment (which is what I use extensively in my paper), everything works fine. Perhaps, it a xltabular problem.

EDIT: That's awesome that you have solved it! :)

maieul commented 1 year ago

Well, I guess that xtabular does some very tricky things...

maieul commented 1 year ago

I guess it stores the contains of each cell in individual macro, or something like this. And so local variable (as the identifier of the targe) can't work when the typeset is done.

ajmisra commented 1 year ago

Quite possibly so. Also, I am not really sure if reledmac needs to support xltabular footnotes (if it is too much hassle to make them fully compatible). Table footnotes are anyway problematic things and should be avoided. I've had to use them twice in a 100+page paper, and even then the footnotemark and text are on the same page, so I don't really mind the problem. Everywhere else, in all the other environments I've' used it in, they work perfectly so I am very grateful to you for your help! :)

maieul commented 1 year ago

Yes, and reledmac is not designed to use footnoteA outside of critical edition. It is a just a +.

Table footnotes are anyway problematic things and should be avoided.

Yes, indeed, but sometime we have no choice.

Also, I am not really sure if reledmac needs to support xltabular footnotes (if it is too much hassle to make them fully compatible Now, it is juste 3 lines to change, juste let the variable global. SHould not have any side effect, as there variable are defined only once. Now my computer run the tests... wait and see.

maieul commented 1 year ago

well, and tests works. So now, the handbook the final release process is running...

ajmisra commented 1 year ago

awesome!!

ajmisra commented 1 year ago

Hi Maïeul, I just tried the reledmac 2023/07/21 v2.39.5 release via CTAN and also the github master release of ledmac-master, but the problem of \footnoteXmark and \footnoteXtext back-referencing in the xltabular environment still persists. The test.tex file doesn't give proper back references for the 2 and 3 footnotes back to the marks in the xltabular location. As I mentioned, I don't particularly mind it, but I thought I'd bring this to your attention. Thanks again.

maieul commented 1 year ago

ho, you are right... the target point is correct in the footnote, but the anchor is not set well in the main test...

so.. i will try something, and wait some week before releasing.

ajmisra commented 1 year ago

That's great! Thank so much for all your work with this, a lot of us really appreciate it! :)

maieul commented 1 year ago

But at least, it don't go back to the first page, as in 2.39.4

ajmisra commented 1 year ago

indeed!

maieul commented 1 year ago

Well, it is the security and double anchor which cause trouble...

maieul commented 1 year ago

Well, as engine are able to deal with the double anchor, ignoring the last one, I suppress internal security.

Please try branch issue_954_bis

ajmisra commented 1 year ago

That's fantastic! I just checked and now it works!! Great job, mate!

maieul commented 1 year ago

So releaser later in the summer.

ajmisra commented 1 year ago

That's perfect! Cheers :)