1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

TikZで図を描く 忘れないようにメモ書き-間違っているかもしれません

Last updated at Posted at 2019-12-07

図形の角度記号 -anglesライブラリを使う

\documentclass[12pt,dvipdfmx]{jsarticle}
\usepackage{tikz}
\usetikzlibrary{angles,quotes}
\begin{tikzpicture}
\coordinate(A) at(0,0);
\coordinate(B) at(3,0);
\coordinate(C) at(1.5,2.5);
\pic [draw=black, angle eccentricity=1.8, angle radius=1cm, "$\theta$"] {angle=B--A--C};
\end{tikzpicture}
  • draw=black :色を設定
  • angle eccentricity:挿入したい文字列の位置決定
  • angle radius:角度の弧の半径
  • "文字列":文字列を入れる

よくわからないが\usetikzlibrary{quotes}がないと,"文字列"の部分でエラーが出た。

交点に文字列を配置

\documentclass[12pt,dvipdfmx]{standalone}
\usepackage{tikz}
\usetikzlibrary{patterns,intersections,calc,angles,quotes}

\begin{document}
\begin{tikzpicture}
    \draw [name path=xaxis,->](-0.5,0)--(3,0);
    \draw [name path=yaxis,->](0,-0.5)--(0,3);
    \node [anchor=south] at(0,3) {$y$};
    \node [anchor=west] at(3,0) {$x$};
    \path [name intersections={of=xaxis and yaxis,by=in}];
    \coordinate (O) at(in);     %x軸とy軸の交点をOとする
    \node [anchor=north east] at(O) {O};
    \draw [name path=la, domain=-0.5:2] plot(\x,\x+1);
    \draw [name path=lb, domain=-0.5:2.3] plot(\x,-\x+2);
    \path [name intersections={of=la and lb,by=in2}]; %laとlbの交点をin2とする
    \node [anchor=west] at(in2) {A};  %in2にAという文字列を配置
\end{tikzpicture}
\end{document}
  • name path=名前:描画したものに,名前を付ける
  • \path[name intersections={of= 図形1and 図形2,by=NAME}];:図形1と図形2の交点を計算させ,その交点にNAMEという名前を付ける

交点-1.jpg

参照:TikZ & PGF manual (version 3.0.1a)

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?