tikzのサンプル

tikzを使う目的はスクリーンショット画像へのマークアップ。

単純な描画

\draw[thick,rounded corners=8pt] (0,0)--(0,2)--(1,3.25)--(2,2)--(2,0)--(0,2)--(2,2)--(0,0)--(2,0);

画像ファイルの読み込み

既存の画像を読み込むには、フルパスを指定する必要がある。

フルパスの指定は、以下の手順。

  1. オプション”:stringsubst:”を指定する文字列の置き換えを行う宣言をする。
  2. “Makefile”があるディレクトリまでを、文字列”$wd”で示す。

\node {\includegraphics[width=10cm]{$wd/source/xcode01.png}};

\node[anchor=south west] (image) at (0,0) {\includegraphics[width=10cm]{$wd/source/xcode01.png}};
\draw[step=1,lightgray] (0,0) grid (image.north east);
\draw[step=10,gray] (0,0) grid (image.north east);

\node[anchor=south west] (image) at (0,0) {\includegraphics[width=10cm]{$wd/source/xcode01.png}};
%\draw[step=1,lightgray] (0,0) grid (image.north east);
%\draw[step=10,gray] (0,0) grid (image.north east);
\markUpBox{0.5cm, 0.7cm}{2.2cm,5.7cm}{A};
\markUpBox{8.0cm, 0.7cm}{9.7cm,5.7cm}{B};
\markUpBox{2.5cm, 0.7cm}{7.5cm,5.7cm}{C};