2
0
Fork 0
mirror of https://github.com/MartinThoma/LaTeX-examples.git synced 2025-04-19 11:38:05 +02:00
LaTeX-examples/tikz/line-segments/line-segments-bounding-box.tex
Martin Thoma 7740f0147f Remove trailing spaces
The commands

find . -type f -name '*.md' -exec sed --in-place 's/[[:space:]]\+$//' {} \+

and

find . -type f -name '*.tex' -exec sed --in-place 's/[[:space:]]\+$//' {} \+

were used to do so.
2015-10-14 14:25:34 +02:00

61 lines
1.6 KiB
TeX

\documentclass{article}
\usepackage{gensymb}
\usepackage[pdftex,active,tightpage]{preview}
\setlength\PreviewBorder{2mm}
\usepackage{tikz}
\usetikzlibrary{arrows, calc, positioning,decorations.pathreplacing,shapes}
\tikzset{
%Define standard arrow tip
>=stealth',
% Define arrow style
pil/.style={
->,
thick},
line/.style={
very thick,
black,
to path={% works only with "to" and not "--"
-- (\tikztotarget) node[at start,point] {} node [at end,point] {} \tikztonodes
}
},
point/.style={
thick,
draw=gray,
cross out,
inner sep=0pt,
minimum width=4pt,
minimum height=4pt,
},
}
\begin{document}
\begin{preview}
\begin{tikzpicture}
\newcommand\MinX{0}
\newcommand\MinY{0}
\newcommand\MaxX{4}
\newcommand\MaxY{5}
% Coordinate system
\draw [<->, thick, red] (0,{\MaxY+0.5}) -- (0,0) -- ({\MaxX+0.5},0);
\coordinate (A) at (1,2);
\coordinate (B) at (3,5);
\coordinate (C) at (1.5,0.5);
\coordinate (D) at (4,1.5);
\draw[color=orange, very thick, fill=orange!20] (1,2) -- (3,2) -- (3,5) -- (1,5) -- cycle;
\draw[color=orange, very thick, fill=orange!20] (1.5,0.5) -- (4,0.5) -- (4,1.5) -- (1.5,1.5) -- cycle;
\draw[line] (A) -- (B);
\draw[line] (C) -- (D);
\draw[step=0.5cm,color=gray] ({\MinX-0.25}, {\MinY-0.25}) grid ({\MaxX+0.25},{\MaxY+0.25});
\path[every node/.style={point}]
node at (A) {}
node at (B) {}
node at (C) {}
node at (D) {};
\end{tikzpicture}
\end{preview}
\end{document}