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

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

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

Post by tedmoorman »

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

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
localghost
Site Moderator
Posts: 9201
Joined: Fri Feb 02, 2007 12:06 pm

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

Post by localghost »

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
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes[/size]

¹ 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

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

Post by tedmoorman »

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

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

Post by tedmoorman »

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

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

Post by tonie »

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 40589 times
tedmoorman
Posts: 6
Joined: Sat Jan 12, 2008 3:12 am

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

Post by tedmoorman »

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 ... nload.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

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

Post by crobar »

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:

    Code: Select all

    REM @echo off
    REM - windows batch file for converting latex to html
    cd "%1"
    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)

    Code: Select all

    <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
    <txcop:outputProfiles version="1" xmlns:txcop="http://schemas.ToolsCenter.org/TeXnicCenter/OutputProfiles.xsd">
    	<outputProfileList>
    		<outputProfile name="LaTeX=>HTML2" stopOnLatexError="false">
    			<texCommand execute="false" path="" arguments=""/>
    			<bibTexCommand execute="false" path="" arguments=""/>
    			<makeIndexCommand execute="false" path="" arguments=""/>
    			<postProcessors>
    				<processor name="latex2html batch file" path="latex2html.bat" arguments=""%dm" %nm" inputFile="" outputFile=""/>
    			</postProcessors>
    			<viewer path="" closeBeforeCompilation="false">
    				<viewProjectCommand type="commandLine">
    					<commandLineCommand path="" arguments=""/>
    					<ddeCommand path="" server="" topic="System" command=""/>
    				</viewProjectCommand>
    				<viewCurrentFileCommand type="commandLine">
    					<commandLineCommand path="" arguments=""/>
    					<ddeCommand path="" server="" topic="System" command=""/>
    				</viewCurrentFileCommand>
    				<viewCloseCommand type="commandLine">
    					<commandLineCommand path="" arguments=""/>
    					<ddeCommand path="" server="" topic="System" command=""/>
    				</viewCloseCommand>
    			</viewer>
    		</outputProfile>
    	</outputProfileList>
    </txcop:outputProfiles>
  3. if you have tikZ figures put the following in your preamble to convert them to SVG when using tex4ht:

    Code: Select all

    % allow building with htlatex
    \makeatletter
    \@ifpackageloaded{tex4ht}{
    % see:
    % http://tex.stackexchange.com/questions/50853
    % for why we do the following two lines
      \def\headerps@out#1{\special{! #1}}%
      \let\columnlines\empty
      % this last line loads the correct dirver for tikz to produce SVG files
      \def\pgfsysdriver{pgfsys-tex4ht.def}
    }{}
    \makeatother
Post Reply