ECE 110/Fall 2022/Lab Supplements

From PrattWiki
(Redirected from ECE 110/Fall 2022/Lab 0)
Jump to navigation Jump to search

General


Lab 0

Typographical/Other Errors

None yet!

Clarifications

None yet!

Relevant Resources

None yet!

Lab 1

Typographical/Other Errors

None yet!

Clarifications

None yet!

Relevant Resources

Lab 2

Typographical/Other Errors

None yet!

Clarifications

None yet!

Relevant Resources

Lab 3

Typographical/Other Errors

None yet!

Clarifications

Resistor Table Codes

The following $$\LaTeX$$ code was used in the lab handout to make the four example tables for resistors. Note that the command:

\usepackage[dvipsnames]{xcolor}

needs to be in the preamble to define specialty colors like Goldenrod. Also, the \strut command is used to produce an unprinted character that is slightly larger than any letter in the font. Without it, the colorboxes go slightly above the tallest ascender in the word and slightly below the deepest descender in a word.

\begin{center}
    \begin{tabular}{|c|cccc|} \hline
    Resistor & 1st & 2nd & 3rd & 4th\\ \hline
    43 $\Omega$ & yellow & orange & black & gold\\ \hline
    \end{tabular}
\end{center}
or
\begin{center}
    \begin{tabular}{|c|cccc|} \hline
    Resistor & 1st & 2nd & 3rd & 4th\\ \hline
    43 $\Omega$ & \colorbox{yellow}{~\strut ~} & \colorbox{orange}{~\strut ~} & \colorbox{black}{~\strut ~} & \colorbox{Goldenrod}{~\strut ~}\\ \hline
    \end{tabular}
\end{center}
or
\begin{center}
    \begin{tabular}{|c|cccc|} \hline
    Resistor & 1st & 2nd & 3rd & 4th\\ \hline
    43 $\Omega$ & \color{yellow}yellow\color{black} & \color{orange}orange\color{black} & black & \color{Goldenrod}gold\color{black}\\ \hline
    \end{tabular}
\end{center}
or
\begin{center}
    \begin{tabular}{|c|cccc|} \hline
    Resistor & 1st & 2nd & 3rd & 4th\\ \hline
    43 $\Omega$ & \colorbox{yellow}{\strut yellow} & \colorbox{orange}{\strut orange} & \colorbox{black}{\color{white}\strut black\color{black}} & \colorbox{Goldenrod}{\strut gold}\\ \hline
    \end{tabular}
\end{center}

You can also create new functions in $$\LaTeX$$ if you find yourself doing similar things over and over. For example, the following three commands might be useful in creating the last version of the table:

\newcommand{\rescolw}[1]{\colorbox{#1}{\makebox(40,12){\textcolor{white}{#1}}}}
\newcommand{\rescolk}[1]{\colorbox{#1}{\makebox(40,12){\textcolor{black}{#1}}}}
\newcommand{\rescolg}{\colorbox{Goldenrod}{\makebox(40,12){\textcolor{black}{gold}}}}

where the [1] means there will be one argument; that argument gets placed wherever the #1 is in the new command. The last version of the table can now be written as:

\begin{center}
    \begin{tabular}{|c|cccc|} \hline
    Resistor & 1st & 2nd & 3rd & 4th\\ \hline
    43 $\Omega$ & \rescolk{yellow} & \rescolk{orange} & \rescolw{black}  & \rescolg\\ \hline
    \end{tabular}
\end{center}

Note that gold was given its own command because there is no "gold" color in color. In the other two new commands, the argument was used both to define the color and to type the name of the color; in the \rescolg, there is no argument and the black text color, word gold, and Goldenrod background were all hard coded.

Relevant Resources

Lab 4

Typographical/Other Errors

None yet!

Clarifications

Relevant Resources