2
0
Fork 0
mirror of https://github.com/MartinThoma/LaTeX-examples.git synced 2025-04-26 06:48:04 +02:00
LaTeX-examples/tikz/half-space/half-space.tex
2012-10-19 20:44:06 +02:00

50 lines
1.5 KiB
TeX

\documentclass{article}
\usepackage[pdftex,active,tightpage]{preview}
\setlength\PreviewBorder{2mm}
\usepackage{tikz}
\usetikzlibrary{patterns}
\begin{document}
\begin{preview}
\begin{tikzpicture}
\pgfdeclarepatternformonly{north east lines wide}%
{\pgfqpoint{-1pt}{-1pt}}%
{\pgfqpoint{10pt}{10pt}}%
{\pgfqpoint{9pt}{9pt}}%
{
\pgfsetlinewidth{0.7pt}
\pgfpathmoveto{\pgfqpoint{0pt}{0pt}}
\pgfpathlineto{\pgfqpoint{9.1pt}{9.1pt}}
\pgfusepath{stroke}
}
\pgfdeclarepatternformonly{north west lines wide}
{\pgfqpoint{-1pt}{-1pt}}%
{\pgfqpoint{7pt}{7pt}}%
{\pgfqpoint{6pt}{6pt}}%
{
\pgfsetlinewidth{0.7pt}
\pgfpathmoveto{\pgfqpoint{0pt}{6pt}}
\pgfpathlineto{\pgfqpoint{6.1pt}{-0.1pt}}
\pgfusepath{stroke}
}
% Draw two intersecting lines
\draw[thick, red] (-1,-1) coordinate (a) -- (2,-1) coordinate (b);
\draw[thick, green] ( 1,-1) coordinate (c) -- (1, 2) coordinate (d);
\fill[pattern=north east lines wide, pattern color=red!50] (a) -- (b) -- (2,2) -- (-1,2) -- (a);
\fill[pattern=north west lines wide, pattern color=green!50] (a) -- (1,-1) -- (1,2) -- (-1,2) -- (a);
\draw[thick, green] (c) -- (d);
\draw[thick, red] (a) -- (b);
% Draw axes
\draw [<->,thick] (0,2.5) node (yaxis) [above] {$x_2$}
|- (2.5,0) node (xaxis) [right] {$x_1$};
\node[red] at (1.5,2.8) {$H_2^+(-1)$};
\node[green] at (1.5,2.3) {$H_1^-(1)$};
\end{tikzpicture}
\end{preview}
\end{document}