-
Notifications
You must be signed in to change notification settings - Fork 22
/
ORCCA.pl
139 lines (135 loc) · 7.76 KB
/
ORCCA.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#############################################################################
# This macro library supports WeBWorK problems from the PreTeXt project named
# Open Resources for Community College Algebra
#############################################################################
# Return a string containing the latex-image-preamble contents.
# To be used by TikZImage objects as in:
# $image->addToPreamble(latexImagePreamble())
sub latexImagePreamble {
return <<'END_LATEX_IMAGE_PREAMBLE'
\usepackage{pgfplots}
\usetikzlibrary{arrows,arrows.meta} %needed for open/closed intervals
\definecolor{ruby}{HTML}{9e0c0f}
\definecolor{turquoise}{HTML}{008099}
\definecolor{emerald}{HTML}{1c8464}
\definecolor{amber}{HTML}{c7502a}
\definecolor{amethyst}{HTML}{70485b}
\definecolor{sapphire}{HTML}{263c53}
\colorlet{firstcolor}{ruby}
\colorlet{secondcolor}{turquoise}
\colorlet{thirdcolor}{emerald}
\colorlet{fourthcolor}{amber}
\colorlet{fifthcolor}{amethyst}
\colorlet{sixthcolor}{sapphire}
\colorlet{highlightcolor}{green!50!black}
\colorlet{graphbackground}{yellow!30}
\colorlet{wood}{brown!60!white}
%%% curve, dot, and graph custom styles %%%
\pgfplotsset{firstcurve/.style = {color=firstcolor, mark=none, line width=1pt, {Kite}-{Kite}, solid}}
\pgfplotsset{secondcurve/.style = {color=secondcolor, mark=none, line width=1pt, {Kite}-{Kite}, solid}}
\pgfplotsset{thirdcurve/.style = {color=thirdcolor, mark=none, line width=1pt, {Kite}-{Kite}, solid}}
\pgfplotsset{fourthcurve/.style = {color=fourthcolor, mark=none, line width=1pt, {Kite}-{Kite}, solid}}
\pgfplotsset{fifthcurve/.style = {color=fifthcolor, mark=none, line width=1pt, {Kite}-{Kite}, solid}}
\pgfplotsset{highlightcurve/.style = {color=highlightcolor, mark=none, line width=5pt, -, opacity=0.3}} % thick, opaque curve for highlighting
\pgfplotsset{asymptote/.style = {color=gray, mark=none, line width=1pt, <->, dashed}}
\pgfplotsset{symmetryaxis/.style = {color=gray, mark=none, line width=1pt, <->, dashed}}
\pgfplotsset{guideline/.style = {color=gray, mark=none, line width=1pt, -}}
\tikzset{guideline/.style = {color=gray, mark=none, line width=1pt, -}}
\pgfplotsset{altitude/.style = {dashed, color=gray, thick, mark=none, -}}
\tikzset{altitude/.style = {dashed, color=gray, thick, mark=none, -}}
\pgfplotsset{radius/.style = {dashed, thick, mark=none, -}}
\tikzset{radius/.style = {dashed, thick, mark=none, -}}
\pgfplotsset{rightangle/.style = {color=gray, mark=none, -}}
\tikzset{rightangle/.style = {color=gray, mark=none, -}}
\pgfplotsset{closedboundary/.style = {color=black, mark=none, line width=1pt, {Kite}-{Kite},solid}}
\tikzset{closedboundary/.style = {color=black, mark=none, line width=1pt, {Kite}-{Kite},solid}}
\pgfplotsset{openboundary/.style = {color=black, mark=none, line width=1pt, {Kite}-{Kite},dashed}}
\tikzset{openboundary/.style = {color=black, mark=none, line width=1pt, {Kite}-{Kite},dashed}}
\tikzset{verticallinetest/.style = {color=gray, mark=none, line width=1pt, <->,dashed}}
\pgfplotsset{soliddot/.style = {color=firstcolor, mark=*, only marks}}
\pgfplotsset{hollowdot/.style = {color=firstcolor, mark=*, only marks, fill=graphbackground}}
\pgfplotsset{blankgraph/.style = {xmin=-10, xmax=10,
ymin=-10, ymax=10,
axis line style={-, draw opacity=0 },
axis lines=box,
major tick length=0mm,
xtick={-10,-9,...,10},
ytick={-10,-9,...,10},
grid=major,
grid style={solid,gray!40},
xticklabels={,,},
yticklabels={,,},
minor xtick=,
minor ytick=,
xlabel={},ylabel={},
width=0.75\textwidth,
}
}
\pgfplotsset{numberline/.style = {xmin=-10,xmax=10,
minor xtick={-11,-10,...,11},
xtick={-10,-5,...,10},
every tick/.append style={thick},
axis y line=none,
y=15pt,
axis lines=middle,
enlarge x limits,
grid=none,
clip=false,
axis background/.style={},
after end axis/.code={
\path (axis cs:0,0)
node [anchor=north,yshift=-0.075cm] {\footnotesize 0};
},
every axis x label/.style={at={(current axis.right of origin)},anchor=north},
}
}
\pgfplotsset{openinterval/.style={color=firstcolor,mark=none,ultra thick,{Parenthesis}-{Parenthesis}}}
\pgfplotsset{openclosedinterval/.style={color=firstcolor,mark=none,ultra thick,{Parenthesis}-{Bracket}}}
\pgfplotsset{closedinterval/.style={color=firstcolor,mark=none,ultra thick,{Bracket}-{Bracket}}}
\pgfplotsset{closedopeninterval/.style={color=firstcolor,mark=none,ultra thick,{Bracket}-{Parenthesis}}}
\pgfplotsset{infiniteopeninterval/.style={color=firstcolor,mark=none,ultra thick,{Kite}-{Parenthesis}}}
\pgfplotsset{openinfiniteinterval/.style={color=firstcolor,mark=none,ultra thick,{Parenthesis}-{Kite}}}
\pgfplotsset{infiniteclosedinterval/.style={color=firstcolor,mark=none,ultra thick,{Kite}-{Bracket}}}
\pgfplotsset{closedinfiniteinterval/.style={color=firstcolor,mark=none,ultra thick,{Bracket}-{Kite}}}
\pgfplotsset{infiniteinterval/.style={color=firstcolor,mark=none,ultra thick,{Kite}-{Kite}}}
\pgfplotsset{interval/.style= {ultra thick, -}}
%%% cycle list of plot styles for graphs with multiple plots %%%
\pgfplotscreateplotcyclelist{pccstylelist}{%
firstcurve\\%
secondcurve\\%
thirdcurve\\%
fourthcurve\\%
fifthcurve\\%
}
%%% default plot settings %%%
\pgfplotsset{every axis/.append style={
axis x line=middle, % put the x axis in the middle
axis y line=middle, % put the y axis in the middle
axis line style={<->}, % arrows on the axis
scaled ticks=false,
tick label style={/pgf/number format/fixed},
xlabel={$x$}, % default put x on x-axis
ylabel={$y$}, % default put y on y-axis
xmin = -7,xmax = 7, % most graphs have this window
ymin = -7,ymax = 7, % most graphs have this window
domain = -7:7,
xtick = {-6,-4,...,6}, % label these ticks
ytick = {-6,-4,...,6}, % label these ticks
yticklabel style={inner sep=0.333ex},
minor xtick = {-7,-6,...,7}, % include these ticks, some without label
minor ytick = {-7,-6,...,7}, % include these ticks, some without label
scale only axis, % don't consider axis and tick labels for width and height calculation
cycle list name=pccstylelist,
tick label style={font=\footnotesize},
legend cell align=left,
grid = both,
grid style = {solid,gray!40},
axis background/.style={fill=graphbackground},
}}
\pgfplotsset{framed/.style={axis background/.style ={draw=gray}}}
%\pgfplotsset{framed/.style={axis background/.style ={draw=gray,fill=graphbackground,rounded corners=3ex}}}
%%% other tikz (not pgfplots) settings %%%
%\tikzset{axisnode/.style={font=\scriptsize,text=black}}
\tikzset{>=stealth}
END_LATEX_IMAGE_PREAMBLE
}