ラテックスグラフィックス| \ includegraphicsコマンド
実際、LaTexグラフィックスには言及する価値がある2つの側面があります。
- ラテックス/Texコマンドによって直接記述されたベクトルグラフィックスと
- EPS、PDF、またはラスターPNG、PDFなどの外部形式によって記述された外部グラフィックを含める。
前者は、元のラテックスとそのパッケージでのサポートが限られています。 Texの垂直および水平方向のルールの助けを借りて実装されています。これは、元のラテックスが元のTexエンジンに基づいているためです。これは、 * dvi *形式でメイン出力を生成します。しかし、グラフィックスサポート形式(PDFTEXからPDFなど)に出力できるエンジンは、形式に依存したパッケージまたはパッケージ機能を使用してグラフィックを扱うこともできます。後者のグラフィックは、同じ理由で基本的なラテックスではサポートされていません。グラフィックインクルージョン機能については、以下で説明します。
ラテックス「グラフィックス」パッケージと \ includegraphics
コマンド
ラテックスグラフィックスの包含について話すとき、最初に思い浮かぶのは「includegraphics」コマンドです。 「グラフィックス」パッケージで定義されています。これは、その機能を有効にするために前文で言及する必要があります。
1\usepackage{graphics}
タイプセットシステムがデフォルトでPDFTEXを使用するように構成されていない場合、パッケージに必要な「ドライバー」ファイルを使用するように強制する適切なオプションを指定する必要があります。
1\usepackage[pdftex]{graphics}
「ドライバー」ファイルは、パッケージコマンドとフォーマット依存の低レベルTex拡張プリミティブとの間のインターフェイスを実装するパッケージの一部です。 Aspose.TeXのLaTexグラフィックサポートは、独自のドライバーを使用するように構成されているため、ドライバーオプションを指定する必要はありません。
これで、たとえば、PNG画像を含める最も簡単な方法は、次のように入力することです。
1\includegraphics{sample-image.png}
ここで、 sample-image.png
は、含めるファイルの名前です。拡張機能を編集することもできます。 「グラフィック」パッケージには、サポートされている形式の定義のリストが含まれています。ファイルを探すとき、それはそのリストを通過し、見つかった最初の一致するファイルを含みます。
絶対的または相対パスを使用して、完全なファイル名を指定することもできます。
1\includegraphics{d:/sample-image.png} % absolute path
2\includegraphics{./sample-image.png} % relative to the current directory
3\includegraphics{../img/sample-image.png} % relative to the directory containing the current one
グラフィック ファイルの場所を指定する別の方法は、\includegraphics
を呼び出す前に \graphicspath
コマンドを使用して代替パスのリストを定義することです。
1\graphicspath{{d:/img}{c:/img}{d:/work/img}}
グラフィックスのスケーリング
LaTeXのgraphics
パッケージは、コンテンツを操作するためのコマンドを提供します。そのため、以下のようにして、含まれるグラフィック(実際にはTeX/LaTeXコードで記述されたあらゆるもの)を拡大縮小できます。
1\scalebox{.5}{\includegraphics{sample-image.png}} % scales both width and height by 0.5
2\scalebox{.5}[1.5]{\includegraphics{sample-image.png}} % scales the width and height by 0.5 and 1.5 respectively
グラフィックのサイズ変更
スケーリングに似ていますが、スケーリングファクターの代わりに必要なサイズを指定します。
1\resizebox{10mm}{!}{\includegraphics{sample-image.png}} % changes the width to 10mm preserving the proprtions
2\resizebox{20mm}{10mm}{\includegraphics{sample-image.png}} % changes both width and height independently
グラフィックスの回転
1\rotatebox{25}{\includegraphics{sample-image.png}} % rotates the image by 25 degrees counterclockwise
ラテックスgraphicx
パッケージ
LaTeXのgraphicx
パッケージは、コンテンツ変換のためのkey=value
インターフェースを提供します。この機能を有効にするには、プリアンブルで次のように記述する必要があります。
1\usepackage{graphicx}
2\usepackage[pdftex]{graphicx} % with the driver option
次のオプションのいずれかを組み合わせることができますが、順序が重要であることに留意してください。
グラフィックビューポート
1\includegraphics[viewport=10 10 280 220]{sample-image.png} % sets the viewport with the lower left corner
2 % at the point (10, 10) (coinsides with (0, 0)
3 % of the box) and dimensions 280x220pt
4\includegraphics[viewport=10 10 250 220,clip]{sample-image.png} % the same, but the image is clipped by the viewport
グラフィックスのスケーリング
1\includegraphics[scale=.5]{sample-image.png} % scales both width and height by 0.5
グラフィックスのサイズ変更
1\includegraphics[width=15mm]{sample-image.png} % changes the width to 15mm preserving the proprtions
2\includegraphics[height=15mm,width=25mm]{sample-image.png} % changes both width and height independently
グラフィックスの回転
1\includegraphics[angle=10]{sample-image.png} % rotates the image by 10 degrees counterclockwise
「グラフィック」パッケージバンドル機能の詳細については、ドキュメント こちらを参照してください。 ここ。
.NET APIのAspose.TeXに基づいて構築されたフリーコンバージョン Webアプリをチェックアウトすることもできます。