latex font styles - computer science, fsulangley/cop4342-2008-fall/24-document2.pdf · modify the...

30
Fall 2008 Document preparation L A T E X font styles Text shape: you can choose a text “shape” with various “text” commands: \textit{italics text} \textsl{slanted text} \textsc{small caps text} italics text slanted text SMALL CAPS TEXT 1

Upload: others

Post on 24-Jun-2020

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: LATEX font styles - Computer Science, FSUlangley/COP4342-2008-Fall/24-document2.pdf · modify the font size and font family, and many other effects. 26. Fall 2008 Document preparation

Fall 2008 Document preparation

LATEX font styles

+ Text shape: you can choose a text “shape” withvarious “text” commands:\textit{italics text}\textsl{slanted text}\textsc{small caps text}

italics textslanted textSMALL CAPS TEXT

1

Page 2: LATEX font styles - Computer Science, FSUlangley/COP4342-2008-Fall/24-document2.pdf · modify the font size and font family, and many other effects. 26. Fall 2008 Document preparation

Fall 2008 Document preparation

LATEX font styles

+ Text weight: you can also choose text “weight” with“text” commands:\textmd{medium weight}\\\textbf{boldface weight}\\

medium weight boldface weight

2

Page 3: LATEX font styles - Computer Science, FSUlangley/COP4342-2008-Fall/24-document2.pdf · modify the font size and font family, and many other effects. 26. Fall 2008 Document preparation

Fall 2008 Document preparation

LATEX font styles

+ Text families: you can also choose text families with“text” commands:\textrm{Roman family}\textsf{Sans serif family}\texttt{Typewriter/teletype family}

Roman familySans serif familyTypewriter/teletype family

3

Page 4: LATEX font styles - Computer Science, FSUlangley/COP4342-2008-Fall/24-document2.pdf · modify the font size and font family, and many other effects. 26. Fall 2008 Document preparation

Fall 2008 Document preparation

LATEX font styles

+ Also, you can use \usepackage{family} tospecify a font family:\usepackage{avant}\usepackage{bookman}\usepackage{chancery}\usepackage{charter}\usepackage{courier}\usepackage{newcent}\usepackage{palatino}

4

Page 5: LATEX font styles - Computer Science, FSUlangley/COP4342-2008-Fall/24-document2.pdf · modify the font size and font family, and many other effects. 26. Fall 2008 Document preparation

Fall 2008 Document preparation

Font sizes

You can use the following commands to modify thecurrent font size:

\tiny\scriptsize\footnotesize\normalsize\large\Large\LARGE\huge\Huge

5

Page 6: LATEX font styles - Computer Science, FSUlangley/COP4342-2008-Fall/24-document2.pdf · modify the font size and font family, and many other effects. 26. Fall 2008 Document preparation

Fall 2008 Document preparation

LATEX tables

LATEX has two table-related environments: “table”and “tabular”.

The floating “table” enviroment is used to specifylocation and captioning.

The “tabular” environment is used to format theactual table.

6

Page 7: LATEX font styles - Computer Science, FSUlangley/COP4342-2008-Fall/24-document2.pdf · modify the font size and font family, and many other effects. 26. Fall 2008 Document preparation

Fall 2008 Document preparation

LATEX tables

\begin{table}[t] %% top placement\begin{tabular}{c|c|c} %% center everythingcenter & center & center \\\hline %% doesn’t need a \\center & center & center \\center & center & center \\\end{tabular}\end{table}

7

Page 8: LATEX font styles - Computer Science, FSUlangley/COP4342-2008-Fall/24-document2.pdf · modify the font size and font family, and many other effects. 26. Fall 2008 Document preparation

Fall 2008 Document preparation

Table placement

You can suggest locations for tables, which are“float”. You can use the following location suggestions,and you may list them in order of your preference:

+ h – “here”. Try to place the table where at this pointin the text.

+ t – “top”. Try to place the table at the top of thecurrent page; if it doesn’t fit, try to place it at the top

8

Page 9: LATEX font styles - Computer Science, FSUlangley/COP4342-2008-Fall/24-document2.pdf · modify the font size and font family, and many other effects. 26. Fall 2008 Document preparation

Fall 2008 Document preparation

of the next page.

+ b – “bottom”. Try to place the table at the bottom ofthe current page; if it doesn’t fit, try to place it at thebottom of the next page.

+ p – “page”. Place the table on a separate page fortables and figures.

9

Page 10: LATEX font styles - Computer Science, FSUlangley/COP4342-2008-Fall/24-document2.pdf · modify the font size and font family, and many other effects. 26. Fall 2008 Document preparation

Fall 2008 Document preparation

Formatting columns

The \begin{tabular}{FORMAT} command allowsyou to specify column formatting.

l %% column is left-justifiedc %% column is centeredr %% column is right-justified| %% draws a vertical|| %% draws two vertical lines together

10

Page 11: LATEX font styles - Computer Science, FSUlangley/COP4342-2008-Fall/24-document2.pdf · modify the font size and font family, and many other effects. 26. Fall 2008 Document preparation

Fall 2008 Document preparation

Specifying data in the table

Horizontal “data” lines end in “\\”.

Column entries are divided by ampersands (“&”).

Horizontal rules can be drawn with “\hline”.

For example:

\begin{tabular}{l|l||l}Command & Arguments & Explanation\\\hline{\tt break} & \verb+[file:]function+ & Sets a breakpoint at function\\\end{tabular}

11

Page 12: LATEX font styles - Computer Science, FSUlangley/COP4342-2008-Fall/24-document2.pdf · modify the font size and font family, and many other effects. 26. Fall 2008 Document preparation

Fall 2008 Document preparation

Figures

LATEX supports a “figure” environment, where youcan place a graphic of some sort (though I think thatgenerally it is best to stick with either encapsulatedPostScript R©; however, the “png” format generally worksfine also.)

12

Page 13: LATEX font styles - Computer Science, FSUlangley/COP4342-2008-Fall/24-document2.pdf · modify the font size and font family, and many other effects. 26. Fall 2008 Document preparation

Fall 2008 Document preparation

Figures

\begin{figure}[PLACEMENT]\includegraphics[OPTIONS]{FILENAME}\caption{CAPTION}\label{LABEL}\end{figure}

13

Page 14: LATEX font styles - Computer Science, FSUlangley/COP4342-2008-Fall/24-document2.pdf · modify the font size and font family, and many other effects. 26. Fall 2008 Document preparation

Fall 2008 Document preparation

Figures

Note that the PLACEMENT is an option specifiedwith [ ], not a requirement as with the tableenvironment.

14

Page 15: LATEX font styles - Computer Science, FSUlangley/COP4342-2008-Fall/24-document2.pdf · modify the font size and font family, and many other effects. 26. Fall 2008 Document preparation

Fall 2008 Document preparation

Options

width= %% you can specify a width, such as [width=5in]

height= %% you can specify a height, such as [height=5in]

scale= %% you can specify a scaling factor, such as [scale=0.75]

angle= %% you can specify an angle in degrees, such as [angle=45]

15

Page 16: LATEX font styles - Computer Science, FSUlangley/COP4342-2008-Fall/24-document2.pdf · modify the font size and font family, and many other effects. 26. Fall 2008 Document preparation

Fall 2008 Document preparation

Figure example

Figure 1: FSU 1851 logo

\begin{figure}[h]\centering\includegraphics[width=2.2in]{fsu-1851-trans.png}

16

Page 17: LATEX font styles - Computer Science, FSUlangley/COP4342-2008-Fall/24-document2.pdf · modify the font size and font family, and many other effects. 26. Fall 2008 Document preparation

Fall 2008 Document preparation

\caption{FSU 1851 logo}\end{figure}

17

Page 18: LATEX font styles - Computer Science, FSUlangley/COP4342-2008-Fall/24-document2.pdf · modify the font size and font family, and many other effects. 26. Fall 2008 Document preparation

Fall 2008 Document preparation

Another figure example

Figure 2: FSU 1851 logo

\begin{figure}[h]\centering\includegraphics[width=1.6in,angle=30]{fsu-1851-trans.png}

18

Page 19: LATEX font styles - Computer Science, FSUlangley/COP4342-2008-Fall/24-document2.pdf · modify the font size and font family, and many other effects. 26. Fall 2008 Document preparation

Fall 2008 Document preparation

\caption{FSU 1851 logo}\end{figure}

19

Page 20: LATEX font styles - Computer Science, FSUlangley/COP4342-2008-Fall/24-document2.pdf · modify the font size and font family, and many other effects. 26. Fall 2008 Document preparation

Fall 2008 Document preparation

Lists in LATEX

There are many types of lists possible in LATEX.

For instance, you can use:

+ itemize – bulleted lists

+ enumerate – numbered lists

+ description – customized lists

20

Page 21: LATEX font styles - Computer Science, FSUlangley/COP4342-2008-Fall/24-document2.pdf · modify the font size and font family, and many other effects. 26. Fall 2008 Document preparation

Fall 2008 Document preparation

+ dinglist – a type of customized used on this list

21

Page 22: LATEX font styles - Computer Science, FSUlangley/COP4342-2008-Fall/24-document2.pdf · modify the font size and font family, and many other effects. 26. Fall 2008 Document preparation

Fall 2008 Document preparation

Lists in LATEX

The general form is

\begin{LISTTYPE}\item\item...

\item\end{LISTTYPE}

22

Page 23: LATEX font styles - Computer Science, FSUlangley/COP4342-2008-Fall/24-document2.pdf · modify the font size and font family, and many other effects. 26. Fall 2008 Document preparation

Fall 2008 Document preparation

Example of a list

\begin{dinglist}{\DingListSymbolA}\item {\tt itemize} -- bulleted lists\item {\tt enumerate} -- numbered lists\item {\tt description} -- customized lists\item {\tt dinglist} -- a type of customized used on this list (via\verb+\usepackage{pifont}+, which gives you access to ding characters)\end{dinglist}

23

Page 24: LATEX font styles - Computer Science, FSUlangley/COP4342-2008-Fall/24-document2.pdf · modify the font size and font family, and many other effects. 26. Fall 2008 Document preparation

Fall 2008 Document preparation

Arbitrary text rotation

You can use the package “rotating” to do arbitrarilyrotated text:

Rotate this text

\usepackage{rotating}...\begin{rotate}{30}Rotate this text\end{rotate}

24

Page 25: LATEX font styles - Computer Science, FSUlangley/COP4342-2008-Fall/24-document2.pdf · modify the font size and font family, and many other effects. 26. Fall 2008 Document preparation

Fall 2008 Document preparation

The verbatim and Verbatim environments;inline verb

With the wide allocation of special characters todefault use in LATEX, it is often convenient go intoa mode that explicitly treats special characters asordinary ones. Since this very useful for displayingprogram code, these environments generally also aremonospaced and, by default, in a teletype font.

+ \verb – you can use the inline \verb to specify

25

Page 26: LATEX font styles - Computer Science, FSUlangley/COP4342-2008-Fall/24-document2.pdf · modify the font size and font family, and many other effects. 26. Fall 2008 Document preparation

Fall 2008 Document preparation

verbatim while in normal paragraph mode, such as%@*!)!%$%*!@ with \verb+%@*!)!%$%*!@+.

+ \begin{verbatim} – you can use the standardverbatim environment for multiline material

+ \begin{Verbatim} – if you do a \usepackage{fancyvrb}you can include verbatim material in footnotes,modify the font size and font family, and many othereffects.

26

Page 27: LATEX font styles - Computer Science, FSUlangley/COP4342-2008-Fall/24-document2.pdf · modify the font size and font family, and many other effects. 26. Fall 2008 Document preparation

Fall 2008 Document preparation

Fancy Verbatim

The output of the following

\begin{Verbatim}[fontshape=it,frame=leftline,fontsize=\scriptsize]Easy to see what is thereWhen the left line is whereWe might care\ end{Verbatim}

is on the next slide...

27

Page 28: LATEX font styles - Computer Science, FSUlangley/COP4342-2008-Fall/24-document2.pdf · modify the font size and font family, and many other effects. 26. Fall 2008 Document preparation

Fall 2008 Document preparation

Fancy Verbatim

Easy to see what is thereWhen the left line is whereWe might care

28

Page 29: LATEX font styles - Computer Science, FSUlangley/COP4342-2008-Fall/24-document2.pdf · modify the font size and font family, and many other effects. 26. Fall 2008 Document preparation

Fall 2008 Document preparation

Multiple columns

You can also create multicolumn output in the middleof a page with the “multicol” package:

\documentclass[12pt]{article}\usepackage{multicol}\begin{document}\setlength{\columnseprule}{1pt} %% make a one pt rule between columnsNot multicolumn in the beginning, but the next bit is:\begin{multicols}{3}This is 3 col material in the middle of a page, instead of for thewhole document. It’s convenient on occasion, but usually the tabularenvironment is what you want, not multicol.\end{multicols}

29

Page 30: LATEX font styles - Computer Science, FSUlangley/COP4342-2008-Fall/24-document2.pdf · modify the font size and font family, and many other effects. 26. Fall 2008 Document preparation

Fall 2008 Document preparation

And then back to single column mode.\end{document}

30