You could clip the plot although specifying the bounding box for the picture as Symbol1 suggests is probably better.
Clipping
\documentclass{article}[12 pt]
\usepackage{amsmath,amssymb, amsthm, pgfplots} % Math packages
\pgfplotsset{compat=1.6}
\usepackage{tikz}
\usetikzlibrary{backgrounds}% only to show the bounding box
\usepackage[margin=1in]{geometry} % Page settings
\usepackage{fancyhdr} %Used for headers
\pagestyle{fancy} % Sets page style to fancy
\fancyhf{} % Clears standard header
\lhead{\textbf{Algebra II}} %Subject Name
\chead{\textbf{Name:}\hspace{3 in}}
\rhead{\textbf{Mr. A}} %Teacher name
\rfoot{Page \thepage}
\begin{document}
\begin{flushright}
\textbf{Period:} \makebox[0.5 in]{\hrulefill} %Transfer this to header
\textbf{Date:} \makebox[0.75 in]{\hrulefill} \\[20 pt]
\end{flushright}
\begin{center}% center is an environment...
\LARGE{\textbf{Intervals, Parent Functions and Domain \& Range}}
%Create Question command
Directions: Given a representation of an interval, give the other two representations. Below are examples of the three representations.
\end{center}
\begin{tikzpicture}[show background rectangle]% only to show (roughly) the bounding box
\clip (-.5,-1) |- (7.5,1) |- cycle;
\begin{axis}[
axis y line=none,
axis lines=left,
axis line style={<->},
xmin=-5,
xmax=5,
ymin=0,
ymax=1,
%xlabel=$\mathbb R$,
scatter/classes={
o={mark=*,draw=black,fill=white},
c={mark=*,black}
},
restrict y to domain=0:1,
xtick={-5,-4,...,5},
point meta=explicit symbolic,
]
\addplot[scatter,black,ultra thick] table [y expr=0,meta index=1, header=false] {
-2 c
3 c
};
\end{axis}
\end{tikzpicture}
\end{document}
Setting bounding box
Or you can set the bounding box explicitly:
\documentclass{article}[12 pt]
\usepackage{amsmath,amssymb, amsthm, pgfplots} % Math packages
\pgfplotsset{compat=1.6}
\usepackage{tikz}
\usepackage[margin=1in]{geometry} % Page settings
\usepackage{fancyhdr} %Used for headers
\pagestyle{fancy} % Sets page style to fancy
\fancyhf{} % Clears standard header
\lhead{\textbf{Algebra II}} %Subject Name
\chead{\textbf{Name:}\hspace{3 in}}
\rhead{\textbf{Mr. A}} %Teacher name
\rfoot{Page \thepage}
\begin{document}
\begin{flushright}
\textbf{Period:} \makebox[0.5 in]{\hrulefill} %Transfer this to header
\textbf{Date:} \makebox[0.75 in]{\hrulefill} \\[20 pt]
\end{flushright}
\begin{center}% center is an environment...
\LARGE{\textbf{Intervals, Parent Functions and Domain \& Range}}
%Create Question command
Directions: Given a representation of an interval, give the other two representations. Below are examples of the three representations.
\end{center}
\begin{tikzpicture}
\draw [use as bounding box] (-5mm,-7.5mm) rectangle (75mm,5mm);
\begin{axis}[
axis y line=none,
axis lines=left,
axis line style={<->},
xmin=-5,
xmax=5,
ymin=0,
ymax=1,
%xlabel=$\mathbb R$,
scatter/classes={
o={mark=*,draw=black,fill=white},
c={mark=*,black}
},
restrict y to domain=0:1,
xtick={-5,-4,...,5},
point meta=explicit symbolic,
]
\addplot[scatter,black,ultra thick] table [y expr=0,meta index=1, header=false] {
-2 c
3 c
};
\end{axis}
\end{tikzpicture}
\end{document}
![Saner result](https://i.stack.imgur.com/J4ItH.png)
Note that center
is an environment and not a command.
Best Answer
I imagine that the bottleneck is in running the
TikZ
code. However, to empirically check whether it is or not, a possible option would be to do make copies of the files that you're using and add:and,
to the
lua
portion. Then, make wrappers:in the
tex
preamble. You could then search/replacetex.print
withf:write
and run your file like:Some variation of the above should get you a compilable
.tex
file. Running it will take thelua
stuff out of the equation. Thus, if it takes nearly an hour to compile you know that the bottleneck is on the TikZ side or at least get a feel for how much of the compilation time is actually taken up by running the code as opposed to producing it vialua
. If it turns out that thelua
is taking a significant portion of the compilation time, here are a couple of resources that might help you to speed it up:http://www.lua.org/gems/sample.pdf
http://trac.caspring.org/wiki/LuaPerformance
and if you can confirm that TikZ takes too long, you should seriously consider the use of either TikZ's external library or the standalone package. Both can significantly speed-up the processing of documents with many tikz pictures (they are optimized for slightly different use-cases).