The TeXConverter can be used as a plain Java object, a Maven plugin, a commandline application and an Ant task. The following parameters must/can be set before starting a conversion task (how these parameters are passed depends on the distribution, and is described in the appropriate following sections):
One form of passing these parameters is via a Java properties file, which has the added benefit of being able to hold several conversion tasks. The location of the properties file can be passed to the converter as an alternative stand-alone argument:
And one last property, which is independent of the others:
The Java properties file must contain a property named "texconverter.projects", to which a comma-separated list of names is assigned. Assign one name for each conversion task you have. For each of these names/tasks you now have to define the properties of that task. Use the names of the task properties ("inputFileName", etc), and prepend the task name followed by a ".". An example:
texconverter.projects=a,b a.inputFileName=texdocs/DocumentA.tex a.outputFileName=texdocs/DocumentA.out.xml a.outputFormatName=xdoc a.localeCode=eng b.inputFileName=texdocs/DocumentB.tex b.outputFileName=texdocs/DocumentB.out.html b.outputFormatName=html b.localeCode=deu b.verbose=true
Calling the TeXConverter as a Java object looks like this:
String inputFileName = "texdocs/usage.tex"; String outputFileName = "site/xdocs/index.xml"; String outputFormatName = "TexConverter.OUTPUTFORMATS.XDOC.name()"; String localeCode = "eng"; boolean verbose = false; //folder where texconverter looks for resources String texConverterBaseFolder = "."; TexConverter converter = new TexConverter(); converter.init(texConverterBaseFolder, verbose) converter.startConversion(null, inputFileName, outputFileName, outputFormatName, localeCode);
String propertiesFile = "texdocs/texconvert.properties" boolean verbose = false; //folder where texconverter looks for resources String texConverterBaseFolder = "."; TexConverter converter = new TexConverter(); converter.init(texConverterBaseFolder, verbose); converter.startConversion(propertiesFile, null, null, null, null);
The TeXConverter -project must first be installed as a Maven-plugin (either by copying the compiled plugin into your Maven plugins directory, or by executing the Maven-goal plugin:install on this project). The parameters for a conversion are passed as Maven properties (see properties). Example:
<preGoal name="site">
<attainGoal name="texconverter:renderTex">
<j:set var="texconverter.inputFileName" value="texdocs/description.tex"/>
<j:set var="texconverter.outputFileName" value="site/xdocs/index.xml"/>
<j:set var="texconverter.outputFormatName" value="xdoc"/>
<j:set var="texconverter.localeCode" value="eng"/>
<j:set var="texconverter.verbose" value="true"/>
</attainGoal>
</preGoal>
An Ant target could look like this (the path c:/TexConverterAnt/ must be replaced with the location of your TeXConverter -Ant-Build):
<target name="texconvert"> <taskdef name="texconverttask" classname="org.texconverter.TexConverterAnt" classpath="C:/TexConverterAnt/texconverter-plugin-#.#.#.jar" /> <texconverttask inputFileName="docs/technical/technicalDocumentation.tex" outputFileName="target/docs/technicalDocumentation.xml" outputFormatName="xdoc" localeCode="eng" verbose="true" /> </target>
The commandline version is started via the start script texconverter (on windows machines this is a batch file, for unix machines this is a shell script). If the start script is started without any parameters, usage instructions are displayed. The following parameters can be passed: