Git Product home page Git Product logo

latex-to-html's Introduction

latex-to-html

latex-to-html converts a subset of latex to html. It renders formulas as vector graphics, so that they look exactly as they would in a pdf.
Example

Features

Because latex-to-html renders math formulas using pdflatex, it supports the same math formulas as latex. Inline math must be delimited by $ ... $ and display math must be of the form

\begin{equation}
  \label{....}
  ...
\end{equation}

where the label is optional. Outside of math environments, only a subset of tex/latex is supported:

  • \title{...}
  • \section{...}
  • \subsection{...}
  • \begin{itemize} \item ... \item ... \end{itemize}
  • \begin{enumerate} \item ... \item ... \end{enumerate}
  • Some hard-coded theorem-like environments (those usually declared with \newtheorem):
    • theorem
    • proposition
    • definition
    • lemma
    • remark
    • corollary
    • example
  • \begin{proof} ... \end{proof}
  • \label{...}, \ref{...} and \eqref{...}
  • \emph{...}, \textbf{...}, \textit{...}

There is also basic support for \bibliography.

Latex-to-html ignores the lines directly after a line containing the following comment:

% LATEX_TO_HTML_IGNORE

This is useful in case a tex file is also used with pdflatex directly to generate a pdf file.

For example, latex-to-html does not support the enumitem package. To use it for the generated pdf output anyway, the package can be included as follows:

% LATEX_TO_HTML_IGNORE
\usepackage{enumitem}

The appearance of numerals in an enumeration for the pdf output (but not the webpage) can then be changed like so:

\begin{enumerate}
  % LATEX_TO_HTML_IGNORE
  [label={(\roman*)}]
  \item
    ...
  \item
    ...
\end{enumerate}

Installation

Make sure to install all dependencies first. latex-to-html depends on cargo, pdflatex, pdfcrop and pdf2svg. On Debian or Ubuntu, these dependencies can be installed as follows:

sudo apt install cargo texlive texlive-extra-utils pdf2svg

To download and install latex-to-html to ~/.cargo/bin, run the following:

cargo install latex-to-html

You can now either add $HOME/.cargo/bin to your PATH variable or simply specify the full path when you execute latex-to-html: ~/.cargo/bin/latex-to-html.

Usage

Assuming you have a doc.tex and a doc.bib file, run the following:

latex-to-html doc.tex doc.bib out/

This may take a while on the first run, but subsequent runs will be much faster. To view the generated document, open out/index.html in your browser.

latex-to-html's People

Contributors

mbid avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.