
Existe uma ferramenta chamadapdf2htmlexque faz um trabalho impressionante de conversão de PDF em HTML. Muito fiel. Qualquerlivroscheio de matemática e diagramas foram convertidos fielmente.
Infelizmente, não é mais mantido. Alguém conhece outra ferramenta mantida que faz um trabalho tão bom ao converter PDF ou LaTeX em HTML?
Responder1
eu recomendariamake4htque, da documentação:
make4ht é um sistema de construção simples para conversor tex4ht, TeX para XML. Ele fornece uma ferramenta de linha de comando que orienta o processo de conversão. Ele também fornece uma biblioteca que pode ser usada para criar ferramentas de conversão personalizadas
O autor make4ht
émichal-h21e é um contribuidor muito ativo deste site.
Vamos usar o seguinte pequeno exemplo, mwe.tex
a seguir:
\documentclass{article}
\begin{document}
Here is some text. And here is some mathematical content $y=x^2$.
\end{document}
Exemplo 1
Correndo
make4ht.exe mwe.tex
dá a saída:
<!DOCTYPE html>
<html lang="en-US" xml:lang="en-US" >
<head><title></title>
<meta charset="iso-8859-1" />
<meta name="generator" content="TeX4ht (http://www.tug.org/tex4ht/)" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link rel="stylesheet" type="text/css" href="mwe.css" />
<meta name="src" content="mwe.tex" />
</head><body
>
<!--l. 5--><p class="noindent" >Here is some text. And here is some mathematical content <span
class="cmmi-10">y </span>= <span
class="cmmi-10">x</span><sup><span
class="cmr-7">2</span></sup>. </p>
</body>
</html>
exemplo 2
A partir daqui podemos personalizar a saída empregandoconfiguraçãoarquivos; se você tiver o seguinte:
roxy.cfg
\Preamble{mathml,-css,NoFonts}
\Configure{@HEAD}{\HCode{<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML">\Hnewline</script>\Hnewline}}
\begin{document}
\EndPreamble
e corra
make4ht.exe -f html5 -c roxy.cfg mwe.tex
então você recebe
<!DOCTYPE html>
<html lang="en-US" xml:lang="en-US" >
<head> <title></title>
<meta charset="iso-8859-1" />
<meta name="generator" content="TeX4ht (http://www.tug.org/tex4ht/)" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link rel="stylesheet" type="text/css" href="\aa:CssFile " />
<meta name="src" content="mwe.tex">
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
</head><body
>
<!--l. 5--><p class="noindent" >Here is some text. And here is some mathematical content
<!--l. 5--><math
xmlns="http://www.w3.org/1998/Math/MathML"
display="inline" ><mi
>y</mi> <mo
class="MathClass-rel">=</mo> <msup><mrow
><mi
>x</mi></mrow><mrow
><mn>2</mn></mrow></msup
></math>.
</body>
</html>
exemplo 3
Se você temhtml arrumadoinstalado, você poderá personalizar seu processo de construção para empregá-lo usando o seguinte roxy.mk4
arquivo:
roxy.mk4
Make:match("html$", "tidy -m -config html-tidy.txt -i ${filename}")
e um html-tidy.txt
arquivo de configuração
// sample config file for HTML tidy
indent: auto
indent-spaces: 2
quiet: yes
output-xhtml: no
output-html: yes
então você pode correr
make4ht.exe -f html5 -e roxy.mk4 -c roxy.cfg mwe.tex
receber
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta name="generator" content=
"HTML Tidy for HTML5 for Windows version 5.6.0">
<title></title>
<meta charset="utf-8">
<meta name="generator" content=
"TeX4ht (http://www.tug.org/tex4ht/)">
<meta name="viewport" content=
"width=device-width,initial-scale=1">
<link rel="stylesheet" type="text/css" href="\aa:CssFile">
<meta name="src" content="mwe.tex">
<script src=
"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
</head>
<body>
<!--l. 5-->
<p class="noindent">Here is some text. And here is some
mathematical content <!--l. 5--><math xmlns=
"http://www.w3.org/1998/Math/MathML" display="inline">
<mi>
y
</mi>
<mo class="MathClass-rel">
=
</mo>
<msup>
<mrow>
<mi>
x
</mi>
</mrow>
<mrow>
<mn>
2
</mn>
</mrow>
</msup></math>.</p>
</body>
</html>