其他管理Tex选项| .NET的Aspose.TeX

如何设置交互模式

正如我们提到的 此处Aspose.TeX for .NET让我们设置引擎启动的初始交互模式。这是我们的工作方式:

1// How to set the interaction mode
2
3// Create conversion options instance.
4TeXOptions options = TeXOptions.ConsoleAppOptions(TeXConfig.ObjectTeX());
5// ...
6// Set the interaction mode.
7options.Interaction = Interaction.NonstopMode;

如何设置工作名称

当我们将主要输入文件作为文件名传递时,我们将获得具有相同名称的输出文件,尽管其他扩展名。 Tex引擎将输入文件的名称称为 作业名称,并将其用于输出文件,除非在编写具有明确指定其他名称的辅助文件的情况下。当我们以 为单位的主要输入文件时,Tex引擎使用默认的作业名称,即 texput。 在这两种情况下,我们都可以通过分配适当的转换选项来覆盖作业名称。

1// How to set the job name
2
3// Create conversion options instance.
4TeXOptions options = TeXOptions.ConsoleAppOptions(TeXConfig.ObjectTeX());
5// ...
6// Set the job name.
7options.JobName = "my-job-name";
Example-JobName.cs hosted with ❤ by GitHub

如何“停止时间”

乳胶具有从序言中的某些定义中自动生成标题的功能。此标题通常包含当前日期。我们可能希望以一些理想的价值冻结日期。这是可以做到的:

1// How to "stop time"
2
3// Create conversion options instance.
4TeXOptions options = TeXOptions.ConsoleAppOptions(TeXConfig.ObjectTeX());
5// ...
6// Force the TeX engine to output the specified date in the title.
7options.DateTime = new System.DateTime(2022, 12, 18);
Example-DateTime.cs hosted with ❤ by GitHub

如何忽略丢失的软件包

我们可能需要转换一个乳胶文件,该文件引用了.net库Aspose.TeX不支持的某些软件包。在这种情况下,Tex发动机在尝试加载这样的软件包时会出现错误。为了避免这种情况,我们可以使用以下选项:

1// How to "stop time"
2
3// Create conversion options instance.
4TeXOptions options = TeXOptions.ConsoleAppOptions(TeXConfig.ObjectTeX());
5// ...
6// Force the TeX engine to output the specified date in the title.
7options.DateTime = new System.DateTime(2022, 12, 18);
Example-DateTime.cs hosted with ❤ by GitHub

如何避免建立连接

通常,如果字体提供所需的数据,则TEX引擎为某些字符的连接构建。我们可以指示发动机使用以下代码跳过结扎建筑:

1// How to avoid building ligatures
2
3// Create conversion options instance.
4TeXOptions options = TeXOptions.ConsoleAppOptions(TeXConfig.ObjectTeX());
5// ...
6// Set to true to make the engine not construct ligatures where normally it would.
7options.NoLigatures = true;
Example-NoLigatures.cs hosted with ❤ by GitHub

如何重复工作

正如我们已经提到的 上文有关标签和参考文献的情况,在某些情况下,我们想两次运行相同的工作。这是可以做到的:

1// How to repeat the job
2
3// Create conversion options instance.
4TeXOptions options = TeXOptions.ConsoleAppOptions(TeXConfig.ObjectTeX());
5// ...
6// Ask the engine to repeat the job.
7options.Repeat = true;
Example-Repeat.cs hosted with ❤ by GitHub

如何将数学公式转换为栅格图像

有时,我们可能需要将数学公式作为栅格图像,而不是在字体中键入。以下选项可以用于此目的:

 1// How to turn math formulas to raster images
 2
 3// Create conversion options instance.
 4TeXOptions options = TeXOptions.ConsoleAppOptions(TeXConfig.ObjectTeX());
 5// ...
 6// Create and assign saving options instance if needed.
 7options.SaveOptions = new PdfSaveOptions();
 8// ...
 9// Set to true if you want math formulas to be converted to raster images.
10options.SaveOptions.RasterizeFormulas = true;

如何将图形转换为栅格图像

Objecttex引擎允许我们以栅格格式(PNG和JPG)以及PS(EPS)和XPS(OXPS)格式包括图形文件。最后两种格式通常包含向量元素和文本。要使它们栅格化并将其包含在固体图像中,我们可以使用以下选项:

 1// How to turn graphics to raster images
 2
 3// Create conversion options instance.
 4TeXOptions options = TeXOptions.ConsoleAppOptions(TeXConfig.ObjectTeX());
 5// ...
 6// Create and assign saving options instance if needed.
 7options.SaveOptions = new PdfSaveOptions();
 8// ...
 9// Set to true if you want included graphics (if it contains vector elements) to be converted to raster images.
10options.SaveOptions.RasterizeIncludedGraphics = true;

如何子集字体

如果我们想减少输出文件的大小,我们可以求助于字体子集,这意味着输出文档中的字体只会包含有关文档中使用的字形的数据。这是我们可以解决这个问题的方法:

 1// How to subset fonts
 2
 3// Create conversion options instance.
 4TeXOptions options = TeXOptions.ConsoleAppOptions(TeXConfig.ObjectTeX());
 5// ...
 6// Create and assign saving options instance if needed.
 7options.SaveOptions = new PdfSaveOptions();
 8// ...
 9// Set to true to make the device subset fonts used in the document.
10options.SaveOptions.SubsetFonts = true;
Example-SubsetFonts.cs hosted with ❤ by GitHub

Have any questions about Aspose.TeX?



Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.