LaTeX forum ⇒ GeneralBuild Profiles "LaTeX -> HTML" and "LaTeX -> RTF"

General information and discussion about TeXnicCenter
tedmoorman
Posts: 6
Joined: Sat Jan 12, 2008 3:12 am

Build Profiles "LaTeX -> HTML" and "LaTeX -> RTF"

Postby tedmoorman » Sat Jan 12, 2008 3:25 am

Hello All,

Does anyone know how to configure the output profile for converting "LaTeX => HTML" and for coverting "LaTeX => RTF"?
I know that MiKTeX comes with such a tool (htlatex?). It would be nice if TeXnicCenter (TXC) were automatically configured with these to output profiles.

If someone more knowledgeable could point out the directories in MiKTeX and the commands to use in the TXC build profile configuration, I'm sure that many would benefit.

Sincerely,

Ted

User avatar
localghost
Site Moderator
Posts: 9204
Joined: Fri Feb 02, 2007 12:06 pm

Postby localghost » Sat Jan 12, 2008 1:08 pm

For producing HTML I suggest to search for things like latex2html or tex4ht. You should find appropriate binaries in the texmf tree of your distribution and then be able to generate the build profile. Just take the already existing build profiles as examples. For converting to RTF there is no direct solution. You should be aware of the fact that the formats produced by (pdf)LaTeX are DVI or PDF. So, try searching for corresponding converters which produce the requested RTF. Presumably there will be no such converter.


Best regards and welcome on Board
Thorsten
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1

tedmoorman
Posts: 6
Joined: Sat Jan 12, 2008 3:12 am

Postby tedmoorman » Sat Jan 12, 2008 8:39 pm

Hello,

I am not sure what "binaries" are. Also, I could not locate a file or folder called texmf in the Miktex distribution.

In the other profiles (LaTeX=>PS for example), there is a "Command line argument to pass to the compiler." The one for PS is the following: --src -interaction=nonstopmode "%Wm" .

It is not immediately obvious to me, what the analagous command line argument should be for LaTeX=>HTML. Would you have a suggestion?

When I use '--src -interaction=nonstopmode "%Wm"' with a path to the (La)TeX compiler like
C:\Program Files\MiKTeX 2.7\miktex\bin\htlatex.exe, I get an error message saying that the file "src" is not found.

Thanks for any help,

Ted

tedmoorman
Posts: 6
Joined: Sat Jan 12, 2008 3:12 am

Postby tedmoorman » Mon Jan 14, 2008 5:54 pm

Okay,

Credit to Andrew Norris for helping me figure out how to do this!

First, LaTeX=>HTML . . .

Go to Build -> Define Output Profiles . . .

For the (La)TeX part of the profile, first copy the profile Latex=>PS and rename LaTeX=>HTML.

Then go to the Postprocessor part of the profile and change "DviPs" to "html" (if you'd like).

For the important part . . .

Change Executable to: C:\Program Files\MiKTeX 2.7\miktex\bin\htlatex.exe or wherever your htlatex.exe file is located.

Then change the Argument to: "%pm" .

In your .tex file, you need to place the statement: \usepackage{tex4ht} .

When you go to Build in TeXnicCenter, select Current File -> Build. Go to the directory where your files are stored and you should see an .html file with the same name as your .tex file.

As for converting LaTeX=>RTF, this can be done with the LaTeX2RTF program. I don't know how to build a profile, but perhaps someone else does.

These documents probably won't look perfect unless you consult with the tex4ht and LaTeX2RTF documentation and modify your .tex file.

Feel free to add.

Hope this helps!

Ted

tonie
Posts: 9
Joined: Sat Jan 26, 2008 1:18 pm

Postby tonie » Sat Jan 26, 2008 1:34 pm

With linux I can convert latex to html very easy. But now I haven't installed a linux-distribution anymore, therefore I want to use texniccenter in window.
I did it in the same was as Ted.However I'm just wondering, it doesn't work. I get three errors, however I cannot read the mistakes, it does not seem to be html errors, it is something different...But I don't get any html-file
Firstly, I don't think that you need a postprocessor, or!? You can directly convert your .tex-file to html with "htlatex.exe", or!??
And I included as well "\usepackage{tex4ht}", do I have to include anything more.
I get three errors, I have attached them...
Does anybody now as well a niece tutorial for latex->html, I think there might be some interesting features, or!??
Attachments
errors.jpeg
errors.jpeg (144.28 KiB) Viewed 35719 times

tedmoorman
Posts: 6
Joined: Sat Jan 12, 2008 3:12 am

Postby tedmoorman » Mon Jan 28, 2008 5:14 pm

I have actually had better success with a program called TeX Converter.
The program is available here: http://www.mayer.dial.pipex.com/texconv.zip.
Additional information on the program is here: http://www.mayer.dial.pipex.com/tex.htm.

You will also need to install Hevea and TTH and reference their locations in the TeX Converter program. These do a better job of converting LaTeX than tex4ht.

TTH is pretty easy to install.

Hevea is somewhat difficult to install. You should take a look at the manual.

Hevea makes tables look pretty good, but equations and citations don't seem to work too well (at least not hyperreferences).

TTH cannot handle tables or graphics very well, but everything else looks great (equations, references, etc.).

TTH can be downloaded here: http://hutchinson.belmont.ma.us/tth/tth-noncom/download.html.

Hevea can be downloaded here: http://hevea.inria.fr/

I hope this helps!

Ted

crobar
Posts: 12
Joined: Mon Nov 16, 2009 4:41 pm

Postby crobar » Wed Jun 20, 2012 3:12 pm

In case anyone is interested I have now successfully got a system working that lets you use TeXnicCenter (TXC) for this. I have done the following:

  1. First create a "latex2html.bat" file which I put somewhere on the Windows path which has the following contents:
    1. REM @echo off
    2. REM - windows batch file for converting latex to html
    3. cd "%1"
    4. htlatex %2 "html,mathml-"

    htlatex will also have to be in the windows path of course.
  2. use the following output profile in TXC to build the document (you can import this by saving it somewhere as *.tco and importing it from the Define Output Profiles dialog)
    1. <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
    2. <txcop:outputProfiles version="1" xmlns:txcop="http://schemas.ToolsCenter.org/TeXnicCenter/OutputProfiles.xsd">
    3. <outputProfileList>
    4. <outputProfile name="LaTeX=&gt;HTML2" stopOnLatexError="false">
    5. <texCommand execute="false" path="" arguments=""/>
    6. <bibTexCommand execute="false" path="" arguments=""/>
    7. <makeIndexCommand execute="false" path="" arguments=""/>
    8. <postProcessors>
    9. <processor name="latex2html batch file" path="latex2html.bat" arguments="&quot;%dm&quot; %nm" inputFile="" outputFile=""/>
    10. </postProcessors>
    11. <viewer path="" closeBeforeCompilation="false">
    12. <viewProjectCommand type="commandLine">
    13. <commandLineCommand path="" arguments=""/>
    14. <ddeCommand path="" server="" topic="System" command=""/>
    15. </viewProjectCommand>
    16. <viewCurrentFileCommand type="commandLine">
    17. <commandLineCommand path="" arguments=""/>
    18. <ddeCommand path="" server="" topic="System" command=""/>
    19. </viewCurrentFileCommand>
    20. <viewCloseCommand type="commandLine">
    21. <commandLineCommand path="" arguments=""/>
    22. <ddeCommand path="" server="" topic="System" command=""/>
    23. </viewCloseCommand>
    24. </viewer>
    25. </outputProfile>
    26. </outputProfileList>
    27. </txcop:outputProfiles>

  3. if you have tikZ figures put the following in your preamble to convert them to SVG when using tex4ht:
    1. % allow building with htlatex
    2. \makeatletter
    3. \@ifpackageloaded{tex4ht}{
    4. % see:
    5. % http://tex.stackexchange.com/questions/50853
    6. % for why we do the following two lines
    7. \def\headerps@out#1{\special{! #1}}%
    8. \let\columnlines\empty
    9. % this last line loads the correct dirver for tikz to produce SVG files
    10. \def\pgfsysdriver{pgfsys-tex4ht.def}
    11. }{}
    12. \makeatother


Return to “General”

Who is online

Users browsing this forum: No registered users and 1 guest