Re: [tex4ht] [bug #607] tex4ht with package hyperref and option destlabel creates no ancor

2023-08-21 Thread Ulrike Fischer
Sorry I didn't really follow, but in PDF the destlabel option of hyperref works 
with a two-pass compilation: 
at the first compilation, the destination in the PDF has the normal name (e.g. 
section.1), and when the \label is seen, hyperref stores into the aux the new 
name:

\hyper@newdestlabel{section.1}{special-sec-label}

At the second compilation, hyperref then replaces "section.1" by 
"special-sec-label".

I don't quite see why it should be difficult for tex4ht to use the info from 
the aux too.

Ulrike


Guten Tag, Michal Hoftich,

am Montag, 21. August 2023 um 11:19 schrieben Sie:

> Follow-up Comment #5, bug #607 (project tex4ht):

> The solution in the linked answer on TeX.sx is a base for the code that
> make4ht executes by default. I just fixed some errors and issues that I found
> in the meantime.

> On the TeX side, when we add any code to \label, it will always point under
> the section title. This is because of how HTML works. As soon as the section
> is closed, it inserts the  tag, and everything that follows, such as the
> destination anchor for the label, is displayed on another line. It could be
> possible to move the anchor to a section using Lua filters, but it would be
> slower.

> In PDF, it may be possible to insert the destination on the same line, because
> it doesn't insert an implicit line break with the end tag.

> ___

> Reply to this item at:

>   

> ___
>   Message sent via/by Puszcza
>   http://puszcza.gnu.org.ua/





[tex4ht] [bug #607] tex4ht with package hyperref and option destlabel creates no ancor

2023-08-21 Thread Michal Hoftich
Follow-up Comment #5, bug #607 (project tex4ht):

The solution in the linked answer on TeX.sx is a base for the code that
make4ht executes by default. I just fixed some errors and issues that I found
in the meantime.

On the TeX side, when we add any code to \label, it will always point under
the section title. This is because of how HTML works. As soon as the section
is closed, it inserts the  tag, and everything that follows, such as the
destination anchor for the label, is displayed on another line. It could be
possible to move the anchor to a section using Lua filters, but it would be
slower.

In PDF, it may be possible to insert the destination on the same line, because
it doesn't insert an implicit line break with the end tag.

___

Reply to this item at:

  

___
  Message sent via/by Puszcza
  http://puszcza.gnu.org.ua/



[tex4ht] [bug #607] tex4ht with package hyperref and option destlabel creates no ancor

2023-08-19 Thread Ernst Reissner
Follow-up Comment #4, bug #607 (project tex4ht):

I tried the solution with config.cfg. 
It works approximately: 
The anchor seems to be set a bit late 
and so the headline is cut off. 

The other solution works very well for me. 

I found another one, 
https://tex.stackexchange.com/questions/260932/destlabel-option-of-the-hyperref-package-does-not-work-in-combination-with-htlat
also from you. 
I dont like as much as the above, because filtering makes the thing slower. 


Still I think all these are kind of workarounds: 
hyperref is the way links are added to PDF 
but HTML came with links from the very beginning. 

I think, 

```
\usepackage[destlabels, tex4ht]{hyperref}
```

shall work in a way, that `test.pdf#label` can be just replaced by
`test.html#label`. 
Maybe your solution with the config file 
can be corrected a bit that the placement is more precise 
and is automatted if `destlabels` is used in conjunction with `tex4ht`. 

This would be very good. 
Then also it is not important whether one uses make4ht or htlatex. 



___

Reply to this item at:

  

___
  Message sent via/by Puszcza
  http://puszcza.gnu.org.ua/



[tex4ht] [bug #607] tex4ht with package hyperref and option destlabel creates no ancor

2023-08-17 Thread Michal Hoftich
Follow-up Comment #3, bug #607 (project tex4ht):

Save that code as config.cfg. To use it with htlatex, execute:

$ htlatex filename.tex "config,uni-html4,2,svg,pic-tabular" " -cunihtf -utf8"

With make4ht, use:

$ make4ht -c config.cfg filename.tex "uni-html4,2,svg,pic-tabular"

make4ht uses UTF-8 by default, so you don't need to pass extra parameters for
tex4htOptions.

___

Reply to this item at:

  

___
  Message sent via/by Puszcza
  http://puszcza.gnu.org.ua/



[tex4ht] [bug #607] tex4ht with package hyperref and option destlabel creates no ancor

2023-08-17 Thread Ernst Reissner
Follow-up Comment #2, bug #607 (project tex4ht):

First of all, thank you a lot for your quick reply! 

One thing I don't understand: 

```
You can try something like this:
%%%
\Preamble{xhtml}
\let\origlabel\label
\def\label#1{%
\HCode{}%
\origlabel{#1}%
\HCode{}%
}
\begin{document}
\EndPreamble
%%%
```

Where shall I add this? in the source? 
Please explain  

___

Reply to this item at:

  

___
  Message sent via/by Puszcza
  http://puszcza.gnu.org.ua/



[tex4ht] [bug #607] tex4ht with package hyperref and option destlabel creates no ancor

2023-08-17 Thread Michal Hoftich
Follow-up Comment #1, bug #607 (project tex4ht):

You can try something like this:

%%%
\Preamble{xhtml}
\let\origlabel\label
\def\label#1{%
\HCode{}%
\origlabel{#1}%
\HCode{}%
}
\begin{document}
\EndPreamble
%%%

It will add  elements at the point of \label. 

In addition, if you use make4ht instead of htlatex, it sets every section to
use id based on the section name. So your sample produces something like
this:

1Exporting in various
formats

You can then link to "#exporting-in-various-formats" which should be stable
unless you change the section title.



___

Reply to this item at:

  

___
  Message sent via/by Puszcza
  http://puszcza.gnu.org.ua/



[tex4ht] [bug #607] tex4ht with package hyperref and option destlabel creates no ancor

2023-08-16 Thread Ernst Reissner
URL:
  

 Summary: tex4ht with package hyperref and option destlabel
creates no ancor
 Project: tex4ht
Submitted by: reissner
Submitted on: Wed Aug 16 16:33:01 2023
Category: None
Priority: 5 - Normal
Severity: 5 - Normal
  Status: None
 Privacy: Public
 Assigned to: None
Originator Email: 
 Open/Closed: Open
 Discussion Lock: Any

___

Details:

I create html from latex with 
htlatex
tex4htStyOptionsxhtml,uni-html4,2,svg,pic-tabular
tex4htOptions   ’ -cunihtf -utf8’
t4htOptions the empty string 

The latex file has in header 
`\usepackage[tex4ht,destlabel]{hyperref}` 
and has a section 

```
\section{Exporting in various formats}\label{sec:stableUsage}
```

As a result, I obtain a html file 
with following headline 

```
3.2
Exporting in various formats
```

Here, the label in the latex source does not occur. 
Instead there is a generated label which may change, 
e.g. when inserting another section. 

When referencing this, it reads in the output 

```
included and a Section3.2 
```
and here, the label `sec:stableUsage` occurs, 
i.e. it is know, but it occurs only as a comment. 

I would expect, that there are two anchors, 
one with generated id and an other one with id 
taken from the label in the source. 

I think, i cannot use the reference `file.html#x8-130003.2` 
because it is not stable. 
I could use `file.html#sec:stableUsage`. 




___

Reply to this item at:

  

___
  Message sent via/by Puszcza
  http://puszcza.gnu.org.ua/