Supporting custom LaTeX book

Hi everyone,

Sorry for having multiple questions lately. Our Pressbooks service has been seeing a lot of new use cases because of the move to online learning with Covid.

An instructor has approached me with a book he has written in a custom LaTeX script. We have the LaTeX source file and a pdf file for the book. Our service is also using Quick LaTeX.

To get it into Pressbooks, we have tried converting the pdf file into an .docx for importing without a lot of luck. A lot of the source formatting is lost in the conversion.

Does anyone have any creative insight on how to manage these LaTeX files? It is fine if it is just not compatible with Pressbooks at this time, I just want to be sure I am doing my due diligence to find all solutions for this instructor.

Best wishes,
Michelle

1 Like

MichellBB,

Can you say what you mean by “custom LaTeX script”? Do you mean a particular style file? Or lots of his own macros?

My feeling is that style files are not going to go over to PB at all – they are usually general things about section and paragraph formatting, choices of fonts, etc. That sort of stuff is handled by PressBook themes, mostly. The issue of individual macros is a big problem, though.

The default renderer for PB is MathJax, which has a nice feature for setting up custom macros (and font choices for mathematics) … which isn’t implemented in PressBooks at the moment. Apparently it is on a wish list and will get done at some point.

My feeling is that PressBooks is pretty much unusable for a math (or computer science or physics) textbook at the moment. Maybe it will be OK when the MathJax macro feature is enabled, but certainly not before then. I tried to move a math book of mine (written in LaTeX) over to PressBooks and just gave up. I know of several projects which are using PreTeXt for math OER and who like it … its main thing is its LaTeX integration, so maybe that’s the way to go – I don’t have personal experience with it, so I can’t say more.

I’m a longtime LaTeX user and more recent PressBooks user as well… I’d be happy to chat with you directly if it would help at all. Feel free to contact me directly if you want to have a synchronous conversation!

best,
Jonathan Poritz

Hi @MichelleB@poritzj is a much more knowledgeable LaTeX user than I am, but based on your description it sounds like a couple of things are happening here. First, LaTeX is a full typesetting system and is often used to prepare and format entire documents. It sounds like that’s what’s happened here, in that the user has written the entire document/rendering with LaTeX. In Pressbooks, we typically only use LaTeX to render mathematical expressions or other formulae which can’t easily be expressed with standard HTML elements. If you were to look at the demonstration of LaTeX here: https://en.wikipedia.org/wiki/LaTeX#Typesetting_system, for example, we’d typically represent most of the initial paragraph in Pressbooks in our standard visual editor, and would only wrap the LaTeX and TeX references and equations at the end in LaTeX delimiters. Does that make sense? Hopefully it helps in thinking about how you might move between a fully LaTeX document to a hybrid one in which most of the contents are wrapped in HTML tags and special characters are expressed with LaTeX.

Second, you may want to take a look at the various forms of syntax that we currently support in Pressbooks: https://guide.pressbooks.com/chapter/equations-and-formulas/. It’s possible that you will need to globally replace/modify the delimiters from the document you received in order for them to correctly recognized and displayed in the Pressbooks book you’re working on.

1 Like

The closest I have gotten to making this work is exporting a book from LaTeX to EPUB, and then importing the EPUB into Pressbooks.

It was still a mess of a cleanup.