提供主Tex输入文件的其他方法| C ++
Contents
[
Hide
Show
]将主要输入文件作为流提供给Tex引擎
到目前为止,我们只知道如何将 主输入文件传递给TEX引擎作为文件名,无论是完全指定还是简短形式,无论是扩展名还是没有扩展名。但是,“ Texjob”类的另一个 构造函数是第一个参数。如果出于某种原因,我们将主要输入文件中的主要输入文件中的其他形式除外,则很方便。这是可以实施的方式:
1// Create conversion options instance.
2...
3// Create some device.
4...
5// Run LaTeX to XPS conversion.
6System::MakeObject<Aspose::TeX::TeXJob>(System::MakeObject<System::IO::MemoryStream>(System::Text::Encoding::get_ASCII()->GetBytes(
7 u"\\documentclass{article} \\begin{document} Hello, World! \\end{document}")), device, options)->Run();
请注意,所有输出文件都有名称 texput。那是因为引擎在任何地方都无法获得任何其他名称。 texput是默认作业名称。 此处和 此处是有关工作名称的详细信息。
从终端输入主Tex输入文件
“ Texjob”类还有另一个 构造函数,它根本不允许我们指定输入。那么,您可能会想知道什么是这样的TEX工作?这次我们将需要一个输入终端。 Tex发动机将要求我们从终端输入文件名。
这是代码:
1// Create conversion options instance.
2...
3// Run LaTeX to XPS conversion.
4System::MakeObject<Aspose::TeX::TeXJob>(System::MakeObject<XpsDevice>(), options)->Run();
运行后,发动机会粘贴,等待我们输入文件名(有或没有路径,有或没有扩展的情况):
这就是它在输出终端上的外观,即控制台:
1This is ObjectTeX, Version 3.1415926-1.0 (Aspose.TeX 21.8)
2entering extended mode
3**<path_to_the_file>/hello-world.ltx
4(<path_to_the_file>/hello-world.ltx
5LaTeX2e <2011/06/27>
6(article.cls
7Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
8(size10.clo))
9No file hello-world.aux.
10[1]
11(<output_directory>\hello-world.aux) )
12Output written on hello-world.xps (1 page).
13Transcript written on hello-world.log.