5.14 my setup for using htlatex on linux, installing make4ht

  1. typed kpsewhich -var-value TEXMFHOME

    to find where TeX will look for files.

  2. edits my .basrc and added this

       export TEXMFHOME=$HOME/texmf 
       export PATH=$HOME/texmf/scripts/lu/make4ht-master:$PATH
     
    
  3. I use now make4ht to build latex to html (new builder in place of htlatex). Downloaded it from

    https://github.com/michal-h21/make4ht

    and extracted the zip file below $TEXHMF/scripts/lua folder.

    >unzip make4ht-master.zip 
    Archive:  make4ht-master.zip 
    5417507d156b01aded3371efc2d5b71074bb0afe 
       creating: make4ht-master/ 
      inflating: make4ht-master/README.md 
      inflating: make4ht-master/lapp-mk4.lua 
      inflating: make4ht-master/make4ht 
      inflating: make4ht-master/make4ht-lib.lua 
      inflating: make4ht-master/mkparams.lua 
      inflating: make4ht-master/mkutils.lua 
    >cd make4ht-master/
     
    

    So the tree looks like this

     
    cd $HOME 
    tree texmf 
     
    texmf 
    |___+ scripts 
        |___lua 
            |___make4ht-master 
                |-- lapp-mk4.lua 
                |-- make4ht 
                |-- make4ht-lib.lua 
                |-- mkparams.lua 
                |-- mkutils.lua 
                |-- README.md
     
    
  4. make sure you have convert, if not do sudo apt-get install imagemagick
  5. make sure you have lua, if not do sudo apt-get install lua5.2 (may be not needed)
  6. the command to build latex to html is

             make4ht foo.tex "nma.cfg,htm,charset=utf-8" " -cunihtf -utf8"  "-dfoo"
     
    

    where nma.cfg is currently here nma.cfg

  7. in the latex files, I include one file in the preamble which has all the packages to use. Here it is commonlatex.tex
  8. example latex file will then be as this

             \documentclass[]{article} 
             \input{commonlatex} 
             \begin{document} 
     
             \end{document}
     
    
  9. when first installing, need to fix tex4ht.env so that .png images are better quality. See http: //tex.stackexchange.com/questions/43772/latex-xhtml-with-tex4ht-bad-quality-images-of-equations Use the <dvipng> by erasing the space before it and add space before the <convert> section.

    >locate tex4ht.env 
    /usr/local/texlive/2013/texmf-dist/doc/latex/latex-web-companion/ch4/tex4ht.env 
    /usr/local/texlive/2013/texmf-dist/tex4ht/base/unix/tex4ht.env 
    /usr/local/texlive/2013/texmf-dist/tex4ht/base/win32/tex4ht.env 
     
    >cd /usr/local/texlive/2013/texmf-dist/tex4ht/base/unix 
    >sudo cp tex4ht.env tex4ht.env.SAVED 
    >sudo vi tex4ht.env 
    > 
     
    >diff tex4ht.env tex4ht.env.SAVED 
    153c153 
    < <convert> 
    --- 
    >  <convert> 
    170c170 
    < </convert> 
    --- 
    >  </convert> 
    183c183 
    <  <dvipng> 
    --- 
    > <dvipng> 
    185c185 
    < Gdvipng -T tight -x 1400 -D 96 -bg Transparent -pp %%2:%%2 %%1 -o %%3 
    --- 
    > Gdvipng -T tight -x 1400 -D 72 -bg Transparent -pp %%2:%%2 %%1 -o %%3 
    187c187 
    < Gdvipng -T tight -x 1400 -D 96 -bg Transparent -gif -pp %%2:%%2 %%1 -o %%3 
    --- 
    > Gdvipng -T tight -x 1400 -D 72 -bg Transparent -gif -pp %%2:%%2 %%1 -o %%3 
    192c192 
    <  </dvipng> 
    --- 
    > </dvipng> 
    >