Customize input
.NET API Solution to customize TeX input
TeX is known as a machine typesetting language. This means that you do not format your text in the document, but enter plain text containing the text fragments of the document along with commands that control the output. As described in the article TeX I/O of the Documentation, TeX job typically runs on an explicitly specified TeX file. So we include this file in the input of a particular TeX job.
On this page you will find some tips on how to customize the input of TeX source files, taking into account that the main source file should follow TeX syntax and, ideally, contain only commands ‘known’ to the engine. Other files may also be included, such as data files or graphics files.
To customize TeX input we need:
The Aspose.TeX for .NET API which is a feature-rich, powerful, and easy-to-use document manipulation and conversion API for C# platform.
Open the NuGet package manager, search for Aspose.TeX, and install it. You may also use the following command from the Package Manager Console:
Package Manager Console Command
PM> Install-Package Aspose.TeX
Tips on how to customize TeX input C#:
- The TeX engine can access data volumes only as files, which means ‘by name’. Therefore, the part of the TeX input subsystem responsible for feeding automatically processed data provides data volumes in response to queries by name.
- The Aspose.TeX for .NET API defines the IInputWorkingDirectory interface, which includes only one method GetFile(). It is that method that returns ‘files’ by name. In other words, an Input Working Directory is actually a dictionary that maps file names to data volumes.
- Along with the ‘file’, the GetFile() method returns the ‘full name’ of the file within an object of the composite NamedStream class. For example, in the InputFileSystemDirectory implementation, the ‘full name’ is the full path to a requested file on disk that will be written to the transcript (.log) file.
FAQ
1. How do I read input from TeX and LaTeX?
In primitive TeX there are four commands responsible for input from files other than the main input file like \\input <file name>
, \\openin<number>=<file name>
, \\closein<number>
and \\read<number> to <control sequence>
. The first command makes the engine process the file whose name is specified as a parameter. The next two open and close auxiliary data files. And the last one reads a line from an auxiliary file as a list of tokens and assigns this list to a control sequence (or command). In LaTeX, input is easier. Additional files for immediate processing are most often so-called packages, which must be included in a LaTeX file’s preamble using the \\usepackage{<package name>}
command when needed. Auxiliary data input is also most often wrapped in macros provided by specific packages.
2. How to work with TeX input?
To provide TeX input in the most common ways (from files on disk or files packed in a ZIP archive) using the Aspose.TeX API Solution, use classes that implement the IInputWorkingDirectory interface.
3. How to customize TeX input?
To customize TeX input using this API Solution, you need to develop your own implementation of the IInputWorkingDirectory interface and then use it as the value of the InputWorkingDirectory 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.