1 User documentation

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):

inputFileName
Path of the LaTeX-file to convert.
outputFileName
Path of the output file.
outputFormatName
The format of the output file. Currently the following values are possible:
html
Output as HTML-document.
xdoc
Output as XDoc-document-
wiki_wicked
Output as Horde's Wicked Wiki format.
localeCode
ISO(639-2) 3-letter code of language which should be used for localized strings. This affects some titles (e.g. of Bibliography, Glossary) and captions. This parameter is optional, if omitted the system locale will be used. Currently available locales are:
eng
english
deu
german

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:

propertiesFile
Path of a Java properties file, which defines one or more conversion tasks. If this variable is set, all the parameters mentioned above will be ignored. The format of the file is described in the following section.

And one last property, which is independent of the others:

verbose
Controls how verbose the output will be. If this is not set, only errors and warnings will be logged by default, otherwise also informational things.

1.1 Defining conversion tasks in a Java properties file

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


1.2 Usage as plain Java object

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);



Listing 1: Calling the TeXConverter as a Java object

or like this, using a properties file:
 


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);



Listing 2: Calling the TeXConverter as a Java object

1.3 Usage as Maven-goal

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>



Listing 3: Calling the TexConverter as Maven-goal

1.4 Usage as Ant-Task

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>



Listing 4: Using the TexConverter as Ant-task



The Ant-task takes the same parameters as the Maven-plugin. The following dependencies must be available in the Ant-Classpath:
  • commons-cli-1.0
  • commons-collections-3.1
  • commons-io-1.1
  • commons-lang-2.1
  • commons-logging-1.0.4
  • log4j-1.2.13
  • velocity-1.4

1.5 Usage from commandline

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:

-i
The TeX input file (inputFileName)
-o
The output file (outputFileName)
-f
The output format (outputFormatName)
-l
The ISO 3-letter language code (localeCode)
-p
The properties file (propertiesFile)
-v
verbose mode