Some LaTeX features

31
Some LaTeX features By Andreas Grondoudis 1

description

Some LaTeX features. By Andreas Grondoudis. Contents. This week we'll look at some TeX features Before specifics Already uploaded on my website; the PDF version of : http://en.wikibooks.org/wiki/Latex So this week Inserting and aligning images Inserting urls - PowerPoint PPT Presentation

Transcript of Some LaTeX features

Page 1: Some  LaTeX  features

1

Some LaTeX features

By Andreas Grondoudis

Page 2: Some  LaTeX  features

2

Contents

• This week we'll look at some TeX features• Before specifics– Already uploaded on my website; the PDF version

of : http://en.wikibooks.org/wiki/Latex• So this week– Inserting and aligning images– Inserting urls– Inserting citations and creating a list of references

Page 3: Some  LaTeX  features

3

{\LaTeX}

Page 4: Some  LaTeX  features

4

As you can see• Latex has more feature than any one person can know and

learn by heart• It is the most complete, document management and

preparation system• It is the choice of academia• Most of the times (just like any other application) we learn

what we want to use• So this session

– Inserting images– Inserting URLs– Citations and references

Page 5: Some  LaTeX  features

5

Basics – document with graphics

• Step 1 – create a new document

• Step 2 – use the wizard for a 'Quick Start'

• Step 3 – remember to tick the 'graphiccx Package' and click OK

Page 6: Some  LaTeX  features

6

So we have• Assuming we have

an image ready• Step 4 – Use LaTeX

and select includegraphics(file)

• Step 5 select, customise and click ok

Page 7: Some  LaTeX  features

7

So we got

• Here is the image we use and the whole page 'default' result

• Or we can use scale and instead of 1 go to .25-times or 3-times as big

Page 8: Some  LaTeX  features

8

placement• The [hbtp]– The h is for here– The b is for bottom– The t is for top– The p is for page

• Lets add some text and manipulate to see the results

Page 9: Some  LaTeX  features

9

So what will it look like?

Page 10: Some  LaTeX  features

10

The alignment• If we don't tick 'center' which inserts \centering

• Or \begin{flushleft} … \end{flushleft}• Same as \raggedright

• Or \begin{flushright} … \end{flushright}• Or use \raggedleft

• Notes:– Yes they are vise versa– Not much we can do about the caption (as it is

now)• Packages: wrapfig; floatfl; picins

– The above (ragged) commands will have effect until another command or the end of a markup section }

Page 11: Some  LaTeX  features

11

Inserting URL• Need to insert

– \usepackage{url} or \usepackage{hyperref}• Both will allow a url address to be entered• Only with using the second one will make the link clickable• Notes:

– Both will use equispaced (/code) font– The clickable will have a border around it

• To make it look number normal text (while still being a link)– \urlstyle{same}

• To remove the border– \hypersetup{pdfborder={0 0 0}}

• Or 4 0s if 3 don’t work

Page 12: Some  LaTeX  features

12

\usepackage{url}

Page 13: Some  LaTeX  features

13

\usepackage{hyperref}

Page 14: Some  LaTeX  features

14

Hiding the border & looking the same

Page 15: Some  LaTeX  features

15

References

• Very important for academic writing.• There are more than one way and system of

writing and using references. A wiki book is available

• Embedded listing: – easy, using numbered references

• Separate .bib file: – a little bit more work, using a separate file

Page 16: Some  LaTeX  features

16

Embedded listing• Just before the end of the document• Use the \begin{thebibliography} .. \end{thebibliogaphy}

environment• Then list all items used using the \bibitem– \begin{thebibliogaphy}

• \bibitem{familiar_name}– author, title, year, pages (what we talk about)

• \bibitem{another_familiar_name}– author, title, year, pages (what we talk about)

• ….• ….

– \end{thebibliography}

Page 17: Some  LaTeX  features

17

Embedded listing - citing

• After you have created the bibliography the document can refer to anything in the bibliography with the {familiar_name}

• Just use \cite{familiar_name} and the citation will be created

• Creates automatic numbering• Inserts a hyperlink cross-referencing the number with

the list of references at the bottom of the document– To hide the box from around the link use

• \hypersetup{pdfborder={0 0 0}}

Page 18: Some  LaTeX  features

18

Page 19: Some  LaTeX  features

19

The end result

Page 20: Some  LaTeX  features

20

Separate .bib file• In addition to the .tex

file you must create a .bib file which will include your references

• The .bib file is a text file that you can create in TexMaker using the Bibliography menubar item

• For every element on that you are given placeholders for the information

• Checkout the example on the next page

Page 21: Some  LaTeX  features

21

The .bib file• Pulled own

– Master– PhD– Book

• All you have to do is to go in the {•} and simply complete the appropriate detail.

• Note the first • of every entry is where you insert the familiar_name

Page 22: Some  LaTeX  features

22

Here is the file from my example

• The file is called 7_source.bib

Page 23: Some  LaTeX  features

23

Now that we have the .bib file

• We let the .tex source file know what it will use it.• Achieved with two commands at the end

• The first one is the style of the references• The second is the source file (the .bib file without the

extension)– If you want to use more than one you can, separate them by

commas (but no space after each comma)

Page 24: Some  LaTeX  features

24

\bibliographystyle {x}• http://en.wikibooks.org/wiki/LaTeX/Bibliography_Management#BibTeX

Page 25: Some  LaTeX  features

25

Citations

• Citations is the text inside the text that will refer to a name of one of the reference.. So as before

• Just use \cite{familiar_name} and the citation will be created

• Creates automatic numbering (when plain is used)• Inserts a hyperlink cross-referencing the number with

the list of references at the bottom of the document– To hide the box from around the link use

• \hypersetup{pdfborder={0 0 0}}

Page 26: Some  LaTeX  features

26

The .tex file

• We are not done yet…• Have to process .tex, then the .bib, and then

the .tex again (and possibly again)

Page 27: Some  LaTeX  features

27

In order to biblio to work• Multiple processing is required• First press F1 to quick build

– You might get some prompts mentioning that some references are unused• Then press F11 (Tools BibTex)

– This makes the bibliography and you get an output to confirm– Note, you might get mistakes, read them and correct them

• After that you have to F1 one (or maybe more times) to update the pdf

Page 28: Some  LaTeX  features

28

The end result

Page 29: Some  LaTeX  features

29

\bibliographystyle{alpha}

• At F1– It does NOT change

• At F11– The .aux file is changed

• At F1

• At the next F1, no output

Page 30: Some  LaTeX  features

30

The end result ({alpha})

• Obviously a year 2000 does not look good– Use authordate1 instead

Page 31: Some  LaTeX  features

31

This week’s summary

• Just mentioned the categories in which LaTeX can be used (and there are many)

• So we looked at only some specifics– Looked at inserting images– Looked at inserting URLs– Looked at creating references and citations