Exercises in LaTeX IDA on AAU

Similar documents
Aalborg October 2014

Mikkel Madsen

Basics. Options. Commands

L A TEX Tutorial. 1 Introduction. 2 Running L A TEX. J. E. Rice. May 2010

Introduction to L A TEX beamer

Lecture 3-Introduction to Latex (II)

Become a L A TEX Guru

Intro to LATEX I. Aaron Erlich POLS/CSSS 510, Why LATEX? Programming Document Structure Floats Tables Lists Math

What is LaTeX. Is a document markup language and document preparation system for the TeX typesetting program

Student Learning Service: Introduction to Latex

Mikkel Madsen

Introduction to LaTeX. Christoph Pickl

Researcher Development Unit: Introduction to Latex

LaTeX: Scientific Document Writing

Introduction to L A TEX

Introduction to LATEX

Math 235: Introduction to LaTeX

A Beginner s guide to L A TEX for CSCA67/MATA67. Kohilan Mohanarajan

LaTeX A Tutorial. Mohsen Alimomeni, 2010

GENERAL INFORMATION INSTRUCTIONS FOR MANUSCRIPT SUBMISSION

Intro to LaTeX Workshop

What is L A T E X? Dan Yasaki. June 4, 2018 REU at Elon University. UNC Greensboro. Dan Yasaki What is LAT E X? 1 / 22

عمادة البحث العلمي جامعة الملك سعود

An Introduction to LATEX

Introduction to LaTeX. Paul Fodor Stony Brook University

Table of Contents Headings:... 2 Changing text to a heading... 2 Modifying Style settings for current and future documents... 2

Learning L A TEX. Patrick Lam

Introduction to L A TEX

Assessments for CS students:

L A TEX Overview. Jiayi Liu. January 31, Colorado School of Mines

Excel 2016: Part 1. Updated January 2017 Copy cost: $1.50

An introduction to L A TEX for students

MS Word Professional Document Alignment

Math 291: Lecture 4. Dr. Fagerstrom. Minnesota State University Moorhead web.mnstate.edu/fagerstrom

Forschungskolleg / ACSE Exercise 2. Tools around LaTeX

1 Obtaining LyX and L A TEX

Helen Cameron. A Brief Overview of LATEX

Microsoft Excel for Beginners

WEEK NO. 12 MICROSOFT EXCEL 2007

Introduction to L A TEX

ACT! Calendar to Excel

Word Template Instructions

TeXnicCenter v1 Beta Frank Van Puyvlde ICT for Research K.U.Leuven

Helen Cameron. A Brief Overview of LATEX

Introduction to Latex. A workshop by Dr. Ala Eshmawi

1 Different Document Classes

Practice Exercises for Introduction to Excel

Using L A TEX Tom Edgar

Workshop: A Simple Introduction to L A TEX

Office 2007 Overview

L A TEX for Psychological Researchers

Dec. 27 th, 2010 University of Isfahan

Effective Programming Practices for Economists

SOUTHWEST DECISION SCIENCES INSTITUTE INSTRUCTIONS FOR PREPARING PROCEEDINGS

Introduzione a LaTex. Fabrizio Messina

L A T E X Workshop. Bijulal D & Anu Thomas Industrial Engineering and Operations Research Indian Institute of Technology

AASHTO Materials Standard Template Users Guide

An introduction. C.D. Emmery & M.M. van Zaanen. October 22, Tilburg University

An Introduction to LATEX

Introduction to LaTex 2ε. Based on The Not So Short Introduction to LaTeX 2ε by Tobias Oetiker et al., April 2001

Lecture 1: Short summary of LaTeX basics

A brief introduction to L A TEX

L A TEX for psychological researchers

DOING MORE WITH EXCEL: MICROSOFT OFFICE 2013

Creating Accessible Microsoft Word 2003 Documents Table of Contents

Microsoft Word 2010 Basics

Corel Ventura 8 Introduction

The basics of LaTeX. Cédric Buron. April 25, 2016

Latex Tutorial. CIS400 Senior Design 9/5/2013

L A TEX examples. a b c a b c b b a c b c c b a. This table was typeset with the following commands.

L A TEX Class Holiday Inn Fisherman s Wharf San Francisco, CA July Cheryl Ponchin Sue DeMerritt

David Helmbold, October 2005, Revised October 2007

Praktische Aspekte der Informatik. Moritz Mühlhausen Prof. Marcus Magnor

An Introduction to L A TEX

EVALUATION COPY. Unauthorized Reproduction or Distribution Prohibited

L A TEX for Psychological Researchers

Using Microsoft Word. Tables

Introduction to L A TEX

Written & Oral Presentation: Computer Tools

Guide to using L A TEX

CS 189 L A TEX and Linux: Text in Boxes

An Introduction to. Rado Ivanov CIS400 Senior Design Tutorial September 18, 2014

Microsoft Word Tutorial

DOWNLOAD PDF MICROSOFT OFFICE POWERPOINT 2003, STEP BY STEP

LearningLatex. % This file walks you through some basic things with LaTex % Thanks to Patrick Lam and Maya Sen for letting me borrow their materials

Began as TeX, in 1982 (Knuth). Purely a typesetting tool. LaTeX added macros, maintaining TeX as it s typesetting engine (Lamport).

Microsoft Excel 2010 Handout

Go to drive.google.com. Google Drive. Select Create an account

Research Method and Report Writing Lecture 4: An Introduction to L A TEX

Connect to CCPL

Excel 2010: Basics Learning Guide

LaTeX Workshop. While you re waiting, please make an account at

Documentation for TeXworks autocompleter

EXCEL BASICS: MICROSOFT OFFICE 2010

Intermediate Microsoft Office 2016: Word

LATEX TYPESETTING SYSTEM. CAAM 519, CHAPTER 3

Section 1 Microsoft Excel Overview

Excellent support for mathematical formatting. Automatically downloads/installs missing components as needed Updates somewhat frequently

Learn how to [learn] LATEX

PRISM Introduction to L A TEX

Transcription:

Exercises in LaTeX IDA on AAU Consistently the exercises are divided into a mandatory part and a bonus part. We expect all to do the exercises in the mandatory part, while the ones in the bonus part can be done according to needs, wishes and time. The level of difficulty will often be higher in this part, but typically it will also be here, where good advice to easier methods, more nice presentation and so on lies. If an exercise is given without the necessary command, inspiration can be sought in the slides. To solve the exercises the file Exercise_template.zip can be downloaded from the homepage here: http://jesper.noergaard.eu/latex/uk/exercisetemplate.zip. Unpack the file an easily accessible place, e.g. a Latex folder on the Desktop. Exercise 1 Including files and compiling The first you must do is open TeXMaker. - Open the file Masterdoc.tex in the exercise template. In this master document we have built a structure where preamble and \begin and \end{document}, which is required in every master document, is included. Study the file and the folders in the template. - Create a new document under File New or with Ctrl + N. - In here, write your first Latex text, e.g. This is my first body text. - Save the document as exercise1.tex in the folder files in the template. - Navigate back to the master document and include exercise1 with \include{}. - You are now ready to compile (or build) the document. It is always the master document, which is converted to PDF. On the compiler toolbar ( ) select Quick Build. Check in the settings (Options Configure TeXMaker Quick Build) that the command corresponds to PDFLatex + View PDF. Then press the blue arrow left of Quick Build on the toolbar to get the PDF document shown. - Write some more in exercise1, e.g. I have now included a document on a new line and with an empty line above (2x Enter). Save the file. - Navigate back to the master document and compile to see the change. - It is not necessary to navigate back to the master document every time to compile. Standing in the master document, you can select Define Current Document as Master Document under Options. This is now printed in the lower right corner and means you can compile from all the included documents. Write more to exercise1, compile here and see the result. Every time TeXMaker is opened, the Master document must be defined. - As you might have noticed in the folder, the PDF output takes name after the master document. Close TeXMaker and rename Masterdoc.tex to something more suited, e.g. Exercises.tex. Write some more to exercise1, compile and see the result.

Exercise 2 Chapters, sections and subsections Open the file exercise2.tex in the folder files. From the master document it can also be found in TeXMaker s structure window, where all the included files are shown. - Create a chapter with a random name. - Insert a section and a subsection with random names. - Forced page break can be made with \newpage. Insert one followed by some random text. - Create a chapter with random name in exercise1. Then every exercise gets a corresponding chapter for convenience. - Insert a heading a level deeper than \subsection maybe TeXMaker can help with the syntax. - Compile and see the result what happened to the numbering? It is coded in preamble that only up to and including \subsection is numbered. - With * after the command, the numbering can be removed from the heading. This is typically done for preface and table of contents. Try with e.g. \section*{}.

Exercise 3 Formatting of text Open the file exercise3.tex in the folder files. - Create a chapter called Formatting of text. - Insert some random text in bold style. - Insert some random text in italic style. - Replace the text with something else and compile. - Insert something in both bold and italic style. - Add a footnote, e.g. \footnote{italic is nice!} - If you should wish to change the alignment of words, lines or sections, the commands flushleft, flushright and center can be used. Try to write e.g.: \begin{flushright} Time is money \\ \textit{benjamin Franklin} \end{flushright} - Text can be colored with \textcolor{color}{text}. Play with different colors and text. - If the standard colors are not sufficient, you can make your own with \definecolor{name}{rgb}{0,160,0}. The numbers are RGB-colors (Red, Green, Blue) from 0-255. If interested, see more at http://en.wikibooks.org/wiki/latex/colors. - Play with some homemade colors and your own names.

Exercise 4 Lists Open the file exercise4.tex in the folder files. - Create a chapter called Lists. - Then insert the following code: This is an example of the use of lists in \LaTeX. We start out with a bullet list. \begin{itemize} \item Point 1 \item Point 2 \item Point 3 \end{itemize} It can also be a numbered list. \begin{enumerate} \item Pineapple \item Chocolate \item Banana \end{enumerate} - Replace the text in the lists with something else. Compile and see the result. - Add more points to the lists. Compile and see the result. - Add sub points to one of the lists. This is done by adding a new environment of \begin and \end. - You can choose the type of bullets yourself with e.g. \item[a.]. Play with the possibilities. - It can also be done more global for the entire list. You can add all signs/characters according to wish in [] after \begin{itemzie}, e.g. \begin{itemize}[label=$\star$]. Try to replace \star with \circ and/or other signs and see the result. - The counter in the numbered list can also be changed according to wish in [] after \begin{enumerate}, e.g. \begin{enumerate}[label=\alph*.]. Compile and see the result. - Other examples of the connection between type and sign: - \arabic*) 1), 2), 3) - \alph*. a., b., c. - \Alph*) A), B), C) - \roman*. i., ii., iii. - \Roman*. I., II., III.

Exercise 5 Insertion of figures Open the file exercise5.tex in the folder files. - Create a chapter called Figures. - Then insert the following code: This shows how a figure can be implemented in \LaTeX. \begin{figure}[htbp] \centering \includegraphics[width=1.00\textwidth]{figures/picture1.jpg} \caption{picture from Unifitness.} \label{fig:picture1} \end{figure} - Replace the figure with picture2.jpg. - Reduce the size to 50 % of the text width, change the caption and see the result. - Try to insert the two pictures side by side with minipage: \begin{figure}[htbp] \centering \begin{minipage}[b]{0.48\textwidth} \centering \includegraphics[width=1.00\textwidth]{figures/picture1.jpg} % Left picture \end{minipage} \hfill \begin{minipage}[b]{0.48\textwidth} \centering \includegraphics[width=1.00\textwidth]{figures/picture2.jpg} % Right picture \end{minipage} \\ % Captions and labels \begin{minipage}[t]{0.48\textwidth} \caption{caption 1.} % Left caption and label \label{fig:picture1} \end{minipage} \hfill \begin{minipage}[t]{0.48\textwidth} \caption{caption 2.} % Right caption and label \label{fig:picture2} \end{minipage} \end{figure} - Play with sizes, captions and pictures. - Is there a new warning? Make sure always to have unique labels!! - Add a random third picture, so there are three pictures side by side.

Exercise 6 Insertion of tables Open the file exercise6.tex in the folder files. - Create a chapter called Tables and a section Peters timetable. - Here is an example of a table: \begin{table}[htbp] \centering \begin{tabular}{ l l l l l l } % l for left, c for center, r for right \hline & Monday & Tuesday & Wednesday & Thursday & Friday \\\hline 09:00-10:00 & Chemistry & Danish & Math & Gym class & English \\\hline 10:00-11:00 & German & French & Biology & Metal & Physics \\\hline \end{tabular} \caption{peters timetable week 41.} \label{tab:timetable} \end{table} - Write all weekdays in bold style. - Insert an extra row in the tables, showing what Peter must attend between 11:00 12:00. - Insert two extra columns, showing what Peter does Saturday and Sunday - Center the content of the weekday columns. - Merge Saturday and Sunday into Weekend with the function \multicolumn. It requires three inputs: \multicolumn{no. of columns}{setup}{content}. Tip: Setup is about the alignment (l, c or r) and vertical lines. - Columns too wide for your taste can be narrowed with the function p{width} in the tablepreamble instead of l, c or r. Try to replace the first column s l with p{1cm}. The column is automatically left-aligned. It can be centered with >{\centering\arraybackslash}p{1cm}. - It is also possible to create more professional looking tables, where the top and bottom lines are thicker and the vertical lines are left out. On the next page there is an example.

\begin{table}[htbp] \centering \begin{tabular}{cccc} \toprule Sector & Area & Capacity & Price \\ \midrule A & 1200 & 900 & 400 \\ B & 1500 & 1250 & 500 \\ C & 1100 & 850 & 450 \\ \bottomrule \end{tabular} \caption{overview over the festival sectors.} \label{tab:sectors} \end{table} - Have a look at the code and notice the differences.

Part 2

Exercise 7 Insertion of mathematics Open the file exercise7.tex in the folder files. - Create a chapter called Mathematics. - Create a section called Favorite equations and insert the following code: \begin{align} x^2+y^2-4x+8y+11=0 \label{eq:favorite1} \end{align} \begin{align} P(x) = \frac{x - a}{b \cdot a} \end{align} - Eksperiment with other equations. - \cdot is one of the functions you quickly learn, when you type math in LaTeX. Try to replace it with \m and see what happens. The shortcut is coded in the preamble to ease the work. - Explore the toolbars with math and add more to the equations. - Add numbers and corresponding units with the command \SI{number}{unit} to one of the equations. - The commands from the SIunitx package is also used to write math outside the align environment. This is very useful in the body text, captions, tables and so on. - Create a section Math in the body text and insert the following code: The unit of volume is typically \si{m^3}. The gravitational acceleration is in Denmark \SI{9.82}{m/s^2}. The use of the SI macros gives a nice and consistent presentation of math. For greek letters or special characters, the \$\$-construction is used. Examples are $\alpha$ and $\Rightarrow$. - Experiment with other numbers, units and characters. - Try to insert 20 $\decc$. The shortcut is also coded in the preamble. - Add another line to one of the equations (line break with \\). - Play with the alignment (the lines are left-aligned where a & is placed in each line). - Add another line to the equation and remove the numbering from the two uppermost lines. This could be used at e.g. derivations, where only the final formula needs a number. - After the equations the symbols must be defined. This can with advantage be built with a nice and easy table. On the next page there is an example.

\begin{align} \Phi = \rho \m c_p \m q_v \m \Delta T \end{align} Hvor: \begin{table}[h] \begin{tabular}{l l} $\Phi$ & Heat flux [\si{w}] \\ $\rho$ & Density [\si{kg/m^3}] \\ $c_p$ & Heat capacity [\si{j/(kg K)}] \\ $\Delta T$ & Temperature difference [\si{k}] \end{tabular} \end{table} - Experiment with other numbers, units and signs.

Exercise 8 Internal references Open the file exercise8.tex in the folder files. - Create a chapter called Internal references. - Insert a \label{unique ID} after \chapter{mathematics} in exercise7. - Refer to the chapter with e.g. Chapter \ref{unique ID} dealt with math. - Compile 3 times and see what happens. Compiling 3 times is ALWAYS necessary, because references are a dynamical extension to LaTeX, writing information to other files. - Refer to the first equation in chapter 7. Try with both \ref and \eqref and see the difference. - Insert a random figure or table and refer to the element or refer to a figure/table in chapter 5/6. Remember to manually write figure, table, chapter, section or equation in front of the reference, given that the reference only inserts the number. - Insert a reference to a random element in some of the previous chapters, which also refers to the page number. See the slides for inspiration. - With the Quick Build function in TeXMaker you have the possibility to program your own compiler-macro. In this context is could be advantageous that Quick Build covered 3x PDFLatex + View PDF. Then you only need to press the arrow once and the document is built the mandatory 3 times. It can be programmed under Options Configure TeXMaker Quick Build. Alternatively, memorize the build shortcuts (can be found under Tools).

Exercise 9 Sources and citations Open the file exercise9.tex in the folder files. - Create a chapter called Sources and citations. - All sources are stored in the file bibtex/literature.bib. We want to add the first source, which is the book The Latex Companion. - Open the file bibtex/literature.bib and verify that the book is in there. - Create a citation to the book with \citep{label}. - As usual the document must be compiled. Start by compiling once with PDFLatex (change from Quick Build in the drop down menu or press F6) to include what you have just written. After this, BibTeX must be compiled separately, because it is an external module. Change to BibTeX in the menu (or press F11) and compile again (on Mac you might get an error just ignore it). Finally we need to compile the last 2 times with PDFLatex. - At the back of the report a literature list can now be found, including the citations used. Thus, the literature.bib can hold several sources, but they will not be added to the literature list before used in the project. - Try both a passive and an active citation and see the difference. See more in slides if needed. - Add a new source of the type manual in the file bibtex/literature.bib, make a citation and see the difference in the literature list. - It is possible to add your own text to the citation ( page 9, table 7.2, chapter 8 and so on). Try to insert some text in the squared brackets in \citep[]{label} and see what happens. - Is the text placed right next to the comma? Start with a space in the []. - As for the internal references, Quick Build can be programmed to handle the entire compiling process. The following macro holds what it takes: PDFLatex + BibTeX + 2x PDFLatex + View PDF.

Exercise 10 Configuration of your project You can seek inspiration to the file- and LaTeX structure of your project in the project template available on the homepage. http://jesper.noergaard.eu/latex/uk/projecttemplate.zip. - Explore the structure both the folders and Report.tex. - Modify the structure according to your wishes and needs. - If you have a group server ready, you can commit the structure to here (after a checkout) and then you are ready to use LaTeX and SVN. Enjoy! - Modify the header/footer (pagestyle) in the preamble, so it fits your project. - If the chapter layout doesn t fit into your taste, it can also be changed in the preamble. New chapterstyles can be found be Googling memoir chapter styles. The first hit is a document with several different styles.