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"
「停止時間」
Preambleで特定の定義からタイトルを自動的に生成するために、LaTexは通常、現在の日付を含む機能を提供します。ただし、日付を特定の値に修正するインスタンスがある場合があります。これを実現する方法は次のとおりです。
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 ライブラリの Aspose.TeXによってサポートされていないパッケージへの参照を含むラテックスファイルがある場合、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
仕事を繰り返します
LaTex入力ファイルの段落、ラベル、参考文献で述べたように、同じジョブを2回実行する必要がある状況があります。これを達成する方法は次のとおりです。
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)形式などのラスター形式のグラフィックファイルを含める機能を提供します。後者の2つの形式には、通常、ベクトル要素とテキストが含まれています。ラスター化して固体画像として含める場合は、次のオプションを利用できます。
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