
私は TikZ についてごく基本的な知識しかなく、自分の文書の 1 つにきれいなフローチャートを作成するために使用しただけです。最近、Inkscape を使用して TikZ にエクスポートできることを知りました。
Inkscape->TikZ ワークフローの制限は何ですか? Inkscape から TikZ に単純にエクスポートするのではなく、時間をかけて TikZ (かなり急な学習曲線があると聞いています) を学習する説得力のある理由はありますか?
答え1
編集:@XiaodongQiは以下にコメントしています
同じオプションは、Inkscape の新しいバージョンでは利用できなくなりました。ただし、PDF を保存するときには同様のオプションがあります。
Inkscape の図を PDF として保存し、 を使用してドキュメントに挿入できます\includegraphics
。図にテキストが含まれている場合は、Inkscape の [PDF として保存] メニューから [PDF+LaTeX] オプションを選択できます。これにより、代わりに pdf_tex ファイルが作成されます。\input
そのファイルを使用すると、TeX がタイプセットを行います。
inkscape の場合:
PDF として保存を選択した後、Inkscape から保存します。Inkscape はファイルを書き込みますtopview.pdf_tex
:
文書内:
\begin{figure}[h]
\centering{
\resizebox{75mm}{!}{\input{images/topview.pdf_tex}}
\caption{Top view.}
\label{fig:topView}
}
\end{figure}
出力:
これは明らかに tikz で描画できる画像ですが、@HarishKumar への返信で説明されている理由 (tikz の学習曲線が長いことと、たまに使用する場合は wysiwyg を好むこと) により、tikz で描画しないことを選択しました。正確な配置 (線が実際に角で交わる) が必要な場合は、inkscape のスナップ機能を使用して実行できる可能性があります。私はまだそれらを試していません。
答え2
エクスポート後 (Ethan Bolker による説明)、次のスニペットを使用して Inscape によって生成されたイメージを埋め込みます。
\begin{figure}
\def\svgwidth{\linewidth}
\input{img/filename.pdf_tex}
\caption{}
\end{figure}
will\def\svgwidth{desired width}
の代わりに使用する\resizebox
フォントサイズを維持するこれは生成されたファイルの先頭に記載されている推奨方法です。
%% Creator: Inkscape 0.91_64bit, www.inkscape.org
%% PDF/EPS/PS + LaTeX output extension by Johan Engelen, 2010
%% Accompanies image file '_masks.pdf' (pdf, eps, ps)
%%
%% To include the image in your LaTeX document, write
%% \input{<filename>.pdf_tex}
%% instead of
%% \includegraphics{<filename>.pdf}
%% To scale the image, write
%% \def\svgwidth{<desired width>}
%% \input{<filename>.pdf_tex}
%% instead of
%% \includegraphics[width=<desired width>]{<filename>.pdf}
%%
%% Images with a different path to the parent latex file can
%% be accessed with the `import' package (which may need to be
%% installed) using
%% \usepackage{import}
%% in the preamble, and then including the image with
%% \import{<path to file>}{<filename>.pdf_tex}
%% Alternatively, one can specify
%% \graphicspath{{<path to file>/}}
%%
%% For more information, please see info/svg-inkscape on CTAN:
%% http://tug.ctan.org/tex-archive/info/svg-inkscape
%%
答え3
もう一つの選択肢として、ツールがあるSVG2TikZ(以前は Inkscape2TikZ) を使用して、TikZ コードを生成することができます。
GitHub リポジトリから Python パッケージをインストールすると、次のように TikZ を使用して SVG (Inkscape からエクスポート可能) を TeX ソース コードに変換できます。
svg2tikz a.svg > a.tex
Inkscape 拡張機能としてインストールすることもできます。