Skip to content

Instantly share code, notes, and snippets.

@jeremywrnr
Last active August 29, 2015 14:08
Show Gist options
  • Save jeremywrnr/8137161c56bf826c1de3 to your computer and use it in GitHub Desktop.
Save jeremywrnr/8137161c56bf826c1de3 to your computer and use it in GitHub Desktop.
all of my favorite tex things
% required package for plotting
\usepackage{pgfplots}
% required package for plotting
\begin{center}
\begin{tikzpicture}
\begin{axis}[
title={Question 2},
xlabel={Nodes},
ylabel={Voltage (V)},
xmin=0, xmax=16,
ymin=0, ymax=2,
xtick={0,2,4,6,8,10,12,14,16},
ytick={0,0.5,1,1.5,2},
legend pos=south west,
ymajorgrids=true,
xmajorgrids=true,
grid style=dashed,
]
\addplot[
color=blue,
mark=square,
]
coordinates {
(2,1.548)(10,1.382)(16,1.301)
};
\addplot[
color=red,
mark=o,
]
coordinates {
(2,1.531)(10,1.351)(16,1.238)
};
\addplot[
color=black,
mark=triangle,
]
coordinates {
(2,1.618)(10,1.224)(16,1.145)
};
\legend{2.1,2.2,2.3}
\end{axis}
\end{tikzpicture}
\end{center}
% extra special mystery commands
%comment-out to make sure there are no more todos
\newcommand{\todo}[1]{\textcolor{red}{\textbf{[#1]}}}
%Consistent cross referencing
\def\fig#1{Figure~\ref{#1}}
\def\tab#1{Table~\ref{#1}}
\def\eqn#1{Equation~\ref{#1}}
% EXAMPLE LIST
\begin{itemize}
\item LF411 op amp
\item $14.777nF$ Capacitor
\end{itemize}
% EXAMPLE FIGURE (AND REFERENCE)
\begin{figure}[ht]
\centering
\graphicspath{ {eqns/}{figs/}{scope/} }
\includegraphics{pins.jpg}
\label{Pin_OPAMP}
\caption{Pin Diagram for LF411 OP AMP}
\end{figure}
% EXAMPLE CODE INSERTION
\begin{framed}
\lstinputlisting[language=MATLAB]{Lab2.m}
\end{framed}
% EXAMPLE MATLAB OUTPUT
\begin{verbatim}
j =
0.2239 -0.2601 -0.3971 -0.1776
0.5767 0.3391 -0.0660 -0.3276
0.3528 0.4861 0.3641 0.0466
end{verbatim}
% EXAMPLE MULTILINE EQUATION
\begin{gather*}
yay multiline equations \\
more equations = fun
\end{gather*}
% EXAMPLE TABLE FOR BEAUTY
\begin{table}[h!]
\centering
\begin{tabular}{||c c c c||}
\hline
Input (V) & Difference (mV) & Theoretical (mV) & Error (\%) \\ [0.5ex]
\hline\hline
1 & 0.5 & 0.05 & -90 \\
3 & 0.4 & 0.08 & -80 \\
8 & 0.3 & 0.15 & -50 \\[1ex]
\hline
\end{tabular}
\end{table}
\begin{figure}[ht]
\centering
\begin{subfigure}{.5\textwidth}
\centering
\graphicspath{ {scope/} }
\includegraphics[scale=0.45]{"222gain (1)".PNG}
\label{gain1}
\captionof{figure}{Output with $1kHz$ input, gain = $7.2 V/V$}
\end{subfigure}%
\begin{subfigure}{.5\textwidth}
\centering
\graphicspath{ {scope/} }
\includegraphics[scale=0.45]{"222gain (4)".PNG}
\label{gain2}
\captionof{figure}{Output with $10kHz$ input, gain = $7.2 V/V$}
\end{subfigure}
\begin{subfigure}{.5\textwidth}
\centering
\graphicspath{ {scope/} }
\includegraphics[scale=0.45]{"222gain (3)".PNG}
\label{gain3}
\captionof{figure}{Output with $20kHz$ input, gain = $2.8 V/V$}
\end{subfigure}%
\begin{subfigure}{.5\textwidth}
\centering
\graphicspath{ {scope/} }
\includegraphics[scale=0.45]{"222gain (2)".PNG}
\label{gain4}
\captionof{figure}{Output with $100kHz$ input, gain = $1.3 V/V$}
\end{subfigure}\\
\caption{from oscilloscope - amplifier frequency vs gain }
\end{figure}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment