其他管理Tex选项| Python

设置交互模式

在TEX交互中中提到的,aspose.tex for Python提供了设置发动机启动的初始交互模式的能力。这是如何完成的示例:

1# Create conversion options instance.
2...
3# Set interaction mode.
4options.interaction = Interaction.NONSTOP_MODE

设置作业名称

当将主要输入文件作为文件名提供时,结果输出文件将具有相同的名称,但具有不同的扩展名。 TEX引擎将输入文件的名称称为 作业名称,并将其用于输出文件。例外是具有明确指定文件名的辅助文件。但是,当主输入文件以 为单位传递时,Tex引擎使用默认作业名称,即 texput。在这两种情况下,都可以通过分配适当的转换选项来覆盖作业名称。

1# Create conversion options instance.
2...
3# Set the job name.
4options.job_name = "my-job-name"

“停止时间”

要自动从序言中的某些定义中生成标题,乳胶提供了一个通常包括当前日期的功能。但是,在某些情况下,我们需要将日期修复到特定值。这是一种实现这一目标的方法:

1# Create conversion options instance.
2...
3# Force the TeX engine to output the specified date in the title.
4options.date_time = datetime(2022, 12, 18)

忽略丢失的软件包

如果我们有一个乳胶文件,其中包括对Python **库不支持的软件包的引用,则TEX引擎将遇到错误并在尝试加载这些软件包时停止。为了防止这种情况,我们可以利用以下选项:

1# Create conversion options instance.
2...
3# Set to true to make the engine skip missing packages (when your file references one) without errors.
4options.ignore_missing_packages = True

如何避免建立连接

默认情况下,如果字体包含必要的数据,则TEX发动机为特定字符对构建了连接。但是,我们可以指示发动机使用以下代码绕过结扎的结构:

1# Create conversion options instance.
2...
3# Set to true to make the engine not construct ligatures where normally it would.
4options.no_ligatures = True

重复工作

乳胶输入文件段落,标签和参考,在某些情况下,我们可能需要两次运行同一作业。这是一种实现这一目标的方法:

1# Create conversion options instance.
2...
3# Ask the engine to repeat the job.
4options.repeat = True

将数学公式变成栅格图像

如果需要将数学公式转换为栅格图像而不是使用字体渲染,则可以将以下选项用于此目的:

1# Create conversion options instance.
2...
3# Create and assign saving options instance if needed.
4...
5# Set to true if you want math formulas to be converted to raster images.
6so.rasterize_formulas = True

将图形变成栅格图像

Objecttex引擎提供了以栅格格式(例如PNG和JPG)以及PS(EPS)和XPS(OXPS)格式包含图形文件的功能。后两种格式通常包含向量元素和文本。如果我们想将它们栅格化并将其包含在固体图像中,我们可以使用以下选项:

1# Create conversion options instance.
2...
3# Create and assign saving options instance if needed.
4...
5# Set to true if you want included graphics (if it contains vector elements) to be converted to raster images.
6so.rasterize_included_graphics = True

子集字体

如果我们希望减少输出文件的大小,我们可以采用字体子集,而字体子集需要结果文档中的字体将不包括文档中不存在的字形的数据。这是实现这一目标的解决方案:

1# Create conversion options instance.
2...
3# Create and assign saving options instance if needed.
4...
5# Set to true to make the device subset fonts used in the document.
6so.subset_fonts = True

Have any questions about Aspose.TeX?



Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.