Using TeX fonts in HTML documents?

If you specifically want the Computer Modern fonts on your webpage, your best bet is to use the Latin Modern CM clone, since it is available in OTF format. These could then be used e.g. with @font-face (Fontsquirrel has a good generator).

If you're asking a more general question, e.g. "How do I use any T1 font on my webpage", the answer is a bit more depressing. In that case, your only option would be to generate an OTF font based on the T1 representations. This is nontrivial and presumably time-consuming, but it should be possible using FontForge or similar tools.

tl;dr: Find an OTF alternative if possible, otherwise create an OTF font based on the T1 fonts.


Someone created a project which allows you to have LaTeX fonts inside your HTML. Include the following in the head of your html page, for example:

<link rel="stylesheet" type="text/css"
    href="https://cdn.rawgit.com/dreampulse/computer-modern-web-font/master/fonts.css">
<style>
body {
  font-family: "Computer Modern Sans", sans-serif;
}
</style>

I used it for my own purposes and it is working well. As a side note, the documentation says that it is safe to rely on this external css.

Tags:

Html

Fonts