You are on page 1of 5

1

ECE469 Latex Guide


Yutian Lei, Robert Pilawa-Podgurski
Department of Electrical and Computer Engineering
University of Illinois at Urbana-Champaign
yourNetIDgoeshere@illinois.edu

Abstract—This document serves as a guide for writing you are at using word processing tool. Finally, if you are
laboratory reports using LaTeX for the course ECE 469 considering a career in academic (or industry) research,
– Power Electronics at University of Illinois at Urbana- knowing LaTeX will be very beneficial, as it is the
Champaign. It introduces the features of LaTeX and also most commonly used software for preparing academic
serves as a template for the report so that students can
manuscripts for professional conferences and journals.
modify the contents of this guide to produce their own
lab reports. Normally, the abstract should contain a short
description of the experiment, and some key results that
were obtained. A. Do I have to use LaTeX?
While you are strongly encouraged to use LaTeX,
I. I NTRODUCTION you are not required to do so. You are, however,
required to produce a document that adheres to the
Y OU are highly encouraged to use LaTeX for your
laboratory reports. LaTeX is a high-quality type-
setting system; it includes features designed for the
styles presented in this template. If you choose to use
something else (such as MS Word), your final document
production of technical and scientific documentation [1]. should be indistinguishable from a report produced using
The idea is that with LaTeX, the authors would not this template. That includes the section and subsection
need to worry about the appearance of the document and headings, the abstract, title, caption placement for figures
can instead concentrate on producing the best contents. and tables, footnotes, and references. You are likely to
Despite the intention of making the life easier for sci- spend significantly more time on formatting your word
entific writers, LaTeX can have a steep learning curve. processing tool than what it would take to learn this
Therefore, we are providing this guide and template to template – consider yourself warned.
make your learning experience as easy as possible. This
guide is not meant to be an exhaustive tutorial, otherwise
III. S ETTING - UP L AT E X
it would be over 200 pages long instead of only 6. Rather,
we provide this guide to get you started and direct you The links to the software presented in this section
to the best resources available. can be found on the ECE469 course website [2]. There
are two basic components that are needed to work with
II. W HY L AT E X? LaTeX, a LaTeX compiler and a LaTeX editor. The
The main reason why we ask you to prepare your lab- most common LaTeX distribution to use on Windows
oratory reports in LaTeX is for consistency. In previous is MiKTeX. When downloading MiKTeX, choose the
years, students have struggled with (and received sig- net installer from Other Downloads, instead of the basic
nificant grade penalties) basic report formatting. While installer, so that all packages are installed. The 32-
we realize that many of you are quite capable of using bit version is recommended even if you have a 64-
Microsoft Word and other word processing tools, very bit machine, to maximize compatibility. Linux and Mac
few of you have extensive experience with you figure users can use Tex Live and MacTex respectively. One
captions, tables, and the structure of a professional LaTeX editors that is recommended is Texmaker for its
looking report. Moreover, by using LaTeX, the content ease of use and cross-platform support for Windows,
is what will make your report stand out, not how good MacOS and Linux.
2

TABLE I: List of files

latex guide.tex This is the LatTex source file that include the contents of this template
latex guide.pdf This is the compiled pdf file you are reading now
header.tex This file includes the essential packages and parameter settings
references.bib contains the bibliography information
IEEEtran.bst defines IEEE bibliography style
IEEEtran.cls defines IEEE document style
images the folder that contains figures and plots
Matlab the folder that contains Matlab scripts that generate plots
*.out *.ent *.blg *.aux etc... These auxiliary files are generated during compilation and can be ignored

IV. U SING THIS T EMPLATE follow % are comments and will not be interpreted by
Different from the common WYSIWYG (what you the compiler. A basic flow of the LaTeX document is
see is what you get) typesetting software such as MS shown on the next page.
Word, LaTeX compiles the source file and creates a pdf
as the final output, much like a simple programming
language. The source codes for this template can be B. Typing math
downloaded as a zip package from the course website. Perhaps one of the most compelling reason to use
The files included in the package as well as their LaTeX to typeset a scientific paper is the relative ease
functions are listed in Table I. When reading this guide, of typing out beautiful math equations and symbols.
you should open the LaTeX source file and compare the There are two modes of displaying math in LaTeX, inline
contents of the source and the contents of this guide. math and displayed math. Inline math is used when you
The source is commented to make it easier for you to want to include some math symbols and equations in
understand. After you have gone through this guide, you an ordinary sentence. It is done using $$ environment;
should be able to start on your first report by modifying everything inside the $$ is interpreted in math mode. For
this guide or the report guide given in a separate folder. example, $ R_1=10.1 \, \Omega $ gives R1 =
To compile a LaTeX document using Texmaker, 10.1 Ω. Please note that white space is automatically
open the latex guide.tex and click on arrow to the left ignored in the math environment, but can be added using
of Quick Build. Texmaker should compile the latex ’\,’ or ’\.’. Displayed math is used when you want
document and open the resultant pdf file with a built-in to write important equations that occupy a whole line
pdf viewer. You can also use the keyboard shortcut, F1. themselves. For example,
By default, Texmaker should use PDFLaTeX as the build
\begin{equation}
tool. If not, or if you are using other latex editors, please V_{out}=\frac{2V_{in}}{\pi} \int_\deltaˆ{\pi-
make sure that you choose PDFLaTeX as the toolchain. \delta} sin(\omega t) \,d(\omega t)
In addition, if you are making LaTeX document in \end{equation}
linux environment or if you are using editors other
gives
than Texmaker or Texstudio, you may have to add ”- Z π−δ
shell-escape” option in the PDFLaTeX command in the 2Vin
Vout = sin(ωt) d(ωt) (1)
confiugration of your LaTeX editor. π δ
Some common maths symbols that you might use are
V. W RITING WITH L AT E X included in the following examples.
A. Basic syntax ∞
4 X1 nπx
f (x) = sin( ) (2)
Commands and special characters in LaTeX are π n L
n=1,3,5...
invoked by using the backslash ’\’. For example,    
\section indicates the start of the section and −1 0 0 1
\centering makes the contents to be center aligned. ẋ =  0 −1 0  x +  0  u (3)
Double backslash ’\\’ makes a line break while para- 0 0 −1 0
| {z }
graphs are separated by an empty line. Characters that A
3

\begin{document}

\section{Introduction}
This is the first paragraph of the first section. The section title
is Introduction.

Power Electronics is awesome. This is the second paragraph and is


separated from the first using an empty line.
A new line does not count towards a new paragraph so this is still
the second paragraph when compiled.

\section{Theory}

\section{Experimental Results}

\section{Discussion}
\subsection{Part 1}
Depending on your needs, you may use subsections and subsubsections.

\section{Conclusion} % This is a comment and you won’t see it when compiled.

\end{document}

C. Making plots 25
V
out,ave
Graphs and plots are essential in every scientific Vout,rms
writing. This LaTeX template can display a number of 20 Vout,ave −theory
different image formats, such as Encapsulated Postscript V −theory
out,rms
(EPS), PDF, PNG and JPEG. 15
Voltage /V

1) Matlab: This is the recommended way. Make your


plot using Matlab and then export the figure into eps
or pdf format. After you have plotted a figure, just use 10

save as in the file tab of the figure window to save it as


an eps image. You can also do it with text commands 5
and we provided a short Matlab script to show you how
to do that. You can find it under the Matlab folder in
0
the ECE469 LaTeX starter’s package. Figure 1 shows
0 20 40 60 80 100 120 140 160
an example plotted by Matlab. Delay angle /degree
2) Using Excel: Even though Excel does not produce
the most professional looking charts, it is probably the Fig. 1: Example plot made by Matlab.
easiest and most commonly used. To import the chart
plotted in Excel to LaTeX, first you need to export the
selection. You chart will then be cropped properly. Save
chart to pdf format. This can be done in Excel 2013
the modified chart to pdf and include it in LaTeX using
by selecting the chart and choose export under the file
\includegraphics explained in the next section.
tab. In previous versions of Excel, you probably have to
use save as to save the chart as a pdf. Unfortunately the
exported pdf will occupy a whole page. To crop out the D. Figures
white space surrounding your chart, we recommend us- Images are included with \includegraphics.
ing Inkscape. Open Inkscape, and select import from the With the packages we added, there should be no problem
file drop-down menu. After importing, choose Document adding image with common formats such as png, jpg, eps
Properties and below page size, expand on resize page and pdf. We recommend using png for low resolution
to content and then click on resize page to drawing or photos/screen-shots, jpg for high resolution photos and
4

(a) 6.5% duty ratio


Fig. 2: Annotated oscilloscope screen-shot.

eps/pdf for graphs and circuit diagrams. It is usually


desirable to put all the image files into a separate sub-
folder such as the images folder in this template. The
included graphics is put into a figure float environment
and caption is added at the bottom. Please make sure
to look at the source code to see how it is done. An
example is shown in Fig. 2. You can use Inkscape or
your favorite image editing software to add annotations
to your plots and oscilloscope screen-shots. Sometimes
you would like to group a few related figures together
like shown in Fig. 3, and this is done using subfloat
environment.
(b) 80% duty ratio
An example of a circuit diagram is shown in Fig. 4.
All electrical components of a circuit should be labeled Fig. 3: Terminal voltage, Vt (Channel 1) and motor
as well as the relevant voltage and current. In addition, current(Channel 2) at two different duty ratios.
please note the use of dots to show connections at the
wire intersections and the use of arrows to indicate iin(t) S1 L i L(t)
current. This circuit is made using XCircuit, which + +
is free and open-source. It is specifically designed to + q q’
Vin − Cin S2 Cout Rload Vout
draw beautiful circuit diagrams and the download link
is provided on the course website. You can also use - -
Microsoft Visio or other software that you are familiar
with. Fig. 4: Schematics of a buck converter.

E. Tables and click on convert table to LaTeX in the Add-Ins tab.


Tables in LaTeX is realized using the tabular envi- Select Copy to the Clipboard and then paste it into your
ronment which is in turn encapsulated in the table float LaTeX file. Detailed installation and usage guide is given
environment. Keying in the table entries with LaTeX can on the hosting site. There is also a similar plugin for
be cumbersome if you have a lot of calculated data, so we OpenOffice and LibreOffice called calc2latex.
have provided you with a shortcut using an Excel plug- An example of a LaTeX table is shown in Table II.
in called excel2LaTeX. Download the Excel2LaTeX.xla Notice the omission of vertical separators between the
file using the link given in the course website. Open the columns and the different thickness of the horizontal
file with Excel and you will be prompted whether to separators. In addition, the caption is placed above the
enable the macro, choose enable. You can then convert table. Be sure to look over the source code for detailed
an Excel table into LaTeX format by selecting your table explanation of how to use the tabular environment.
5

TABLE II: Input and output voltage, current and power of buck converter at various duty ratios

Duty Ratio Vload,ave Vload,rms Vin,rms Iin,ave Pout Pin


(%) (V) (V) (V) (A) (W) (W)
10.6 1.61 1.63 11.96 0.052 0.2 0.38
29.9 3.56 3.59 11.99 0.1 1.02 1.27
50.3 5.91 5.96 12.01 0.26 2.8 3.16
70.1 8.24 8.31 12.03 0.48 5.44 5.87
89.1 10.47 10.57 12.04 0.769 8.6 9.29

F. Referencing figures and tables VI. B EYOND THIS G UIDE


In reports, frequently you have to refer to your figures There are so many topics on LaTeX that are impos-
and tables in your text so that your readers can follow. sible to cover with this guide. A very good additional
Instead of you labeling each figure and table in the resource is in [3]. It has enough detailed explanation
correct order and remembering their numbers when you and examples while not overwhelming you with too
reference them, LaTeX can do all the work for you. much information like some other tutorial. You are not
All you need to do is to add \label{key} in the expected to learn LaTeX in detail, and for most of
figure or table environment and replace key with any you this template will provide everything you need to
character string you like. When you want to reference it, produce a quality report. The focus of your report should
just use Fig. \ref{key} or Table \ref{key}. be on the content. If you do need to make customization
LaTeX will automatically sort the labels for you and to this template, Google is your good friend. Chances
insert the correct label to your text. Please use sensible are that many others have faced the problem that you
key names so that you can easily remember which key have and the answers are right there on the web. In
you assigned to a particular figure. It is usually easier if addition, this guide only shows you how to write a report
you categorize your reference by starting your key string in LaTeX, but to write a good report, contents are what
with fig: for figures and tab: for tables, etc. You can matters the most. Please follow the instruction in the Lab
even add reference to equations and text sections using Manual [4] to learn how to organize your lab report.
\label{key} so that you do not need to remember
the equation and section numbers either. R EFERENCES
[1] Latex project site. [Online]. Available: http://www.latex-project.
G. Citation and footnotes org/
Citation is used when you reference some materials [2] Ece469 course website. [Online]. Available: http://courses.engr.
from another source, such as a technical paper, a book, illinois.edu/ece469/software/
or a website. Before you can cite them, you have to [3] Latex wikibook. [Online]. Available: http://en.wikibooks.org/
collect the relevant information about the source, such as wiki/LaTeX/
author, title and date. This citation information is stored [4] P. T. Krein and R. C. N. Pilawa, ECE 469 Lab Manual.
in a separate file in this template called references.bib. University of Illinois, 2013.
We recommend using JabRef to management the citation
entries. Each citation entry is given a key. When citing
the reference, just use \cite{key} in your code and
LaTeX will find the citation corresponding to the key,
automatically include the citation in the reference page
and sort them according to the IEEE style. If you are
using Texmaker, you might have to use F11 to refresh
the bibliography and compile twice before the correct
citation can appear. A related feature is footnotes1 and
we recommend using footnotes to indicate where you
answer the study questions from the lab manual.
1
Using a footnote is easy.

You might also like