Logic 2 notes in HTML

It would be nice if my papers and lecture notes were available in HTML, I thought. Let's start with my lecture notes on modal logic (PDF) I thought. I'll need to convert them from LaTeX to HTML, but surely there are tools for that. I thought.

I was right. But ah, LaTeX! There are, of course, multiple options. You can use pandoc. Or tex4ht. Or lwarp. Or LaTeXML. All of them sort of work, after some fiddling and consulting their thousand-page manuals. But none of them support all the packages I use. And shouldn't those gather lists have more line-spacing, etc.?

I ended up using tex4ht, through make4ht. To make sure that it doesn't balk at my tex input and that the output looks the way I like, I wrote a python script full of ugly regular expressions to preprocess the tex and postprocess the html. Here is the result. It's OK. But why are these menial tasks always so hard?

Comments

# on 16 April 2024, 16:09

Good work getting it done! I’ve been mostly trying to convert old tex things to some variety of markdown and from there to html, but going straight to html may have been better.

It could just be my browser but some of the cross references aren’t showing up. See for instance the links back to earlier definitions in section 2.4.

# on 17 April 2024, 08:25

Ah, thanks! I've fixed the links.

I might do it your way for my old papers. It would be nice to have all of them in markdown/orgmode. Unfortunately, these formats don't seem ready yet for complex documents like my logic notes.

# on 17 April 2024, 11:34

Hi, TeX4ht author here. What things didn't work correctly? I can try to fix them in the sources.

# on 17 April 2024, 16:22

@Michal: Oh, hi, many thanks for this great tool!

What didn't work? These come to mind:

- To make tex4ht compile the source, I had to replace the ifthen package with etoolbox and remove the 'breakable' options from tcolorboxes.

- tex4ht didn't find commands defined with \(re)newcommand in my custom cls file.

- The html produced for tcolorboxes sometimes contained an extra closing </div> and sometimes missed two closing </div>s.

- The links to subsections in the table of contents produced by tex4ht didn't work.

- \ref links to tcolorbox definitions and theorems didn't work.

- Links to sections and chapters and random places in the document didn't work.

I'm afraid I don't have a MWE for any of these, so this is probably not all that useful. You can find my tex source on github.com/wo/logic2. I use make4ht version 0.4 from the 2024 texlive distribution.

# on 18 April 2024, 11:40

Thanks for the link to the repo. It seems that the basic issue is caused by the xyling package, which defines the \Link command. TeX4ht uses a command with the same name for hyperlinks, so this breaks all cross-references. I will try to fix that and then I will look at issues with Tcolorbox.

Add a comment

Please leave these fields blank (spam trap):

No HTML please.
You can edit this comment until 30 minutes after posting.