[texshop] How get sections in separate html pages with TeX4ht?

Richard Koch koch at uoregon.edu
Fri Sep 2 21:29:22 CEST 2022


Murray,

I have plenty on my plate and I don't have time to look at latex2html, which I have never used. Feel free to investigate. Perhaps in several weeks ....

Dick



On Sep 2, 2022, at 12:21 PM, Murray Eisenberg <murrayeisenberg at gmail.com<mailto:murrayeisenberg at gmail.com>> wrote:

Dick,

The tex4ht documentation seems to say that make4ht will take care of automatically splitting into separate files at a specified leve (presumably, with navigation links) , much as latex2html does.

So I don’t want to rewrite the source, just act upon it to do that with tex4ht, which should, in principle, be simple!

In fact, with the indicated modification to TeX4ht.engine (or, equivalently, by using a TeX4ht config file, and changing the make4ht line of the engine to a form…

make4ht -c tex4ht.cfg "$1" “mathjax,2”

… it DOES work as expected with latex sources other than Fourier.tex, e.g. with  the file

http://math.hamline.edu/mathematics/summer_research/template.tex<https://urldefense.com/v3/__http://math.hamline.edu/mathematics/summer_research/template.tex__;!!C5qS4YX3!AoAdH8Ki93MR8Ygz-5pP8OgFo6fPGz0c0G_eWLCdDbiZNVG4o4XNhxDLfLIX_1t84G0_RPj39vnbBIdtl3tpr5IjeA$>

with all the \section* commands changed to \section unstarred commands and with an added \tableofcontents inserted after \maketitle. Automatically each section is on a separate page and has navigation links [next] [prev] [prev-tail] [tail] [up] and suchlike at its top and bottom.

Now my puzzlement is what in Fourier.tex is preventing that from being split up similarly into sections by tex4ht/make4ht.

Murray

On 2 Sep2022, at 1:38 PM, Richard Koch <koch at uoregon.edu<mailto:koch at uoregon.edu>> wrote:

Murray,

You are making this too complicated. Calling the pages Page1, Page2, etc., is irrelevant. I used that in the first version of the document, but it was misleading.

Here's how to do it. if you want to create a new separate web page (for each section, or just arbitrarily),
choose New in TeXShop and get a blank page. Go to the Templates toolbar item and select the
TeX4ht-Interactive template.

Accept the boilerplate stuff at the top and write html code in the body where there is now a comment.

This page can be typeset by just pushing command-T because the appropriate typesetting engine has been selected at the top in a magic comment. But the first time you do this, you will be asked to save the file first. This is not a surprise; TeXShop always works like that.

Save the document in the Interactive subfolder of the source folder of your main TeX4ht document.
Give it any name you like (don't use spaces in the name). If your page is going to have support files, like images or movies, create a folder inside Interactive and put your source in that folder.

Before you push save, use the bottom pulldown menu to select html rather than tex as extension.

Examples: For a stand along page,

Interactive/Section3.html

For a page with support files

Interactive/Section3/FirstSample.html

From now on, you can edit and typeset in the usual style with that page.

Note that ths page doesn't have to be tied to a special section, so the above "Section3" might be
"UTubeExample".

-------------

Now you have a stand along page. To link it to the document, find the spot in the document where it is supposed to live, and type something like

\ifx\HCode\undefined

\else

Please try the following demonstration: \url{/Interactive/Section3/FirstSample.html}

\fi



Dick Koch


On Sep 2, 2022, at 10:22 AM, Murray Eisenberg <murrayeisenberg at gmail.com<mailto:murrayeisenberg at gmail.com>> wrote:

The question is how to produce separate html pages, one for each document section (with the usual kind of next and previous page links) In TeXShop,

Allegedly, the optional parameter “2” to the make4ht command does that.

I’m trying this with the source document Fourier.tex from ~/Library/TeXShop/New/Demo/Fourier-for-TeXShop.

First I tried modifying the new TeXr4ht.engoine by changing its line

make4ht "$1" "mathjax”

to:

make4ht "$1" "mathjax,2”.

But when I typeset, I get a single html file.

Next I tried doing the same thing from a Terminal command line:

make4ht Fourier "mathjax,2”

(followed by pdflatex Fourier). But still a single html page.

Any idea how to make it work?
---
Murray Eisenberg murrayeisenberg at gmail.com<mailto:murrayeisenberg at gmail.com>
Mobile (413)-427-5334
503 King Farm Blvd #101
Rockville, MD 20850-6667






---
Murray Eisenberg murrayeisenberg at gmail.com<mailto:murrayeisenberg at gmail.com>
Mobile (413)-427-5334
503 King Farm Blvd #101
Rockville, MD 20850-6667




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/texshop/attachments/20220902/7c6d8e24/attachment-0001.html>


More information about the texshop mailing list.