Lab 6 LaTeX (Part One)

Although I was familiar with LaTeX before completing these exercises, this was mostly using the cloud-based LaTeX editor Overleaf. This lab allowed me to set up my LaTeX workflow on my own personal computer and was incredibly useful for understanding how to prepare and format acadmeic documents more easily. This will be useful for maths assignments in CS131.

Procedure

During this session, I created an article document with 12pt font, two columns using the multicol package, and three sections and various subsections and sub-subsections using the section, subsection and subsubsection tags. Some dummy content using the lipsum package.

Following this, itemised lists, enumerated lists and figures were added to the document. The placement of figures was modified using [H] and width options were specified.

Finally, an algorithm to display all even numbers between 0 and n was written using algorithm and added into my LaTeX document with the caption An algorithm to print even numbers and the label evenalgorithm.

Commands

The pdflatex command is used to compile a LaTeX file to a PDF. The first argument is the file to be compiled, which does not need to have a .tex extension.

The LaTeX tags used by the compiled document include

  • section, subsection and subsubsection, which create sections, subsections and sub-subsections.
  • itemize, which uses item to produce a bullet pointed list.
  • enumerate, which uses item to produce a numbered list.
  • The center environment, which centres content on the page.
  • The wrapfigure environment from the wrapfig package, which, when used along with includegraphics from the graphicx package, allows images to be inserted into a LaTeX document.
  • The equation environment, which allows equations to be added to the page.
  • The algorithm and algorithmic environments, and the algoseudocode package, which format pseudocode.
  • label, which allows a label to be appplied to a figure or algorithm.
  • ref, which allows a figure or algorithm to be referenced by its label.
  • caption, which allows a caption to be added to a figure.