Tables and Figures#
Objective: Learn the basic commands to create and edit tables.
Tables#
Basic tables can be created with a combination of the commands below and the use package: tabularx
Basic Commands |
Description |
---|---|
|
column alignment |
|
ampersand separates columns |
|
double backslash begins new row |
|
horizontal line |
| |
vertical line |
Example: Creating a basic two column table#
Example: Adding vertical and horizontal lines#
Exercise 1#
Use the tabularx
package to create a simple table of the US Women’s Soccer Team’s 2019 World Cup Starting Roster: https://www.ussoccer.com/players
Begin with a header row and two columns.
Your two column headers will be: Position and Last Name – Left align the text of the left column
Center the text of the right column
Add vertical and horizontal lines
Add a caption “2019 Team Roster” and center the table.
Note: Using the \caption{}
command will add the phrase “Table 1” in front of caption.
Use package needed: tabularx
Commands needed:
&
= column separator
\\
= begin new row
l, r, c
= column alignment
Position |
Last Name |
---|---|
GK |
Naeher |
D |
Sauerbrunn |
D |
Dahlkemper |
D |
O’Hara |
D |
Dunn |
M |
Mewis |
M |
Ertz |
Exercise 2#
Create a table like the one below with columns spanning multiple rows or rows spanning multiple columns.
Questions?
Consult the answer key in the Overleaf Project to troubleshoot: https://www.overleaf.com/read/vkpyvmhgzsgm
More information sources:
Roster: https://www.ussoccer.com/players
Tables info: https://en.wikibooks.org/wiki/LaTeX/Tables
Multicolumn/Multirow: https://en.wikibooks.org/wiki/LaTeX/Tables
Figures#
Objective: Learn to upload and position figures in Overleaf.
Uploading a figure#
Incorporating images and figures into your Overleaf project is best accomplished by creating your figures, particularly graphs and plots, outside of Overleaf and then importing them into Overleaf.
Click on the “upload” icon and navigate to the location of your figure.
Figure Placement#
Use the following specifiers to adjust the placement of your figures.
Specifier |
Permission |
---|---|
h |
Place the float here: approximately, not exactly, at the same point it occurs in the source text |
t |
Position at the top of the page |
b |
Position at the bottom of the page |
p |
Put on a special page for floats only |
! |
Override internal parameters LaTeX uses for determining “good” float positions |
H |
Places the float at precisely the location in the LaTeX code. Requires the float package. This is somewhat equivalent to h! |
Exercise 3: Upload a figure#
To upload image, choose an image of your own, or find file at: EPS-Libraries-Berkeley/LaTeX
Download keyboard_cat.png, and upload file to the Overleaf project.
Place image with these commands:
\usepackage{graphicx}
\includegraphics[width=0.4\textwidth]{keyboard_cat}
Exercise 4: Designate figure position#
Use b, t, h to see where figure moves. You might need to add additional text in the document to see how the figure placement varies.
\begin{figure}[b]
\centering
\includegraphics[width=0.6\textwidth]{keyboard_cat}
\end{figure}
Syncing and Uploading figures hosted elsewhere#
Find more information about syncing and hosting your figures outside of Overleaf.
Google Drive: https://www.overleaf.com/help/247-how-can-i-upload-files-from-google-drive#.W4WtwhPwZE5
GitHub/Dropbox: https://www.overleaf.com/help/343#.W4WtgxPwZE4