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

xr-hyper doesn't work when referencing the current file #140

Open
alfredholmes opened this issue Nov 28, 2023 · 6 comments
Open

xr-hyper doesn't work when referencing the current file #140

alfredholmes opened this issue Nov 28, 2023 · 6 comments

Comments

@alfredholmes
Copy link

The document example.tex with contents

\documentclass{article}

\usepackage{xr-hyper}
\usepackage{hyperref}
\usepackage{cleveref}


\externaldocument[example-]{example}


\begin{document}
\section{First Section} \label{section}
\begin{equation} \label{equation}
    \int f(x) dx
\end{equation}

    \hyperref[example-equation]{The equation in main}.

\end{document}

compiles, but the link doesn't work.

@alfredholmes alfredholmes changed the title xr-hyper doesn't work when refernecing the current file xr-hyper doesn't work when referencing the current file Nov 28, 2023
@michal-h21
Copy link
Owner

Thanks for the report. Debugging issues with Xr and Hyperref is quite tricky, so finding a solution can take some time. What is the reason to reference the current file in this way?

@alfredholmes
Copy link
Author

I was trying to use this project (https://github.com/alfredholmes/TeXNotes) to quickly generate a static html website using LaTeX, just to see if it was possible.

I setup a header template (containing a title and a couple of links) that I could import into each document, but the links don't work if they reference something on the current page.

More generally, TeXNotes uses \catchfilebetweentags to allow parts of LaTeX documents to be imported to other LaTeX documents, and uses xr-hyper to allow references between files. If you import a file that references something in the current document, then the link doesn't work.

In principle I could get TeXNotes to preprocess the LaTeX documents to fix this, but I would be nicer from an application design point of view if this was handled by make4ht in the same way as pdflatex.

@michal-h21
Copy link
Owner

It seems that even referencing of external files doesn't work anymore, as the previous issue produces runtime errors. Both Hyperref and Xr received updates, so there are some regressions.

@alfredholmes
Copy link
Author

That's a shame. I think it would be nice to be able to generate a static html site from pages written in LaTeX using make4ht. Due to the new errors, do you have any suggestions on alternative ways to implement this rather than with the above packages?

@michal-h21
Copy link
Owner

I still hope I will get it to work. I already fixed the error that I mentioned in my previous message. I will just need to find some more time to dive into this issue deeply.

@u-fischer
Copy link

if this was handled by make4ht in the same way as pdflatex.

just to note: this doesn't properly work in pdflatex. xr-hyper/hyperref produces a GoToR-link to an external document from such a reference:

/Subtype/Link/A<</F(test-utf8.pdf)/S/GoToR/D(equation.1.1)>>

If you are lucky your PDF viewer can handle that, but it is clearly not the same as a normal internal link.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants