
Hay una herramienta llamadapdf2htmlexque hace un trabajo impresionante al convertir PDF a HTML. Muy fiel. CualquieralibrosLleno de matemáticas y diagramas han sido fielmente convertidos.
Lamentablemente ya no se mantiene. ¿Alguien conoce otra herramienta mantenida que haga un buen trabajo al convertir PDF o LaTeX a HTML?
Respuesta1
Yo lo recomiendohacer4htque, de la documentación:
make4ht es un sistema de compilación simple para tex4ht, conversor de TeX a XML. Proporciona una herramienta de línea de comandos que impulsa el proceso de conversión. También proporciona una biblioteca que se puede utilizar para crear herramientas de conversión personalizadas.
El autor de make4ht
esmichal-h21y es un colaborador muy activo de este sitio.
Usemos el siguiente pequeño ejemplo, mwe.tex
a continuación:
\documentclass{article}
\begin{document}
Here is some text. And here is some mathematical content $y=x^2$.
\end{document}
Ejemplo 1
Correr
make4ht.exe mwe.tex
da la salida:
<!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>
ejemplo 2
Desde aquí podemos personalizar la salida empleandoconfiguraciónarchivos; si tienes lo siguiente:
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
y correr
make4ht.exe -f html5 -c roxy.cfg mwe.tex
entonces recibes
<!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>
ejemplo 3
Si usted tienehtml ordenadoinstalado, luego puede personalizar su proceso de compilación para emplearlo usando el siguiente roxy.mk4
archivo:
roxy.mk4
Make:match("html$", "tidy -m -config html-tidy.txt -i ${filename}")
y un html-tidy.txt
archivo de configuración
// sample config file for HTML tidy
indent: auto
indent-spaces: 2
quiet: yes
output-xhtml: no
output-html: yes
entonces puedes correr
make4ht.exe -f html5 -e roxy.mk4 -c roxy.cfg mwe.tex
para recibir
<!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>