Many books and journals related to Computer Science, Mathematics, and Engineering are published using TeX. You can create a custom TeX (LaTeX) format and typeset it to different formats like XPS, PDF, or image. Custom TeX is helpful when you need to design many documents in a uniform way. The following sections include further details about creating and typesetting custom TeX format:
- Creating and Typesetting Custom TeX (LaTeX) Format – Java API Installation
- Create a Custom TeX Format Programmatically using Java
- Typeset or Convert Custom TeX (LaTeX) to PDF Programmatically with Java
- Typeset or Convert Custom TeX (LaTeX) to XPS File in Java
- Get Free API License
Creating and Typesetting Custom TeX (LaTeX) Format – Java API Installation
Aspose.TeX for Java has been designed to programmatically work with TeX files. It does not depend on any 3rd party application so you do not need to install or configure any additional software. Simply download the JAR file from the New Releases section, or install it with the following Maven configurations:
Repository
<repositories>
<repository>
<id>snapshots</id>
<name>repo</name>
<url>http://repository.aspose.com/repo/</url>
</repository>
</repositories>
Dependency
<dependencies>
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-tex</artifactId>
<version>21.4</version>
</dependency>
</dependencies>
Create a Custom TeX Format Programmatically using Java
Please follow the steps below for creating a custom TeX format:
- Create typesetting options for no format on ObjectTeX engine extension.
- Specify the file system working directory for input and output.
- Run format creation with createFormat() method.
The following code shows how to create custom TeX (LaTeX) format using Java:
Please notice that the code is using objectIniTeX() method which gets the configuration of the Object TeX engine extension with no preloaded format. This lets you create a custom format from scratch.
Typeset or Convert Custom TeX (LaTeX) to PDF Programmatically with Java
You can typeset or convert custom TeX to PDF with the following steps:
- Create a file system input and output working directory.
- Create a format provider.
- Set typesetting options for a custom format on ObjectTeX engine extension.
- Initialize PdfSaveOptions class object.
- Finally, run typesetting to PDF file with TexJob instance.
The following code explains how to typeset or convert custom TeX (LaTeX) to PDF using Java:
Typeset or Convert Custom TeX (LaTeX) to XPS File with Java
You can convert or typeset custom TeX to XPS with below steps:
- Create a file system input working directory.
- Create a format provider with FormatProvider class.
- Set typesetting options for a custom format on ObjectTeX engine extension.
- Finally, run typesetting by passing XpsDevice as an argument to TexJob instance.
The code below demonstrates how to convert custom TeX to XPS using Java:
Get Free API License
You can test all the features of the API without any limitations by requesting a Free Temporary License.
Conclusion
In this article, you have explored how to create a custom TeX (LaTeX) format programmatically using Java. Moreover, you have also learned how to typeset or convert TeX files to PDF or XPS file format using Java. You can further explore the API Documentation for more details of the API. Please feel free to contact us at the Free Support Forum in case of any queries!