## Dissertation Publication

Since my dissertation was recently published (see last weeks post), I thought I would post the template I used to create it. Oklahoma State University does not currently offer a default LaTeX template for a dissertation. Instead, they only offer a Word template (gross!). I took it upon myself to make an Okstate LaTeX dissertation template.

## Lofty Goals

If you were putting off learning LaTeX, but have a big upcoming task such as a dissertation to write, I strongly encourage you to try it. I hope that by making my Okstate LaTeX dissertation template available to everyone, life could get a bit easier.

Please note that this template is unofficial, so I make no claims that this 100% meets the standards of the graduate college. However, the Okstate LaTeX dissertation template I created was accepted for publication with no issues. I have attempted to make this available through official channels. Sadly, the graduate college matriculation department has not replied to my contact attempts.

Find the link to the template below. If you have any changes or comments, please feel free to contact me. Additionally, forks of this work are encouraged to improve the material for future students. Outreach and publication are at the core of a doctoral degree!

## LaTeX: Drawing MOSFET in TikZ – Labels and Animation

Continuing from last week’s post, this week we will be adding labels to our MOSFET in TikZ and adding slide animations with Beamer.

As a reminder, last week we drew our image of a MOSFET in Tikz before adding colors. The colors we added were based on the materials used in each part of the n-type MOSFET. Now let’s add some labels to make sure that anyone we present this image to can understand what is going in.

## Centered Labels

Now we take the code from last week and add “nodes” to certain of our shapes. We tell these nodes to have certain text and compile.

\documentclass{beamer}

\usepackage{tikz}
\usetikzlibrary{patterns}

\title{\LaTeX~Surface Science and Electronics}
\author{Wesley T. Honeycutt}
\date{\today}

\newcommand{\metalone}{[pattern= horizontal lines, pattern color=blue]}
\newcommand{\metaltwo}{[pattern= vertical lines, pattern color=purple]}
\newcommand{\poly}{[pattern= grid, pattern color=red]}
\newcommand{\pdiff}{[pattern= north east lines, pattern color=orange]}
\newcommand{\ndiff}{[pattern= north west lines, pattern color=green]}
\newcommand{\pwell}{[pattern= crosshatch dots, pattern color=orange]}
\newcommand{\nwell}{[pattern= crosshatch dots, pattern color=green]}
\newcommand{\oxide}{[pattern = bricks, pattern color = olive]}
\newcommand{\silicon}{[fill = white]}
\newcommand{\metalthree}{[fill = teal]}

\begin{document}

\frame{\titlepage}

\frame{\frametitle{MOSFET}
% General n-type mosfet
\begin{tikzpicture}
\draw \pdiff (0,.25) -- (0,3) -- (1,3) -- (1,2.5) to [out=270,in=180] (1.5,2) -- (3.75,2) to [out=0,in=270] (4.25,2.5) -- (4.25,3) -- (6.75,3) -- (6.75,2.5) to [out=270,in=180] (7.25,2) -- (9.5,2) to [out=0,in=270] (10,2.5) -- (10,3) -- (11,3) -- (11,.25) -- (0,.25) node {p-type};
\draw \metalthree (0,0) rectangle (11,.25) node {Si Substrate};
\draw \oxide (4,3) rectangle (7,4) node {oxide};
\draw \metalone (4,4) rectangle (7,4.5);
\draw \ndiff (4.25,3) -- (1,3) -- (1,2.5) to [out=270,in=180] (1.5,2) -- (3.75,2) to [out=0,in=270] (4.25,2.5) -- (4.25,3) node {n-type};
\draw \ndiff (10,3) -- (6.75,3) -- (6.75,2.5) to [out=270,in=180] (7.25,2) -- (9.5,2) to [out=0,in=270] (10,2.5) -- (10,3) node {n-type};
\draw \metalone (1.25,3) rectangle (3,3.5);
\draw \metalone (8,3) rectangle (9.75,3.5);
\end{tikzpicture}
}

\end{document}


This gives us the following image with ill-placed text:

The text looks odd because the node location in TikZ defaults to the last point in the drawing. We can tell it to place the node in a certain location with respect to this anchor point. Additionally, I might want to change some other properties such as text color for my labels. This can all be done in brackets after declaring the node. Now my code becomes:

\documentclass{beamer}

\usepackage{tikz}
\usetikzlibrary{patterns}

\title{\LaTeX~Surface Science and Electronics}
\author{Wesley T. Honeycutt}
\date{\today}

\newcommand{\metalone}{[pattern= horizontal lines, pattern color=blue]}
\newcommand{\metaltwo}{[pattern= vertical lines, pattern color=purple]}
\newcommand{\poly}{[pattern= grid, pattern color=red]}
\newcommand{\pdiff}{[pattern= north east lines, pattern color=orange]}
\newcommand{\ndiff}{[pattern= north west lines, pattern color=green]}
\newcommand{\pwell}{[pattern= crosshatch dots, pattern color=orange]}
\newcommand{\nwell}{[pattern= crosshatch dots, pattern color=green]}
\newcommand{\oxide}{[pattern = bricks, pattern color = olive]}
\newcommand{\silicon}{[fill = white]}
\newcommand{\metalthree}{[fill = teal]}

\begin{document}

\frame{\titlepage}

\frame{\frametitle{MOSFET}
% General n-type mosfet
\begin{tikzpicture}
\draw \pdiff (0,.25) -- (0,3) -- (1,3) -- (1,2.5) to [out=270,in=180] (1.5,2) -- (3.75,2) to [out=0,in=270] (4.25,2.5) -- (4.25,3) -- (6.75,3) -- (6.75,2.5) to [out=270,in=180] (7.25,2) -- (9.5,2) to [out=0,in=270] (10,2.5) -- (10,3) -- (11,3) -- (11,.25) -- (0,.25) node [midway,above] {p doped Si};
\draw \metalthree (0,0) rectangle (11,.25) node [midway, color=white]
{Si Substrate};
\draw \oxide (4,3) rectangle (7,4) node [pos=.5,font=\bf\Large] {oxide};
\draw \metalone (4,4) rectangle (7,4.5);
\draw \ndiff (4.25,3) -- (1,3) -- (1,2.5) to [out=270,in=180] (1.5,2) -- (3.75,2) to [out=0,in=270] (4.25,2.5) -- (4.25,3) node at (2.625,2.5) [align=center] {n-type};
\draw \ndiff (10,3) -- (6.75,3) -- (6.75,2.5) to [out=270,in=180] (7.25,2) -- (9.5,2) to [out=0,in=270] (10,2.5) -- (10,3) node at (8.375,2.5) [align=center] {n-type};
\draw \metalone (1.25,3) rectangle (3,3.5);
\draw \metalone (8,3) rectangle (9.75,3.5);
\end{tikzpicture}
}

\end{document}


In this case, I have added some alignment options for different locations.

• For the silicon substrate, I have told the node [midway, color=white] so the text appears in the middle of the rectangle and white to show up against the color of metalthree
• For the p doped region, I have told the node [midway,above] so that the text is in the middle of the picture and at the bottom. Notice how midway does not place the text at the true center of custom shapes. It only knows to place it relative to the previous line.
• For the n doped regions, I did not want the text to sit relative to the line, I wanted it to be in the center of the shape. Thus, I told the node to be at a certain set of coordinates which I calculated to be the center of that shape, and set [align=center].
• For the oxide layer, I wanted the text to show up against the oddly colored bricks. Therefore, I used [pos=.5,font=\bf\Large]. The “pos=.5” argument is functionally the same as “midway”, but offers greater freedom to customize. The font arguments tell the node to use text in boldface with a Large size.

The image ends up looking like this:

## Labels on Arrows

I’ve decided that I want to label the metal connections on our MOSFET, but I don’t want to place the text directly over the shape. Instead, I want to tell TikZ to draw little arrows pointing to what is labeled. This is easy. We just draw a line, which we tell to have an arrowhead, from a point to another point. At the first point, we tell it to have a label. I have used:

\draw [->] (1,5) node [above] {Source} -- (2.125,3.5);
\draw [->] (10,5) node [above] {Drain} -- (8.975,3.5);
\draw [->] (5.5,5) node [above] {Gate} -- (5.5,4.5);


Which when implemented, looks like this:

## Animation with Beamer

Did you know that the same person that wrote TikZ wrote Beamer, the LaTeX slideshow creator? It’s true. This makes things quite convenient, as the author has designed it such that it is easy to integrate slide animations into your TikZ code.

For the final part of our MOSFET in TikZ, I’m going to add some animation. I want to make it obvious to the viewer how my MOSFET works going from the off state to saturation mode. I will do this by adding nodes to present the voltage relationship of each state on the screen, then pop up an image of the electron rich areas of the MOSFET. This is very easy to do with \only. Check out the final code below:

\documentclass{beamer}

\usepackage{tikz}
\usetikzlibrary{patterns}

\title{\LaTeX~Surface Science and Electronics}
\author{Wesley T. Honeycutt}
\date{\today}

\newcommand{\metalone}{[pattern= horizontal lines, pattern color=blue]}
\newcommand{\metaltwo}{[pattern= vertical lines, pattern color=purple]}
\newcommand{\poly}{[pattern= grid, pattern color=red]}
\newcommand{\pdiff}{[pattern= north east lines, pattern color=orange]}
\newcommand{\ndiff}{[pattern= north west lines, pattern color=green]}
\newcommand{\pwell}{[pattern= crosshatch dots, pattern color=orange]}
\newcommand{\nwell}{[pattern= crosshatch dots, pattern color=green]}
\newcommand{\oxide}{[pattern = bricks, pattern color = olive]}
\newcommand{\silicon}{[fill = white]}
\newcommand{\metalthree}{[fill = teal]}

\begin{document}

\frame{\titlepage}

\frame{\frametitle{MOSFET}
% General n-type mosfet
\begin{tikzpicture}
\draw \pdiff (0,.25) -- (0,3) -- (1,3) -- (1,2.5) to [out=270,in=180] (1.5,2) -- (3.75,2) to [out=0,in=270] (4.25,2.5) -- (4.25,3) -- (6.75,3) -- (6.75,2.5) to [out=270,in=180] (7.25,2) -- (9.5,2) to [out=0,in=270] (10,2.5) -- (10,3) -- (11,3) -- (11,.25) -- (0,.25) node [midway,above] {p doped Si};
\draw \metalthree (0,0) rectangle (11,.25) node [midway, color=white]
{Si Substrate};
\draw \oxide (4,3) rectangle (7,4) node [pos=.5,font=\bf\Large] {oxide};
\draw \metalone (4,4) rectangle (7,4.5);
\draw \ndiff (4.25,3) -- (1,3) -- (1,2.5) to [out=270,in=180] (1.5,2) -- (3.75,2) to [out=0,in=270] (4.25,2.5) -- (4.25,3) node at (2.625,2.5) [align=center] {n-type};
\draw \ndiff (10,3) -- (6.75,3) -- (6.75,2.5) to [out=270,in=180] (7.25,2) -- (9.5,2) to [out=0,in=270] (10,2.5) -- (10,3) node at (8.375,2.5) [align=center] {n-type};
\draw \metalone (1.25,3) rectangle (3,3.5);
\draw \metalone (8,3) rectangle (9.75,3.5);
\draw [->] (1,5) node [above] {Source} -- (2.125,3.5);
\draw [->] (10,5) node [above] {Drain} -- (8.975,3.5);
\draw [->] (5.5,5) node [above] {Gate} -- (5.5,4.5);
\only<1> {\node at (5.5,-.5) [align=center] {$V_{GS} < V_{threshold}$};}
\only<2-3> {\node at (5.5,-.5) [align=center] {$V_{GS} \geq V_{threshold}$};
\node at (5.5,-1) [align=center] {$V_{DS} < V_{GS} - V_{threshold}$};
}
\only<3> {\draw [fill=white] (4.25,3) rectangle (6.75,2.5);
\draw \ndiff (4.25,3) rectangle (6.75,2.5);
}
\only<4-5> {\node at (5.5,-.5) [align=center] {$V_{GS} \geq V_{threshold}$};
\node at (5.5,-1) [align=center] {$V_{DS} = V_{GS} - V_{threshold}$};
}
\only<5> {\draw [fill=orange,orange] (4.25,3) rectangle (6.75,2.5);
\draw [fill=white] (4.25,3) -- (4.25,2.65) -- (6.75,3) -- (4.75,3);
\draw \ndiff (4.25,3) -- (4.25,2.65) -- (6.75,3) -- (4.75,3);
}
\only<6-7> {\node at (5.5,-.5) [align=center] {$V_{GS} \geq V_{threshold}$};
\node at (5.5,-1) [align=center] {$V_{DS} > V_{GS} - V_{threshold}$};
}
\only<7> {\draw [fill=orange,orange] (4.25,3) rectangle (6.75,2.5);
\draw [fill=white] (4.25,3) -- (4.25,2.85) -- (6.75,3) -- (4.75,3);
\draw \ndiff (4.25,3) -- (4.25,2.85) -- (6.75,3) -- (4.75,3);
}
\end{tikzpicture}
}

\end{document}


Each time I add an \only, I put slide numbers in pointed braces. The code between the curly braces will “only” show up on the slides listed in the pointed braces. The result of this code is shown in the following gif:

## Wrap Up

I know that creating a MOSFET in TikZ is a bit specific. Still, I hope that this little tutorial gives everyone a feel for how to take make nice scale-able images in LaTeX using TikZ.

## LaTeX: Drawing MOSFET in TikZ

I’m a big fan of using LaTeX for my scientific writing.  (What is LaTeX? It is a typesetting programming language that gives you much more flexibility than other writing environments.  wikipedia)  Since I have some time on my hands, I wanted to prepare for future presentations by writing up some notes and slides using in LaTeX for future use.  This includes drawing diagrams using TikZ.  This post describes how to draw a simple, generalized MOSFET in TikZ while standardizing some of the layer notation.

## Setting up the Beamer environment

Before we get started with our drawing, let’s first set up a simple LaTeX environment.  Let’s say we want to make some slides for a lecture.  We can use the Beamer class in LaTeX to make these slides.  We tell LaTeX what we what to do.

\documentclass{beamer}

\begin{document}

\end{document}


Now, we add some title information into the preamble of the code, and we tell the document to produce a title slide.

\documentclass{beamer}

\title{Dr. Honeycutt's \LaTeX Surface Science and Electronics}
\author{Wesley T. Honeycutt}
\date{\today}

\begin{document}

\frame{\titlepage}

\end{document}


The “\frame” command tells the LaTeX compiler to produce a single slide with the content in the curly braces. For our title slide, we want the content to be the information title information we included in the preamble. After compiling, it should look like this:

If you want to make your slides look fancy, there are plenty of things you can do. For this demonstration, we are only need a simple framework for the TikZ drawing, so we will just leave it at the default.

## Drawing the MOSFET in TikZ

Now we are going to make a new slide with our drawing. We tell LaTeX that we will be using TikZ in the preamble. Then, we start a new slide (“\frame”) and begin our drawing. If you don’t know what a MOSFET is, or you just need a bit of a refresher, check out this for reference. Here is what my code looks like:

\documentclass{beamer}

\usepackage{tikz}

\title{\LaTeX~Surface Science and Electronics}
\author{Wesley T. Honeycutt}
\date{\today}

\begin{document}

\frame{\titlepage}

\frame{\frametitle{MOSFET}
% General n-type mosfet
\begin{tikzpicture}
\draw (0,.25) -- (0,3) -- (1,3) -- (1,2.5) to [out=270,in=180] (1.5,2) -- (3.75,2) to [out=0,in=270] (4.25,2.5) -- (4.25,3) -- (6.75,3) -- (6.75,2.5) to [out=270,in=180] (7.25,2) -- (9.5,2) to [out=0,in=270] (10,2.5) -- (10,3) -- (11,3) -- (11,.25) -- (0,.25);
\draw (0,0) rectangle (11,.25);
\draw (4,3) rectangle (7,4);
\draw (4,4) rectangle (7,4.5);
\draw (4.25,3) -- (1,3) -- (1,2.5) to [out=270,in=180] (1.5,2) -- (3.75,2) to [out=0,in=270] (4.25,2.5) -- (4.25,3);
\draw (10,3) -- (6.75,3) -- (6.75,2.5) to [out=270,in=180] (7.25,2) -- (9.5,2) to [out=0,in=270] (10,2.5) -- (10,3);
\draw (1.25,3) rectangle (3,3.5);
\draw (8,3) rectangle (9.75,3.5);
\end{tikzpicture}
}

\end{document}


In the preamble, I have told LaTeX I will be using the TikZ package. After the title slide, I added a new “\frame” and gave it a “\frametitle”. Note how the curly brace of the “\frame” does not close until line 25. In this “\frame” I have started a tikzpicture environment. This tells LaTeX that it should start using the TikZ code in this section. I have two types of drawings here. The first are simple rectangles. These rectangles are bounded by the opposing corners in (x,y) coordinates. The default units here are cm. The second type of drawing is a complex line shape. The code tells TikZ that I want a line “–” drawn from one (x,y) coordinate to a second coordinate. Multiples of these lines can be drawn in a single line. I have drawn curved lines with a different notation. I tell TikZ to draw from the first (x,y) coordinate “to [out=a,in=b]” where “a” and “b” are angles. This creates a curved line which connects to the previous and next segment at the defined angles. There are many ways to draw curves in TikZ, but for simple figures such as depicted here, this approach is sufficient. Finally, note how each line of the “tikzpicture” code is ended by a semicolon. This line ending is not something that you normally see in LaTeX, so be sure you don’t forget it.

When I compile my code, the slide with the drawing of the MOSFET in TikZ looks like this:

Now let’s add some color to our image. Using TikZ, adding a color is as easy as mentioning a fill color. But this is a special case. When drawing electronic components at the surface level, there are standard colors used for certain things. The standardized colors make it easy for Engineers to understand how a circuit works at a glance. These colors, from the classic VLSI design program “Magic”, are show in the picture (from Prof. Stine’s guide to Magic) below:

I want to use these colors for all of the drawings in my slides and notes. Therefore, I am going to make a new command for the colors in LaTeX. Additionally, since I expect my drawings to overlap at times, I want to give the colors patterns as well. I add the following code to my preamble:

\newcommand{\metalone}{[pattern= horizontal lines, pattern color=blue]}
\newcommand{\metaltwo}{[pattern= vertical lines, pattern color=purple]}
\newcommand{\poly}{[pattern= grid, pattern color=red]}
\newcommand{\pdiff}{[pattern= north east lines, pattern color=orange]}
\newcommand{\ndiff}{[pattern= north west lines, pattern color=green]}
\newcommand{\pwell}{[pattern= crosshatch dots, pattern color=orange]}
\newcommand{\nwell}{[pattern= crosshatch dots, pattern color=green]}
\newcommand{\oxide}{[pattern = bricks, pattern color = olive]}
\newcommand{\silicon}{[fill = white]}
\newcommand{\metalthree}{[fill = teal]}


In this section, I am defining a new custom command for LaTeX with the command name in the first set of curly braces, and the action to be performed in the second set of curly braces. The actions include a pattern and a pattern color in a format acceptable to TikZ notation. All I have to do is include the command in my drawing for the color and pattern to apply. If I decide to change a color later on (maybe metalthree needs to be pink instead of teal), all I have to do is change the command in one location and every instance of the command in the code is changed.

Additionally, since we decided to use patterns with the color fill commands, we need to add a line in the preamble declaring that we are going to use patterns. This is the case for all optional TikZ libraries we use in the future.

When we take a look at the complete code for the MOSFET in TikZ slide, it should look like this:

\documentclass{beamer}

\usepackage{tikz}
\usetikzlibrary{patterns}

\title{\LaTeX~Surface Science and Electronics}
\author{Wesley T. Honeycutt}
\date{\today}

\newcommand{\metalone}{[pattern= horizontal lines, pattern color=blue]}
\newcommand{\metaltwo}{[pattern= vertical lines, pattern color=purple]}
\newcommand{\poly}{[pattern= grid, pattern color=red]}
\newcommand{\pdiff}{[pattern= north east lines, pattern color=orange]}
\newcommand{\ndiff}{[pattern= north west lines, pattern color=green]}
\newcommand{\pwell}{[pattern= crosshatch dots, pattern color=orange]}
\newcommand{\nwell}{[pattern= crosshatch dots, pattern color=green]}
\newcommand{\oxide}{[pattern = bricks, pattern color = olive]}
\newcommand{\silicon}{[fill = white]}
\newcommand{\metalthree}{[fill = teal]}

\begin{document}

\frame{\titlepage}

\frame{\frametitle{MOSFET}
% General n-type mosfet
\begin{tikzpicture}
\draw \pdiff (0,.25) -- (0,3) -- (1,3) -- (1,2.5) to [out=270,in=180] (1.5,2) -- (3.75,2) to [out=0,in=270] (4.25,2.5) -- (4.25,3) -- (6.75,3) -- (6.75,2.5) to [out=270,in=180] (7.25,2) -- (9.5,2) to [out=0,in=270] (10,2.5) -- (10,3) -- (11,3) -- (11,.25) -- (0,.25);
\draw \metalthree (0,0) rectangle (11,.25);
\draw \oxide (4,3) rectangle (7,4);
\draw \metalone (4,4) rectangle (7,4.5);
\draw \ndiff (4.25,3) -- (1,3) -- (1,2.5) to [out=270,in=180] (1.5,2) -- (3.75,2) to [out=0,in=270] (4.25,2.5) -- (4.25,3);
\draw \ndiff (10,3) -- (6.75,3) -- (6.75,2.5) to [out=270,in=180] (7.25,2) -- (9.5,2) to [out=0,in=270] (10,2.5) -- (10,3);
\draw \metalone (1.25,3) rectangle (3,3.5);
\draw \metalone (8,3) rectangle (9.75,3.5);
\end{tikzpicture}
}

\end{document}


Compiling this code will give us this as our second slide: