Academic Skills in Computer Science (ASiCS) II) Text Processing - - PowerPoint PPT Presentation

academic skills in computer science asics ii text
SMART_READER_LITE
LIVE PREVIEW

Academic Skills in Computer Science (ASiCS) II) Text Processing - - PowerPoint PPT Presentation

Fakultt Informatik Institut fr Software- und Multimediatechnik - Lehrstuhl fr Softwaretechnologie Academic Skills in Computer Science (ASiCS) II) Text Processing with Latex II.1) Introduction to Latex 30.04.2015 Agenda LaTeX


slide-1
SLIDE 1

Fakultät Informatik Institut für Software- und Multimediatechnik - Lehrstuhl für Softwaretechnologie

Academic Skills in Computer Science (ASiCS) II) Text Processing with Latex II.1) Introduction to Latex

30.04.2015

slide-2
SLIDE 2
  • LaTeX – Language features and syntax
  • BibTeX – Bibliographies for LaTeX
  • LaTeX – Tools and compiler

Agenda

30.04.2015 2

slide-3
SLIDE 3

[1] Sascha Lüdecke: Einführung in LaTeX.

http://www.meta-x.de/faq/LaTeX-Einfuehrung.html

[2] Sascha Frank: LaTeX Umlaute.

http://www.namsu.de/Extra/befehle/Umlaute.html

[3] Manuela Jürgens, Thomas Feuerstack: LaTeX – Eine Einführung und ein bisschen mehr…

http://www.fernuni-hagen.de/imperia/md/content/zmi_2010/a026_latex_einf.pdf

[4] Manuela Jürgens: LaTeX – Fortgeschrittene Anwendungen. Oder: Neues von den Hobbits…

http://www.fernuni-hagen.de/imperia/md/content/zmi_2010/a027_latex_fort.pdf

LITERATURE

30.04.2015 3

slide-4
SLIDE 4

LATEX

30.04.2015 4

Language Features and Syntax

slide-5
SLIDE 5
  • TeX (Tau Epsilon Chi) by Donald E. Knuth, 1978
  • Open-Source solution for layout of print media
  • Including formulas and tables
  • Available for almost every OS
  • LaTeX: Frontend for TeX by Leslie Lamport in the 1980s
  • User responsible for logical document structure only
  • LaTeX code translated into TeX
  • Predefined layouts including font sizes, line distances etc.

Origins

30.04.2015 5

slide-6
SLIDE 6
  • LaTeX is not a WYSIWYG-Editor (What you see is what you get)
  • Philosophy: write Content, not Layout
  • But: many tools provide hot updates today
  • Quasi-WYSIWYG
  • Alternatively:

WYSIWYM (What you see is what you mean)-Frontends such as Lyx

  • Advantages
  • Platform-independent
  • No depedencies to system fonts
  • Output is always the same
  • Generation of table of contents, bibliography, glossary, …
  • Output is print-ready (e.g., PDF)

WYSIWYG?

30.04.2015 6

slide-7
SLIDE 7
  • Today LaTeX is the de-facto standard for publications in science

(at least in computer science)

  • Submission of papers almost always as LaTeX files

(e.g., Springer, ACM)

  • Proceedings layout and Styles often as LaTeX styles

Why LaTeX?

30.04.2015 7

slide-8
SLIDE 8

Compilation Process

30.04.2015 8

Doc.tex Doc.pdf LaTeX2PDF Compiler

  • Creation of table of contents, bibliography etc.

requires up to three iterations for updating references!

slide-9
SLIDE 9
  • Commands start with back slash (\)
  • Following parameters ([]) und content ({})
  • Example:
  • \documentclass[ngerman]{article}

LaTeX Syntax

30.04.2015 9

slide-10
SLIDE 10
  • 1. Style
  • Document class (e.g., article, book, beamer (slides), …)
  • 2. Preamble
  • Metadata such as title, author
  • Package and library imports
  • 3. Body
  • Real content, structured by chapters, sections, slides etc.

Document Structure

30.04.2015 10

slide-11
SLIDE 11

\documentclass{scrartcl} \title{My first Document} \author{John Doe} \usepackage[english]{babel} \begin{document} \maketitle Hello World! Next paragraph. \end{document}

Document Structure

30.04.2015 11

Style Preamble Body [1] Package Imports: Packages exist for almost each

  • requirement. They can be

found and browsed here http://www.ctan.org/

slide-12
SLIDE 12

\chapter{A Chapter} % only for scrbook not for scrartcl \section{A Section} \subsection{A Subsection} \subsubsection{Further below} \paragraph{And even further}

  • 1. A Chapter

1.1 A Section

1.1.1 A Subsection

Further below And even further

Sections

30.04.2015 12

Latex2Pdf Compiler

slide-13
SLIDE 13

Sections

30.04.2015 13

\section{A Section} \section*{A Section not to be numbered} \section{Next Section}

  • 1. Section

A Section not to be numbered

  • 2. Next Section

LaTeX2PDF Compiler Will also not appear in the table of contents.

slide-14
SLIDE 14

\tableofcontents

Table of Contents

  • 1. A Chapter .…………………. 1

1.1 A Section ……………………… 3

1.1.1 A Subsection ………..…………………. 5

Table of Contents

30.04.2015 14

Latex2Pdf Compiler

slide-15
SLIDE 15

Appendix

30.04.2015 15

\section{A Section} \appendix \section{Section in Appendix}

  • 1. Section
  • A. Section in Appendix

LaTeX2PDF Compiler

slide-16
SLIDE 16

\section{A Section} \label{section1} This is some text with a reference to Section \ref{section1}. 1.1 A Section

This is some text with a reference to Section 1.1.

References

30.04.2015 16

Latex2Pdf Compiler

slide-17
SLIDE 17
  • A so-called protected white space
  • No linebreak allowed at this position.

This is some text with a reference to Section \ref{section1}. This is some text with a reference to Section~\ref{section1}.

1.1 A Section

This is some text with a reference to Section 1.1. This is some text with a reference to Section 1.1.

The Tilde

30.04.2015 17

Latex2Pdf Compiler

slide-18
SLIDE 18

Besides numbers of figures, tables, sections, … you can also refer to page numbers: See figure~\ref{fig:test} on page~\pageref{fig:test}. See figure 1.2 on page 8.

References

30.04.2015 18

LaTeX2PDF Compiler

slide-19
SLIDE 19
  • Based on automated algorithm
  • Can be itchy, especially for German compound words.

Global rules (in preamble)

\hyphenation{Sil-ben-tren-nung Al-go-rith-mus}

Local rules

\- Break at this position only Staats\-ver\-trag "- Additional break at this position Staats"-vertrag "= Additional hyphen Karl"=Franzensuniversität "~ Hyphen without break (Haupt"~)Straße

Hyphenation

30.04.2015 19

Only for German documents!

slide-20
SLIDE 20
  • Sometimes, hyphenation won‘t work at all:

Overfull \hbox (305.0842pt too wide) in paragraph at lines 20--22

  • Means that somewhere a word is longer than its current line:
  • % Marks overful lines with black bar.

\setlength{\overfullrule}{4pt}

Hyphenation

30.04.2015 20

slide-21
SLIDE 21

\tiny \scriptsize \footnotesize \small \normalsize (standard) \large \Large \LARGE \huge \Huge

Font Size

30.04.2015 21

→ You typically do not alter your font size in points but using these relative sizes!

slide-22
SLIDE 22

\textrm{Roman} \textit{Italics} \textbf{Bold} \textsc{Capitals} \texttt{Typewriter} \textnormal{Normal}

Font Formats

30.04.2015 22

Roman Italics Bold CAPITALS Typewriter Normal LaTeX2PDF Compiler

slide-23
SLIDE 23
  • Umlauts must be handled especially [2]
  • 1. Markup in text
  • \“a, \“o, \“u, \“A, … → ä, ö, ü, Ä, …
  • \ss → ß
  • 2. Easier solution: package import in preamble
  • \usepackage[utf8]{inputenc}

Umlauts

30.04.2015 23

slide-24
SLIDE 24

\begin{itemize} \item First \item Second \end{itemize} \begin{enumerate} \item First \item Second \item[III] Third \end{enumerate}

Enumerations

30.04.2015 24

  • First
  • Second
  • 1. First
  • 2. Second
  • III. Third

LaTeX2PDF Compiler

slide-25
SLIDE 25

\begin{figure}[h]

% requires \usepackage{graphicx}

\includegraphics[width=\textwidth] {bilder/bild1.pdf} \caption{Caption.} \label{bild1} \end{figure} Reference to Figure~\ref{bild1}.

Figures

30.04.2015 25

slide-26
SLIDE 26

\begin{figure}[h] \includegraphics[width=\textwidth] {pictures/bild1.pdf} \caption{Caption.} \label{bild1} \end{figure} Reference to Figure~\ref{bild1}.

Figures

30.04.2015 26

Typical formats: PNG, PDF

slide-27
SLIDE 27

\begin{figure}[h] \includegraphics[width=\textwidth] {bilder/bild1.pdf} \caption{Caption.} \label{bild1} \end{figure} Reference to Figure~\ref{bild1}.

Figures

30.04.2015 27

Caption. Must be in front of the label (otherwhise the label won‘t work)!

slide-28
SLIDE 28

\begin{figure}[h] \includegraphics[width=\textwidth] {bilder/bild1.pdf} \caption{Caption.} \label{bild1} \end{figure} Reference to Figure~\ref{bild1}.

Figures

30.04.2015 28

Width of figure (optional). Value in cm, px, em. Also use

  • f variables possible:

\textwidth, \columnwidth

slide-29
SLIDE 29

\begin{figure}[h] \includegraphics[width=\textwidth] {bilder/bild1.pdf} \caption{Caption.} \label{bild1} \end{figure} Reference to Figure~\ref{bild1}.

Figures

30.04.2015 29

Positioning of figure: h = Here (in text) t = Top (of page) b = Bottom (of page) p = Page (separate page) ! + position = force position

slide-30
SLIDE 30

\begin{table}[h] \begin{tabular} {|l|r} \hline Column 1 & Column 2 \\ \hline a & b \\ c & d \\ \hline \end{tabular} \caption{Text} \label{table1} \end{table}

Tables

30.04.2015 30

Column 1 Column 2 a b c d LaTeX2PDF Compiler

slide-31
SLIDE 31

Column 1 Column 2 a b c d \begin{table}[h] \begin{tabular} {|l|r} \hline Column 1 & Column 2 \\ \hline a & b \\ c & d \\ \hline \end{tabular} \caption{Text} \label{table1} \end{table}

30.04.2015 31

Positioning h = here in the text t = Top (of the page) b = Bottom (of the page) p = Page (on separate page) ! + position = force position

Tables

slide-32
SLIDE 32

Column 1 Column 2 a b c d \begin{table}[h] \begin{tabular} {|l|r} \hline Column 1 & Column 2 \\ \hline a & b \\ c & d \\ \hline \end{tabular} \caption{Text} \label{table1} \end{table}

30.04.2015 32

Text Alignment: l = left r = right c = centered p{2cm} = justified with column width

Tables

slide-33
SLIDE 33

Column 1 Column 2 a b c d \begin{table}[h] \begin{tabular} {|l|r} \hline Column 1 & Column 2 \\ \hline a & b \\ c & d \\ \hline \end{tabular} \caption{Text} \label{table1} \end{table}

30.04.2015 33

Vertical lines

Tables

slide-34
SLIDE 34

Column 1 Column 2 a b c d \begin{table}[h] \begin{tabular} {|l|r} \hline Column 1 & Column 2 \\ \hline a & b \\ c & d \\ \hline \end{tabular} \caption{Text} \label{table1} \end{table}

30.04.2015 34

Horizontal Lines

Tables

slide-35
SLIDE 35

\begin{table}[h] \begin{tabular} {|l|r} \hline Column 1 & Column 2 \\ \hline a & b \\ c & d \\ \hline \end{tabular} \caption{Text} \label{table1} \end{table} Column 1 Column 2 a b c d

30.04.2015 35

Column separation and Newline

Tables

slide-36
SLIDE 36

36

public class Main { public static void main(String[] args) { System.out.println("Hello World"); } }

\usepackage{lstlistings} \lstset{language=Java} \begin{lstlisting}[label={list1},caption={Listing Caption}] public class Main { public static void main(String[] args) { System.out.println("Hello World"); } } \end{lstlisting}

Listings

30.04.2015

Package import in preamble! Details in manual! Language for syntax highlighting LaTeX2PDF Compiler

slide-37
SLIDE 37
  • Separation of logical parts into own files
  • Figures and listings into own folders
  • Easy to rearrange and restructure

\input{sections/intro} \input{sections/fontsize} \input{sections/fontshape} \input{sections/numerations} \input{sections/images} \input{sections/tables} \input{sections/listings}

Project Structure

30.04.2015 37

File intro.tex is imported

slide-38
SLIDE 38

BIBTEX

30.04.2015 38

Bibliographies for LaTeX

slide-39
SLIDE 39

Bibliography

30.04.2015 39

  • Always underpin statements or claims with citations
  • Don‘t do it like Guttenberg or Schavan!
  • BibTeX extends LaTeX with easy and reusable bibliographies
  • Management of citations according to your citation style
  • E.g., [RWD+12] or [Reiman et al. 2012] or [1],[2]…
  • Creation of bibliography containing all citations of your

LaTeX-document

  • Excludes non-cited sources!
  • Literature is stored in *.bib files
slide-40
SLIDE 40

Bibliography

30.04.2015 40

@INPROCEEDINGS{Reimann2012a, author = {Reimann, Jan and Wilke, Claas and Demuth, Birgit and Muck, Michael and A\{ss}mann, Uwe}, title = {{Tool Supported OCL Refactoring Catalogue}}, booktitle = {Workshop on OCL and Textual Modelling (OCL 2012)}, year = {2012} } Citation in document: \cite{Reimann2012a} Printing the bibliography: \bibliographystyle{abbrv} %myBib.bib contains the entries \bibliography{myBib}

slide-41
SLIDE 41

Bibliography

30.04.2015 41

  • Different types of entries possible
  • @book – Book
  • @inproceedings – Conference paper
  • @article – Journal article
  • @masterthesis – Diploma and master theses
  • @misc – Anything else
slide-42
SLIDE 42

LATEX

30.04.2015 42

Tools and Compiler

slide-43
SLIDE 43
  • De-Facto Standard LaTeX-Compiler for Windows
  • http://miktex.org/
  • Comes with: TexWorks
  • There are others: TeXLive,…

MikTeX

30.04.2015 43

slide-44
SLIDE 44
  • Combination of
  • simple LaTeX editor
  • LaTeX compiler
  • PDF viewer
  • No syntax highlighting

TexWorks

30.04.2015 44

slide-45
SLIDE 45
  • Seit Windows Vista mit Windows ausgeliefert
  • Kombination aus einfachem LaTeX-Editor, -Compiler und PDF-Viewer

TexWorks

30.04.2015 45

slide-46
SLIDE 46
  • Extensive LaTeX editor for Windows
  • Code Completion
  • Syntax Highlighting
  • Integrated BibTex-Editor
  • http://texniccenter.org/

TeXnicCenter

30.04.2015 46

slide-47
SLIDE 47
  • Umfangreicher LaTeX-Editor für Windows
  • Code Completion
  • Syntax Highlighting
  • Integrierter BibTex-Editor
  • Kein eigener Compiler
  • Integration von MikTeX notwendig
  • Kein eigener PDF-Viewer
  • Einfache Kombination mit PDF-Viewer (Adobe, Sumatra, …)
  • http://miktex.org/

TeXnicCenter

30.04.2015 47

slide-48
SLIDE 48
  • Extensive LaTeX editor for Eclipse
  • Code Completion
  • Syntax Highlighting
  • Integrated BibTex-Editor
  • Platform-independent
  • http://texlipse.sourceforge.net/

TeXlipse

30.04.2015 48

slide-49
SLIDE 49
  • Umfangreicher LaTeX-Editor für Windows
  • Code Completion
  • Syntax Highlighting
  • Integrierter BibTex-Editor
  • Integration in Eclipse
  • Kein eigener Compiler
  • Integration von MikTeX notwendig
  • Kein eigener PDF-Viewer
  • Einfache Kombination mit PDF-Viewer (Adobe, Sumatra, …)
  • http://texlipse.sourceforge.net/

TeXlipse

30.04.2015 49

slide-50
SLIDE 50
  • Lightweight PDF viewer for Windows
  • No hard links to open PDF files
  • Document can be regenerated without closing it
  • blog.kowalczyk.info/software/sumatrapdf/

Sumatra

30.04.2015 50

slide-51
SLIDE 51
  • Reference manager for BibTex
  • Platform-independent (Java)
  • http://jabref.sourceforge.net/

JabRef

30.04.2015 51

slide-52
SLIDE 52

30.04.2015 52 [http://upload.wikimedia.org/wikipedia/commons/8/84/Jabref-2.2-screenshot.png]

slide-53
SLIDE 53

Questions?

30.04.2015 53