1 of 13

Scientific Writing

Latex 2

Writing for Computer Science

Introduction

Computer Science

Information Systems

1

2 of 13

Prepared by:

  • Storay Fazli

Writing for Computer Science

Introduction

Computer Science

Information Systems

2

3 of 13

Main topics/Contents

  • Latex Tables
  • Latex Colors
  • Latex Images
  • Latex Figures

Writing for Computer Science

Introduction

Computer Science

Information Systems

3

4 of 13

Latex Tables

  • Tables are an efficient way to represent the information and often used in most of the documents or files.
  • The table in latex are created with a combination of a tabular environments and the table environment.
  • The commands used to create table environment are:
    • \ begin{table}
    • \end{table\}
  • The tabular allows making a fancy environment with commands used to draw the horizontal and vertical lines.
  • The commands used to create tabular environment are:
    • \begin{tabular}{lcr}

Table

\end {tabular}

Writing for Computer Science

Introduction

Computer Science

Information Systems

4

5 of 13

Latex Tables (continued)

  • The command used to draw vertical lines separating the columns of the table is:
    • \begin{tabular}{l|c|r}
    • \vline command
  • If we want to draw a horizontal line ae a row separator, then we can use the \hline command.
  • The command \cline{i-j} is used to draw the partial horizontal line beginning with i and ending with j.
  • For the combined columns, the \multicolumn{num}{col}{text} command is used.
  • For combined rows \raisedbox{lift}{text} command is used.

Writing for Computer Science

Introduction

Computer Science

Information Systems

5

6 of 13

Latex Tables (continued)

Name

Salary

Age

Maryam

$70,000

25

Hedayat

$90,000

26

Ahmad

$30,000

24

  • For the single space between the rows, [-lex ] command and for double space the [1ex] command is used.
  • The booktabs command is used to make the document much professional because the \hline command doesn't do so.

Writing for Computer Science

Introduction

Computer Science

Information Systems

6

7 of 13

Latex Colors

  • The xcolor package supports adding colors to your text. Using this you can set the background, font color, and the page background. you can choose colors from the predefined color or you can create your color using RGB.
  • The package which is imported in the code or program is written as:
    • \usepackage{xcolor}
  • You can change the background color of a page using the \pagecolor{color name} command.
  • You can change the text background color \colorbox{anycolor}{text} command.
  • You can choose any color to highlight your text , you need a soul package with the xcolor package to impalement the highlight text. \usepackage{soul}

Writing for Computer Science

Introduction

Computer Science

Information Systems

7

8 of 13

Latex Colors (continued)

  • The commands used to access different numbers of colors are listed below:
    • usenames: It allows access to 16 base colors.
    • dvipsnames: It allows access to 64 more colors.
    • svgnames: It allows access to about 150 colors.
    • x11names:It offers more then 300 colors.
  • There are two ways of typing the colored text. One is by using the \textcolor command, and another is by using the \color command.
    • \textcolor{mentioned-color}{text}
    • {\color {mentioned-color}some text}

Writing for Computer Science

Introduction

Computer Science

Information Systems

8

9 of 13

Latex Colors Example

\documentclass{article}

\usepackage{xcolor}

\begine{document}

Latex is best

\newline

This is [\color[red] red color]

This is [\color[blue] blue color for latex]

\end{document}

Latex is best

This is red color This is blue color for latex

Writing for Computer Science

Introduction

Computer Science

Information Systems

9

10 of 13

Latex Images

  • The images are used to enhance the information in document or in any file. In latex we can enlarge, shrink, rotate, and can set the reference of the imagein our document. \usepackage{graphic}
  • To enclose all the images of apage in a frame, we can use showframe package. \usepackage{showframe}
  • You can rotate any image by specifying the angle in the \includegraphics command.
  • You can specify the height and width of the image according to the requirements. \includegraphics[width=(), height=()]{image}

Writing for Computer Science

Introduction

Computer Science

Information Systems

10

11 of 13

Latex Image Example

\documentclass[12pt]{article}

\usepackage{graphic}

\begin{document}

\includegraphics[scale=0.1]{Flowers}

\end{document}

Writing for Computer Science

Introduction

Computer Science

Information Systems

11

12 of 13

Latex Figures

  • The figures and graphs in latex are created using the figure environment, which is represented as:

\begin{figure}{where}

…….

\end{figure}

  • Where represent the location of the figure either at the top[t] or the bottom[b].
  • The floats solve the problem to fit the text that won't fit on the same/present page. The floats are the separate entities that are positioned in a port of the page, namely, top, bottom, middle, left, right, or wherever the design specifies.

\begin{figure}{placement specifier}

…….

\end{figure}

Writing for Computer Science

Introduction

Computer Science

Information Systems

12

13 of 13

Latex Figures (continued)

  • The \textwidth command is used to determine the width of the image.
  • The minipage command is used to put the things next to each other, which will be difficult otherwise.it is used to build an additional page within an existing page. For example, two image arranged side by side.
    • \begine{minipage}
    • \end{minipage}
  • For the reference, you need to include the refstyle package. \usepackage{refstyle}
  • For the replaced image of the same picture, the reflectbox command is used.
    • \reflectbox{%\includegraphics{…}}
  • To display multiple image you can use subfigure environment.

Writing for Computer Science

Introduction

Computer Science

Information Systems

13