HOWTO: use LaTeX equations in other software (LaTeX2EPS)

One possible solution to use LaTeX equation in other software is to create an EPS document with your equation.
I will explain how you can do this in Windows.

Let's create TeX file with name equation.tex:
\documentclass{minimal}

\begin{document}
$a = b \div c$
\end{document}

You can use additional packages in this document. As well as commands like \newcommand that could help you to shorten your equation writing.

Now there are two options to proceed.

You can use file dvi2eps.cmd
@echo off
SET USAGE=Usage: dvi2eps.cmd file_to_process
IF "%1" == "" (
 ECHO %USAGE%
 EXIT
)
echo Converting DVI to EPS
dvips -E -o "%~d1%~p1%~n1.eps" "%~dpnx1"

to process single .dvi file in command line. Save this file somewhere within PATH and run
> dvi2eps.cmd equation.dvi

Script creates file equation.eps in the same directory as equation.dvi.

Or you can setup a TeXnicCenter to output EPS files.

  1. Save following text as file with .tco extension:
    <?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=>DVI=>EPS" stopOnLatexError="false">
       <texCommand execute="true" path="latex.exe" arguments="--src -interaction=nonstopmode "%Wm""/>
       <bibTexCommand execute="false" path="" arguments=""/>
       <makeIndexCommand execute="false" path="" arguments=""/>
       <postProcessors>
        <processor name="DviPs (EPS)" path="dvips.exe" arguments="-E -o "%Bm.eps" "%bm.dvi"" 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>

  2. Open TeXniCenter editor and go to the menu Build->Define Output Profiles...

  3. Import file that you have created.

  4. Adjust paths for LaTeX and DviPs executables.

1 comment:

Fiona said...

Hello there,

Thanks for this script, which will be very helpful once I get it running.

However when I went to import it into TeXnicCenter, an error message was displayed:

Error 0xc00ce509: Required white space was missing.

Line: 5
Character: 91
<
texCommand execute="true" path="latex.exe" arguments="--src -interaction=nonstopmode "%Wm""
\>
Character 91 corresponds to the final quotation mark.I've tried simply adding a space before or after that quotation mark, but that didn't help.

Any suggestions gratefully received. Thanks in advance for your help.

Labels