
おそらく、TikZ を使用した長方形の描画を理解していないのでしょう。以下のコードでは明確な描画が表示されていますが、 と が同じであっても\g
、\w
出力ファイルは間違っています。
\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[czech]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\def \a {3}
\def \w {0.5}
\def \g {0.5}
\def \s14 {0.5}
\def \s34 {0.5}
\filldraw [blue] (0,0) rectangle (\a, \a);
\filldraw [white] (\w,\w) rectangle (\a - \w,\a - \w);
\filldraw [yellow] (0,\a/2 + \g/2) rectangle (\w,\g);
\end{tikzpicture}
\end{document}
出力図面についていくつかメモしました。黄色の領域は不要で、gxw 長方形の位置とサイズが明確に示されています。助けてもらえますか?
答え1
これが欲しいですか?+
Tiに伝えることができますけ2 番目の座標が最初の座標を基準とする Z。
\documentclass[10pt,a4paper]{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\newcommand* \mylengthA {3}
\newcommand* \mylengthW {0.5}
\newcommand* \mylengthG {0.5}
\fill [blue] (0,0) rectangle (\mylengthA, \mylengthA);
\fill [white]
(\mylengthW,\mylengthW) rectangle
(\mylengthA - \mylengthW,\mylengthA - \mylengthW);
\fill [yellow]
(0,\mylengthA/2 + \mylengthG/2) rectangle +(\mylengthW,-\mylengthG);
\end{tikzpicture}
\end{document}
rectangle
指定された 2 つの座標の間に四角形を描画します。指定しない場合は、座標は+
絶対座標とみなされ、相対座標とはみなされません。したがって、\draw (1,1) rectangle (2,2);
2 つのポイントの間に 1cm の長さの辺を持つ四角形を描画します。