1

I know that many people use editing programs like MikTeX and TexWorks for TeX documents; these programs (and others like them) provide a pseudo-WYSIWIG (what you see is what you get) interface to TeX. I have not seen, however, any programs that are designed specifically for veiwing documents based on the TeX way.

Obviously, TeX is designed to produce output in a format of choice, but are there any document viewing programs that take TeX formated documents as input and display formated text?

I can see at least a few advantages to such a system:

  • Dynamic zooming with appropriate
    • default for viewing environment (e.g. fit to screen width)
    • font adjustment
    • line wrapping
    • image resizing
  • Hyperreferencing independant of PDF viewer capabilities
  • Reduced memory requirement for document storage (important if implemented on mobile device)

Background: This question was prompted by questions about viewing TeX generated documents on a Kindle. My mother just got a Kindle and was asking me how I navigate through documents on it. Though I primarily use PDFs, hyperreferencing doesn't work on Kindle. It occured to me that a viewer that implemented TeX on a Kindle would be an interesting application.

AdamRedwine
  • 1,133
  • 5
    Wow, you seem to be off on quite a few points here. First off, MikTeX is not an editor. Secondly, TeXWorks is, but it is not WYSIWYG... – qubyte Jan 16 '12 at 15:17
  • You can add hyperlinks to kindle: that's how the table of contents works… – Seamus Jan 16 '12 at 15:19
  • 5
    The rest is just nonsense. A TeX document is just a source file. It's not meant to be read like that. The point is that it's processed into a format that a viewer can read, be it pdf, ps or dvi. – qubyte Jan 16 '12 at 15:20
  • TeX is producing a DVI/PS or PDF file as output, which can then be viewed by a DVI, PS or PDF viewer. I'm not sure what your question is targeting exactly. There is no viewer which displays TeX documents directly, without using a TeX compiler. – Martin Scharrer Jan 16 '12 at 15:20
  • @MarkS.Everitt: Okay, so MikTeX may not be billed as an editor, but "The MiKTeX distribution includes TeXworks, a simple environment for editing TeX/LaTeX documents"... I'll plead guilty on mislabeling. Second, no, TeXWorks is not WYSIWIG, hence my use of the word "pseudo." When MikTeX and TexWorks are used together (as indicated in my sentence) I contend that they form a pseudo WYSIWIG editor; you are free to disagree. – AdamRedwine Jan 16 '12 at 15:36
  • @Seamus: Do you mean hyperlinks can be added from the kindle? which would be quite laborious, or that they can be recognized by the kindle when included in a document using hyperref? – AdamRedwine Jan 16 '12 at 15:39
  • @Martin Scharrer: Yes, a viewer such as I have described would include (be) a TeX compiler. As it is, TeX produces one (with trivial exceptions) output document for each time run. This means that ALL TeX type documents have to be uniquely and individually compiled by the author for the specific format of consumption. I personally can see some merit in a more flexible system whereby the advantages of TeX (logical structure in the document) are accessible in a format chosen by the consumer of the information rather than the author. – AdamRedwine Jan 16 '12 at 15:45
  • 1
    I don't think that makes sense though. An editor is either WYSIWYG or not. In this case, what you edit in no way resembles the result, so it is not WYSIWYG. In any case, it's clear that what you want is something that converts TeX to an ebook format. The conversion isn't 100%, but Pandoc is probably your best bet with LaTeX. – qubyte Jan 16 '12 at 15:46
  • No. You can't edit documents on the kindle. I just meant that hyperlinks are supported by the kindle: if they are in the file, the kindle can follow them appropriately. – Seamus Jan 16 '12 at 15:47
  • 2
    Sorry, I still don't get what you exactly want to do. Also it seems you don't fully understand TeX yet. You have your source file and the TeX compiler compiles it into a PDF (or DVI/PS if you use the IMHO deprecated DVI mode). If you want to add formating like hyperlinks etc. as user, you need to have the source file from the author and a TeX compiler and PDF viewer. – Martin Scharrer Jan 16 '12 at 15:53
  • @MartinScharrer: I do indeed understand how TeX works; I've used it regularly for a number of years now. We simply have very different views of its purpose... it is not TeX's purpose to produce output in a format of the author's choice... it is TeX's purpose to aid in the communication of information from one human being to another. I am interested in improving information communication; I only care about the particular implementation insofar as it advances my goal of communicating effectively. – AdamRedwine Jan 16 '12 at 16:38
  • 1
  • 1
    @AdamRedwine You and Martin seem to disagree, not about any facts, but about what purpose is of interest. This is a technical site and thus Martin (like many of us) are here interested in TeX and friend's "proximate" purpose. (If I may abuse Mayr's ultimate/proximate distinction) You are talking about TeX's ultimate purpose. – Seamus Jan 17 '12 at 22:17

3 Answers3

6

The way I understand this question is: On current e-book readers, you can change the font size of a document, and the reader will reflow the paragraphs for you. Because of that, you cannot take advantage of one of the most powerful aspects of TeX: its line breaking algorithm. Also figure resizing is a problem. The idea AdamRedwine seems to be proposing here is to distribute the documents in a format that is a subset of TeX, without specifying things like font size, page size and margins, and process the documents on the fly in the e-book reader with something like a TeX engine, with the reader supplying the missing information about font and page size. That way you would have more or less nicely formatted document no matter what your reader screen size is, and no matter what font size you choose.

I do not think that is really possible. First, not everything in a well designed TeX document is done automatically. Things like overfull hboxes, orphans and widows, figure placement etc. have to be often adjusted manually, sometimes even by changing the text. Second, I do not know what the processing power of the new Kindle is, but I have an old Nook, and that very far from being fast enough to run TeX on the fly to reflow a document. You also do not want to waste storage space for a reasonably complete TeX distribution.

Perhaps having some very limited subset of TeX, that would just use the line and paragraph breaking algorithm, would at some point of time be viable. Or maybe something based on lout. But right now I am not aware of anything that would do the job.

Jan Hlavacek
  • 19,242
  • 1
    Thank you, this is very much the sort of thing I was trying to describe. My interest is in balancing the interests of the producer and consumer of the information. It seems to me that most information formats are producer driven (either providing ease of use like MS Office, or power like LaTeX). The primary exception that I can think of is HTML with CSS; these tend to be more consumer focused but do not function well for text based information like scientific books. – AdamRedwine Jan 16 '12 at 16:17
3

There are programs that are more or less WYSIWIG for TeX:

A closed system like a Kindle is not an ideal candidate for anything like that though as you would need a lot of support from Amazon. On other devices running it might be possible to install some kind of TeX distribution and hack together something. Basically you would need a pdf viewer that automatically runs the TeX compiler in the background if something like the text size is changed. Another caveat is that the .tex document also needs to be compatible with packages like geometry to allow easy change of page sizes more or less on the fly.

I think it is an interesting idea but compared to other formats for reflow like the epub format it would take quite a bit of work to have a working and easy to use package.

Alexander
  • 9,163
  • Thanks, I haven't looked into ePub much. I did see some references to generating ePub from LaTeX source; this might be a better way to go. – AdamRedwine Jan 16 '12 at 16:28
2

Theoretically, this would be possible. A customized TeX compiler could be created that, for example, executed function calls to a QPainter to draw pages in a Qt application instead of outputting DVI or PDF documents. The LuaTeX team seems to be working towards this as explained by the "Backends" section of their roadmap.

However, the problem is that creating a custom TeX compiler is very, very difficult. To misquote an old proverb:

The road to hell is paved with abandoned, half-implemented TeX compilers

See Is there a BNF grammar of the TeX language? in order to get an idea of how hard it is to take the first step down this road.

Sharpie
  • 12,844
  • 6
  • 48
  • 58