Below is a solution using tkz-euclide
(as Regis da Silva mentioned in a comment that I only now saw).
Edit: I've changed it slightly. Here you can change the size of the square simply by changing the position of point B
. The reason that I didn't use tkzDrawPolygon
to draw the triangle, is that the corners would extend a little outside the rectangle. Uncomment that line to see what I mean. Also, if the position of B
is (1,0)
the arc showing the angle is too large, and then you will want to uncomment the line size=0.4
.
\documentclass{article}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
\begin{tikzpicture}
\tkzDefPoint(0,0){A} \tkzLabelPoint[below left](A){A}
\tkzDefPoint(3,0){B} \tkzLabelPoint[below right](B){B}
\tkzDefSquare(A,B) \tkzGetPoints{C}{D}
\tkzDrawSquare(A,B)
\tkzLabelPoint[above right](C){C} \tkzLabelPoint[above left](D){D}
\tkzDefMidPoint(C,D) \tkzGetPoint{E} \tkzLabelPoint[above](E){E}
\tkzDefMidPoint(B,C) \tkzGetPoint{F} \tkzLabelPoint[right](F){F}
\tkzDrawSegments(A,E E,F A,F)
%\tkzDrawPolygon(A,E,F)
\tkzDrawPoints[fill=black](E,F)
\tkzMarkAngle[fill=red,%
%size=0.4, % for small squares you may want to use this
opacity=0.4](F,A,E)
\tkzLabelAngle[pos=1.2](E,A,F){$\alpha$}
\end{tikzpicture}
\end{document}
The problem with this package is that the manual is only in French, as far as I know.
You can mix this with normal TikZ, code, so wh1t3's code can be modified slightly, using tkz-euclide
to draw the arc.
Note that instead of using \textcolor
for all the labels, you can edit the every label
style. The updated example shows this, as well as how to change the color of a single label (note the extra set of braces).
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
\noindent
\begin{tikzpicture}[scale=3,every label/.style={color=blue}]
\coordinate [label=left:$A$] (A) at (0,0);
\coordinate [label=right:$B$] (B) at (1,0);
\coordinate [label=right:$C$] (C) at (1,1);
\coordinate [label=left:$D$] (D) at (0,1);
\coordinate [label=above:$E$] (E) at ($(D)!.5!(C)$);
\coordinate [label={[black]right:$F$}] (F) at ($(B)!.5!(C)$);
\draw (A) rectangle (C);
\draw [fill] (A) -- (E) circle[radius=.5pt]
-- (F) circle[radius=.5pt] -- (A);
\tkzMarkAngle[fill=red,opacity=.5,size=.3](F,A,E)
\tkzLabelAngle[pos=.4](E,A,F){$\alpha$}
\end{tikzpicture}
\end{document}
While tikz
can do basic graphs, you should use pgfplots
for graphing:
As hpesoj626 commented, sometimes it is better to have the axis lines in the middle. This also shows some of the other options that pgfplots
provides:
Code:
\documentclass[border=2pt]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}[scale=1.0]
\begin{axis}
\addplot[domain=-10000:10000, blue, ultra thick] {14*x - x^2};
\end{axis}
\end{tikzpicture}
\end{document}
Code:
\documentclass[border=2pt]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
axis x line=middle,
axis y line=middle,
ymax=0.1E8, ylabel=$y$,
xlabel=$x$
]
\addplot[domain=-10000:10000, blue, ultra thick] {14*x - x^2};
\end{axis}
\end{tikzpicture}
\end{document}
Best Answer
For the first answer, the TikZ documentation could be a good starting point, specially the Tutorials section. The link in the comments provides a lot of interesting resources too. And there are lots of examples across this site, varying from the very simple to the very difficult.
The second: the picture. You can do it with this simple code:
I think that it's self-explanatory but just in case:
\R
and\r
, for the radii. This way if you want to change them you don't need to look for then across all the code (not much in this case, but sometimes could be longer).\foreach
statement repeats the next instruction as its name suggests, for each value of the variable\i
in the range (1,...,12). So it draws 12 circles at the polar points which angle is function of\i
:180-30*\i
(if you change the value 180 for another angle you can rotate the seats). As it is, the angles will beAnd finally this is the table: