vincentdoerig / latex-css

LaTeX.css is a CSS library that makes your website look like a LaTeX document
https://latex.vercel.app
MIT License
2.74k stars 125 forks source link

How to use latex-css locally? #39

Closed Ypot closed 3 years ago

Ypot commented 3 years ago

Hi I am trying to use the style.css locally, but the export results are different. I copied the content from https://latex.now.sh/style.css in an plain text file and renamed to latex.css but the appearence is quite worse.

image

Left: <link rel="stylesheet" href="https://latex.now.sh/style.css"> Right: <link rel="stylesheet" type="text/css" href="latex.css" />

chuahou commented 3 years ago

style.css contains relative links to font files, e.g.

@font-face {
  font-family: 'Latin Modern';
  font-style: normal;
  font-weight: normal;
  font-display: swap;
  src: url('./fonts/LM-regular.woff2') format('woff2'),
    url('./fonts/LM-regular.woff') format('woff'),
    url('./fonts/LM-regular.ttf') format('truetype');
}

would need LM-regular.woff2 etc in the fonts/ directory. You probably need to replicate this directory structure in your local copy to emulate the same results. As a start, you definitely need these fonts.

Personally, I would use a clone of the repository (e.g. as a submodule) to avoid having to replicate relative filepaths manually.

Ypot commented 3 years ago

I cloned the repository locally. It works great, thanks!