Implement custom TeX output

C++ API Solution to customize TeX output

 

TeX is known as a machine typesetting system that deals with programs written in the TeX language. Instead of formatting your text directly in the document, users write programs containing text fragments of the document along with commands controlling the output.

The documentation article TeX I/O explains that a TeX job typically produces a main output file containing the resulting document and a transcript (or log) file.

Within the Aspose.TeX API, there are built-in TeX output implementations for saving files to the local file system to a ZIP archive.

On this page, we advice on how to create your own implementation of TeX job output. To customize TeX output, we need:

  • The Aspose.TeX for C++ API, - a feature-rich, powerful, and easy-to-use document processing and conversion API for the C++ platform.
  • Open the NuGet package manager, and search for Aspose.TeX.Cpp and then install it. You may also use the following command from the Package Manager Console:

Package Manager Console Command

PM> Install-Package Aspose.TeX.Cpp

Tips on how to customize TeX output C++:

  1. The TeX engine refers to data volumes as files, which means “by name”. Therefore, the TeX output subsystem provides data “slots” in response to queries by name. TeX writes its output data to these data “slots”.
  2. The Aspose.TeX for C++ API introduces the IOutputWorkingDirectory interface, which declares a single GetOutputFile() Method providing data “slots” by name. In other words, the Output Working Directory is essentially a dictionary that associates file names with data “slots”. Note that TeX may write a file and subsequently read it. To accommodate this, IOutputWorkingDirectory extends the IInputWorkingDirectory interface.
  3. Along with the ‘file’, the GetOutputFile() method returns (within an instance of the composite NamedStream class) the ‘full name’ of the file, which may be required in your custom implementations of the interface.



FAQ

1. How do I write output from TeX and LaTeX?

In primitive TeX there are three commands responsible for outputting to files other than the main output file: \openout<number>=<file name>, \closeout<number>, and \write<number>{<token list>}. The first two commands open and close auxiliary files for writing, while the last one writes a list of tokens (which may constitute some text, for example) as a line of text. In LaTeX, such output to auxiliary files is typically hidden from the user within LaTeX itself or within packages.

2. How to work with TeX output?

To obtain TeX output in the most common ways (as files on disk or files packed in a ZIP archive) using the Aspose.TeX API Solution, use classes that implement the IOutputWorkingDirectory interface.

3. How do I view LaTeX output?

To view TeX/LaTeX files online there are free Viewer applications. With them, all you have to do is upload TeX/LaTeX files and in a moment get the result on the screen.

4. How to customize TeX output?

To customize TeX output using this API Solution, you need to develop your own implementation of the IOutputWorkingDirectory interface and then use it as the value of the OutputWorkingDirectory property in TeX job options.

TeX What is TeX File Format

TeX is not actually a format. It is both a programming language and also an interpreter engine that understands this language. A TeX file is a plain text file created using TeX syntax to be converted to some target format by being processed by a TeX engine. This output document may include graphics, tables, lists, formulas, and equations.