我正在尝试标记直角三角形中的两个角度,并从这篇文章中获取以下代码关联。此代码中仅标明了直角。查看了有关该主题的几篇帖子,我无法标明其他两个角。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}[scale=1.25]
\coordinate [label=left:$C$] (A) at (-1.5cm,-1.cm);
\coordinate [label=right:$A$] (C) at (1.5cm,-1.0cm);
\coordinate [label=above:$B$] (B) at (1.5cm,1.0cm);
\draw
(A) --
node[above] {$a$} (B) --
node[right] {$c$} (C) --
node[below] {$b$} (A);
\draw
(1.25cm,-1.0cm) rectangle (1.5cm,-0.75cm);
\tkzMarkAngle[size=1cm,color=cyan,mark=|](C,A,B);% gives error :undefined control sequence
\end{tikzpicture}
\end{document}
从手册中学习很难,除非一个人已经知道很多。如果有人能帮我添加标记这个三角形两侧的线条,我将不胜感激。这将对我有很大的帮助。节日问候。
感谢大家花费宝贵的时间和精力来研究我的问题。由于无法避免使用 tikz-euclid,我通过 geogebra 找到了我想要的东西,附件如下 和代码(以防对其他人有用)
\documentclass[10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{pgf,tikz}
\usepackage{mathrsfs}
\usetikzlibrary{arrows}
\pagestyle{empty}
\begin{document}
\definecolor{qqwuqq}{rgb}{0.,0.39215686274509803,0.}
\definecolor{uuuuuu}
{rgb}{0.26666666666666666,0.26666666666666666,0.26666666666666666}
\definecolor{qqqqff}{rgb}{0.,0.,1.}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle
45,x=1.0cm,y=1.0cm]
\draw[color=black] (-4.,0.) -- (0.,0.);
draw[color=black] (0.,0.) -- (0.,3.);
\clip(-4.,-0.4) rectangle (0.4,3.4);
\draw [shift={(-4.,0.)},color=qqwuqq,fill=qqwuqq,fill opacity=0.1] (0,0) -- (0.:0.6) arc (0.:36.86989764584402:0.6) -- cycle;
\draw[color=qqwuqq,fill=qqwuqq,fill opacity=0.1] (0.,0.4242640687119284) -- (-0.4242640687119284,0.42426406871192845) -- (-0.4242640687119284,0.) -- (0.,0.) -- cycle;
\draw (0.,3.)-- (-4.,0.);
\draw (-4.,0.)-- (0.,0.);
\draw (0.,0.)-- (0.,3.);
\draw[color=qqwuqq] (-3.58,0.16) node {$\theta$};
\draw[color=qqwuqq] (0.34,0.33);
\end{tikzpicture}
\end{document}
非常感谢
答案1
您快完成了。您只需添加
\usepackage{tkz-euclide}
\usetkzobj{all}
回到序言。
\documentclass[border=10pt,tikz]{standalone}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
\begin{tikzpicture}[scale=1.25]
\coordinate [label=left:$C$] (C) at (-1.5cm,-1.cm);
\coordinate [label=right:$A$] (A) at (1.5cm,-1.0cm);
\coordinate [label=above:$B$] (B) at (1.5cm,1.0cm);
\draw (C) -- node[above] {$a$} (B) -- node[right] {$c$} (A) -- node[below] {$b$} (C);
\draw (1.25cm,-1.0cm) rectangle (1.5cm,-0.75cm);
\tkzMarkAngle[size=1cm,color=cyan,mark=|](A,C,B)
\tkzMarkAngle[size=1cm,color=cyan,mark=|](C,B,A)
\end{tikzpicture}
\end{document}
编辑
你在评论中提到想要避免tkz-euclide
。我实际上只使用了它,因为你发布的代码最初需要它。如果你想使用普通的 Ti 标记角度钾Z(只要有这样的东西),您可以使用angles
和quotes
库,它们是 PGF/Ti 的一部分钾Z 本身。
例如:
\documentclass[border=10pt,tikz]{standalone}
\usetikzlibrary{angles,quotes}
\begin{document}
\begin{tikzpicture}[
my angle/.style={
every pic quotes/.append style={text=cyan},
draw=cyan,
angle radius=1cm,
}]
\coordinate [label=left:$C$] (C) at (-1.5,-1);
\coordinate [label=right:$A$] (A) at (1.5,-1);
\coordinate [label=above:$B$] (B) at (1.5,1);
\draw (C) -- node[above] {$a$} (B) -- node[right] {$c$} (A) -- node[below] {$b$} (C);
\draw (A) +(-.25,0) |- +(0,.25);
\pic [my angle, "$\alpha$"] {angle=A--C--B};
\pic [my angle, "$\beta$"] {angle=C--B--A};
\end{tikzpicture}
\end{document}
答案2
PSTricks 解决方案使用pst-eucl
包裹:
\documentclass{article}
\usepackage{pst-eucl}
\newcommand*\Label[3]{%
\pcline[linestyle = none, offset = 6pt](#1)(#2)
\ncput{#3}}
\begin{document}
\begin{pspicture}(-0.43,-0.35)(5.35,3.4) % boundry found manually
\pstTriangle[PointSymbol = none](0,0){A}(5,3){B}(5,0){C}
\pstRightAngle{B}{C}{A}
\pstMarkAngle[LabelSep = 0.6]{C}{A}{B}{$\alpha$}
\pstMarkAngle[LabelSep = 0.67]{A}{B}{C}{$\beta$}
\Label{A}{B}{$c$}
\Label{B}{C}{$a$}
\Label{C}{A}{$b$}
\end{pspicture}
\end{document}
答案3
现在是正确的,没有错误!
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{tkz-euclide}
\usetkzobj{all}
\usepackage{etoolbox}
\makeatletter
\begin{document}
\begin{tikzpicture}[scale=1.25]
\coordinate [label=left:$C$] (A) at (-1.5cm,-1.cm);
\coordinate [label=right:$A$] (C) at (1.5cm,-1.0cm);
\coordinate [label=above:$B$] (B) at (1.5cm,1.0cm);
\draw
(A) --
node[above] {$a$} (B) --
node[right] {$c$} (C) --
node[below] {$b$} (A);
\draw
(1.25cm,-1.0cm) rectangle (1.5cm,-0.75cm);
\tkzMarkAngle[size=1cm,color=cyan,mark=|](C,A,B);
\end{tikzpicture}
\end{document}
对于第二个问题,您可以使用网格。
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{arrows}
\begin{document}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle
45,x=1.0cm,y=1.0cm]
\draw[step=1cm,gray,very thin] (-4,-4) grid (4,4);
\draw[color=black] (-4.,0.) -- (0.,0.);
draw[color=black] (0.,0.) -- (0.,3.);
\clip(-4.,-0.4) rectangle (0.4,3.4);
\draw [shift={(-4.,0.)},color=gray,fill=darkgray,fill opacity=0.1] (0,0) -- (0.:0.6) arc (0.:36.9:0.6) -- cycle;
\draw[color=gray,fill=darkgray,fill opacity=0.1] (0.,0.42) -- (-0.42,0.42) -- (-0.42,0.) -- (0.,0.) -- cycle;
\draw (0.,3.)-- (-4.,0.);
\draw (-4.,0.)-- (0.,0.);
\draw (0.,0.)-- (0.,3.);
\draw[color=gray] (-3.2,0.4) node {\large $\theta$};
\draw[color=gray] (0.34,0.33);
\end{tikzpicture}
\end{document}