LaTeX forum ⇒ GeneralLaTeX vs HTML

LaTeX specific issues not fitting into one of the other forums of this category.
Posts: 2
Joined: Tue Apr 03, 2012 1:22 pm


Postby kowboy_koder » Tue Apr 03, 2012 1:28 pm

Hi guys.

Not really intending to start a flame war, and I hate it as much as anyone when a newbie starts putting down my favourite language. Anyway, I used LaTeX as a requirement for one of my undergrad units back in 2009, but haven't used it since. Since I'm doing an honours year this year which requires a thesis, my research supervisor recommended me to use LaTeX since I do already know it.

Just thinking about it though, I'm struggling to come up with a reason as to why I should use LaTeX over plain old HTML (and CSS). As a developer, I use HTML and CSS all the time, and it seems like they could achieve the same advantages as LaTeX compared to a (dare I say it) Word Processor.

So why do you guys use LaTeX when you can use HTML and CSS, which is much more widely used?


Recommended reading 2021: •
LaTeX Beginner's Guide LaTeX Cookbook
User avatar
Stefan Kottwitz
Site Admin
Posts: 9881
Joined: Mon Mar 10, 2008 9:44 pm

Re: LaTeX vs HTML

Postby Stefan Kottwitz » Tue Apr 03, 2012 1:41 pm

Hi Jay,

welcome to the board!

Perhaps as a start, as you have experience with HTML and CSS, could you show us an example how you would typeset a complex equation, let's say with fractions, subscripts and integrals with limits? And regarding normal text, a simple text in a narrow column, fully justified?

Source and output for viewing (PNG for example) would be great, we could then produce the LaTeX version for comparing.

Stefan admin

Posts: 2
Joined: Tue Apr 03, 2012 1:22 pm


Postby kowboy_koder » Wed Apr 04, 2012 1:16 am

css source.png
The source code (CSS) of the outputting HTML page.
css source.png (7.97 KiB) Viewed 17195 times

Here is the CSS source.

html source.png
The source code of the outputting HTML
html source.png (18.24 KiB) Viewed 17195 times

Here is the HTML source.

html output.png
The HTML output
html output.png (5.75 KiB) Viewed 17195 times

Here is the resulting page. It's actually very easy to realize that HTML does have some shortcomings when it comes to displaying mathematical notations (hence why I didn't bother trying to render an integral lol). Aside from your mathematical formulae though, I can't see any problems I'd run into with HTML/CSS trying to render a normal document or a research paper.

Does anyone have any suggestions as to why LaTEX would be a better choice outside of a mathematical paper?

Thanks guys.

User avatar
Stefan Kottwitz
Site Admin
Posts: 9881
Joined: Mon Mar 10, 2008 9:44 pm


Postby Stefan Kottwitz » Wed Apr 04, 2012 7:57 pm

Ok, so we agree that LaTeX is better for typesetting scientific text. Let's look at normal text. LaTeX does full justification regarding the complete paragraph, not just one line. This gives more room for justifying and for evenly distributing the space.

When I try the HTML/CSS code, I get:

text-css.png (3.38 KiB) Viewed 17185 times

There are big gaps between words when the browser tries justification. It can get better when I change the width of the browser window. Or worse.

With LaTeX and some more text to see the overall justification:

text-latex.png (15.34 KiB) Viewed 17185 times

This is the LaTeX code, nothing fancy, just producing a narrow column with sans serif font, Arial like - I only took the original Helvetica where Arial is derived from.

\section*{A normal text example}
This is normal text, fully justified in a narrow column.
And there is some more text, just for filling the space.
The more text we have, the better we are able to see how the
column is formatted. That's why I write more.

I did not even use hyphenation. And LaTeX can automatically hyphenate words for you, for better justification, in a lot of languages. Can HTML/CSS do that?

While HTML/CSS can be good for web pages with dynamic size, LaTeX is much better for high quality text.

Btw. better post your code as text, like I did with the code box above. If you post screenshots of code, everyone who considers to try this has to type it letter by letter from scratch or use some OCR. Just post code which can be copied and pasted.

Stefan admin

Posts: 1
Joined: Wed Jun 20, 2012 2:44 am


Postby cboettig » Wed Jun 20, 2012 2:57 am

Interesting discussion. I'd just add that MathJax makes it possible to add equations to html using all the standard latex syntax (along with a host of other web publishing solutions), so I do not think this is a valid reason any longer.

Second, CSS took it's time to do automated hyphenation in justified columns, add support for ligatures and other standard typesetting choices latex handles, but these features are also now available.

I have been a LaTeX user for over eight years and only recently learned any CSS at all. Still I would have a hard time convincing a colleague who was already knowledgeable about CSS that I needed LaTeX to create better-looking output. LaTeX still has advantages, but I think the gap has closed. After all, I'm not trying to create documents that look like this. Meanwhile, what answer can LaTeX have to the portable and interactive nature of the web, javascript and all?

Return to “General”

Who is online

Users browsing this forum: No registered users and 11 guests