Re: [tex4ht] question on split levels for tex4ht

2023-10-02 Thread Michal Hoftich
Hi Nasser,

>
> I was thinking this will just be a very thin API, where
> only make4ht will handle, and simply process this option
> split_at and determines the split number needed and then pass it
> to tex4ht as before.
>
> i.e. no code changes needed at all internally for tex4ht.
> I was thinking make4ht will do something like (translate to lua code)
>
>  IF split_at="section" THEN
> IF article class THEN
>split =2
> ELIF book class THEN
>split = 3
> END IF
> ELIF split_at="subsection" THEN
>etc...
> END IF
>
> And now make4ht will call tex4ht as before, nothing
> changed. But using split number that was determined by the above code
> so user does not have to figure it out.
>
> I do not know how make4ht works, but I assume it takes all the
> arguments passed from command line and passes these to
> lower level calls to tex4ht? But maybe I was wrong about this.

This is not so easy, because make4ht by default doesn't read the input
file and the detection of the document class wouldn't be that
straight-forward. It couldn't do that by default, maybe using an
extension. But it would be quite a lot of work, so I am not sure that
this issue is worth it :)

Best,
Michal


Re: [tex4ht] question on split levels for tex4ht

2023-10-01 Thread Nasser M. Abbasi

On 10/1/2023 7:41 AM, Michal Hoftich wrote:


But with the new option, one do not have to worry changing the command
to get the numbers right, if they change from article to
book.


I am not sure about this. If you take a look at the html4.4ht file,
you will find that the code for the numerical options is quite
complex. For example, search for \:CheckOption{7} and then try to find
\CheckOption{1}. It is quite a lot of code. And it is duplicated for
every document class. It would be another several hundreds of
kilobytes if we added that.

Best regards,
Michal


Hello Michal;

I was thinking this will just be a very thin API, where
only make4ht will handle, and simply process this option
split_at and determines the split number needed and then pass it
to tex4ht as before.

i.e. no code changes needed at all internally for tex4ht.
I was thinking make4ht will do something like (translate to lua code)

IF split_at="section" THEN
   IF article class THEN
  split =2
   ELIF book class THEN
  split = 3
   END IF
   ELIF split_at="subsection" THEN
  etc...
   END IF

And now make4ht will call tex4ht as before, nothing
changed. But using split number that was determined by the above code
so user does not have to figure it out.

I do not know how make4ht works, but I assume it takes all the
arguments passed from command line and passes these to
lower level calls to tex4ht? But maybe I was wrong about this.

Best
--Nasser





Re: [tex4ht] question on split levels for tex4ht

2023-10-01 Thread Michal Hoftich
Hi Nasser,

> 1 - split at \part
> 2 - split at \chapter
> 3 - split at \section
> 4 - split at \subsection
> 5 - split at \subsubsection
> 6 - split at \paragraph
> For document classes without \chapter (like article):
>
> 1 - split at \part
> 2 - split at \section
> 3 - split at \subsection
> 5 - split at \subsubsection
> 6 - split at \paragraph
> -
>
> My question is: Why does in article, it skips split level 4, and
> goes from 3 to 5? I find this confusing. May be there is reason
> internally when tex4ht does this?
>

I am not sure why this works in this way, I guess it would be more
logical for classes without \chapter to skipt the option "2". But I am
not sure about changing this, as it would be a quite a big breaking
change. I didn't notice this because if I break pages at all, then I
usually break pages only at the top level, so either at \section or
\chapter.


> I'd like to suggest for some future version that this
> option should be redone. May be add new option calling it
> "split_at" so current method stays backward compatible.
>
> The new option will have the form
>
> split_at="name"
>
> where name can be "part" or "chapter" or "section" or "subsection"
> and so on.
>
> So one can now do
>
>  make4ht   foo.tex 'html,mathjax,split_at="section"'
>
> If string does not work for value, it can just name, as in
>
>  make4ht   foo.tex 'html,mathjax,split_at=section'
>
> Not only is this much more clear than
>
>  make4ht   foo.tex 'html,mathjax,3'
>
> But with the new option, one do not have to worry changing the command
> to get the numbers right, if they change from article to
> book.

I am not sure about this. If you take a look at the html4.4ht file,
you will find that the code for the numerical options is quite
complex. For example, search for \:CheckOption{7} and then try to find
\CheckOption{1}. It is quite a lot of code. And it is duplicated for
every document class. It would be another several hundreds of
kilobytes if we added that.

Best regards,
Michal