How the EPUB2 and MOBI formats can be used for typeset Math.

According to This preceding posting, I was experiencing some frustration over trying to typeset Math, for publication in EPUB2 format. EPUB3 format with MathML support was a viable alternative, though potentially hard on any readers I might have.

Well a situation exists in which either EPUB2 or MOBI can be used to publish typeset Math: Each lossless image can claim the entire width of a column of text, and each image can represent an entire equation. That way, the content of the document can alternate vertically between Text and Typeset Math.

In fact, if an author was to choose to do this, he or she could also use the Linux-based solutions ‘LyX’ , ‘ImageMagick’ , and ‘tex4ebook’ .

(Edited 1/9/2019, 15h35 … )

Continue reading How the EPUB2 and MOBI formats can be used for typeset Math.

Trying to bridge the gap to mobile-friendly reading of typeset equations, using EPUB3?

One of the sad facts about this blog is, that it’s not very mobile-friendly. The actual WordPress Theme that I use is very mobile-friendly, but I have the habit of inserting links into postings, that open typeset Math, in the form of PDF Files. And the real problem with those PDF Files is, the fact that when people try to view them on, say, smart-phones, the Letter-Sized page format forces them to pinch-zoom the document, and then to drag it around on their phone, not getting a good view of the overall document.

And so eventually I’m going to have to look for a better solution. One solution that works, is just to output a garbled PDF-File. But something better is in order.

A solution that works in principle, is to export my LaTeX -typeset Math to EPUB3-format, with MathML. But, the other EPUB and/or MOBI formats just don’t work. But the main downside after all that work for me is, the fact that although there are many ebook-readers for Android, there are only very few that can do everything which EPUB3 is supposed to be able to do, including MathML. Instead, the format is better-suited for distributing prose.

One ebook-reader that does support EPUB3 fully, is called “Infinity Reader“. But if I did publish my Math using EPUB3 format, then I’d be doing the uncomfortable deed, of practically requiring that my readers install this ebook-reader on their smart-phones, for which they’d next need to pay a small in-app purchase, just to get rid of the ads. I’d be betraying all those people who, like me, prefer open-source software. For many years, some version of ‘FBReader’ has remained sufficient for most users.

Thus, if readers get to read This Typeset Math, just because they installed that one ebook-reader, then the experience could end up becoming very disappointing for them. And, I don’t get any kick-back from ImeonSoft, for having encouraged this.

I suppose that this cloud has a silver lining. There does exist a Desktop-based / Laptop-based ebook-reader, which is capable of displaying all these EPUB3 ebooks, and which is as free as one could wish for: The Calibre Ebook Manager. When users install this either under Linux or under Windows, they will also be able to view the sample document I created and linked to above.

(Updated 1/6/2019, 6h00 … )

Continue reading Trying to bridge the gap to mobile-friendly reading of typeset equations, using EPUB3?

About Downloading Shell-Scripts From My Server

On occasion I’ve made shell-scripts for Linux available within this blog, and not used code-blocks to do so, rather linking to an actual .SH File, with which URLs on my server may end.

This brings up the issue, that under Windows, any sort of plain text-file will have its lines terminated by a ‘Carriage-Return’, ‘Line-Feed’ sequence, while Linux tends to terminate them just with a ‘Line-Feed’ character.

If a Windows user downloads a Linux-formatted text-file and tries to open it, chances are that the absence of carriage-returns will prevent any Windows application from even displaying it correctly. Conversely, if a Linux-based ‘bash’ interpreter is given a Windows-formatted file to interpret, there have been reports about errors. At the same time, there is little chance that a Windows user will ever try to get a ‘bash’ shell-script to run under Windows.

So, in certain cases it’s trivial for me to convert my Linux-formatted newlines, into Windows-formatted newlines. This can be done for .CPP Files, which any compiler will still compile fine, even on a Linux-based system. But, I disabled this procedure for .SH Files, because those will never be run on Windows-based systems.

As a result, Windows users may experience difficulties, just getting the .SH Files to display correctly – and then imagining how well they might run under Linux.



Text to SVG-File Shell Script

In an earlier posting I wrote, that I wanted to have a simple way to convert a few lines of plain-old-basic text, into an SVG-Image-File. In that posting I had created a set of templates, which would do so from the command-line, but which nevertheless required that the user do some work.

I also explained that the font-family “Liberation” needed to be installed on the machine, in order for that exact variant of the templates to be valid. And of course, ‘Inkscape’ must also be installed.

Well under Linux, if we’re given such templates, we can next proceed to write a shell-script, which does all the work for us, of assembling the templates, and then of executing some jobs.

Therefore, the only logical conclusion now was, that I created a Shell-Script, which I can enter as a command with the base-name, as the parameter to the script (without any .svg or .png extension), and which will expect some text from the standard input – Initially no more than 6 lines of 25 characters – and which creates the SVG as well as the PNG -Files. This script now works as expected. One finishes entering text with <Ctrl>+D .

The previous article described the theoretical basis on which this script works, and now I’m sharing the script with my readers – who are using Linux.

(Update 03/16/2018, 13h35 : )

I’ve refined my script, so that it allows the user to specify, optionally, a different text-color, a larger image-size if needed, and an external text-file to use as input, in that order. Also, my code now preserves spaces in the input-text, and escape-codes certain dangerous characters, if fed in through an external text-file.




(Update 03/25/2018 : )

I’ve updated my script again. In general, it’s not good for any ‘program’ to have too many dependencies, and the previous version of this script depended on ‘tr’, ‘wc’, ‘sed’, and ‘gawk’, as well as on ‘Inkscape’. While this worked fine on my own computer, it doesn’t serve my potential readers well, who may not want to have all that installed, just to use my script. And so by now, I’ve removed the dependency on ‘gawk’, because what it did, ‘sed’ can do as well.