L TEX Typesetting: Muhammad Najmi Bin Ahmad Zabidi
L TEX Typesetting: Muhammad Najmi Bin Ahmad Zabidi
LATEX typesetting
[email protected]
KLBarcamp 2010
Agenda I
1 Intro to LATEX
Platform
2 Editors
Kile
Texworks
Vim
3 Simple example
4 Inserting codes
verbatim
listing
pygmentize
Pseudocode
5 Arabic and Jawi characters
6 Mathematics
KLBarcamp 2010
Agenda II
7 Writing book
Book cover
9 BibTeX
10 Reference
KLBarcamp 2010
Intro to LATEX
What is LATEX?
A typesetting program
KLBarcamp 2010
Intro to LATEX
For students
Writing research articles, assignments
Final year project report, theses/dissertations
It’s your call
For professionals
Writing technical reports, codes documentations
Resume :-)
Business cards, books
The rest up to you . . .
KLBarcamp 2010
Intro to LATEX
Almost every major operating systems i.e Linux, Windows and Mac
OS have LATEX applications.
Windows for example, using MikTeX
Mac OS using MacTeX
Linux uses TexLive
KLBarcamp 2010
Intro to LATEX
Platform
compile?
KLBarcamp 2010
Intro to LATEX
Platform
\ b e g i n {document}
\maketitle
%d e c l a r e , t h i s i s t h e tile
\begin{abstract}
S i m p l e i s j u s t s i m p l e , n o t h i n g e l s e . {\ l i p s u m [ 1 ] }
\end{ a b s t r a c t }
%now c l o s i n g , t h i s s h o u l d be a t t h e v e r y end . . .
\end{document}
KLBarcamp 2010
Simple example
KLBarcamp 2010
Inserting codes
Verbatim
\ begin { verbatim }
\ end { v e r b a t i m }
#i n c l u d e <s t d i o . h>
u s i n g namespace s t d ;
i n t main ( ) {
cout <<”H e l l o !”<< e n d l ;
return 0;}
KLBarcamp 2010
Inserting codes
verbatim
Result of verbatim
#include<stdio.h>
using namespace std;
int main()
{
cout<<"Hello!"<<endl;
return 0;
}
KLBarcamp 2010
Inserting codes
listing
1 Intro to LATEX
Platform
2 Editors
Kile
Texworks
Vim
3 Simple example
4 Inserting codes
verbatim
listing
pygmentize
Pseudocode
5 Arabic and Jawi characters
6 Mathematics
7 Writing book
Book cover
8 Tools to generate LATEX codes
kdissert
KLBarcamp 2010
Inserting codes
listing
listing package I
\ end { l s t l i s t i n g }
KLBarcamp 2010
Inserting codes
listing
listing package II
\ b e g i n { l s t l i s t i n g } [ l a n g u a g e=C++]
%p u t t h e o p t i o n o f l a n g u a g e i n [ ]
#i n c l u d e <s t d i o . h>
u s i n g namespace s t d ;
i n t main ( ) {
cout <<”H e l l o !”<< e n d l ;
return 0;}
\ end { l s t l i s t i n g }
KLBarcamp 2010
Inserting codes
listing
listing’s output
pygmentize I
import re
import sys
import GeoIP
GEOIP_DATABASE=’/usr/share/GeoIP/GeoIP.dat’
geoip=GeoIP.open(GEOIP_DATABASE,GeoIP.GEOIP_STANDARD)
for line in open("chcountry.txt"):
columns = line.split(’,’)
negara=geoip.country_name_by_addr(columns[0])
x=columns[1].strip("\n")
print columns[0],(’,’),negara,(’,’),x
KLBarcamp 2010
Inserting codes
pygmentize
#include<stdio.h>
using namespace std;
int main(){
cout<<"Hello!"<<endl;
return 0;}
KLBarcamp 2010
Inserting codes
Pseudocode
1 Intro to LATEX
Platform
2 Editors
Kile
Texworks
Vim
3 Simple example
4 Inserting codes
verbatim
listing
pygmentize
Pseudocode
5 Arabic and Jawi characters
6 Mathematics
7 Writing book
Book cover
8 Tools to generate LATEX codes
kdissert
KLBarcamp 2010
Inserting codes
Pseudocode
Displaying algorithms I
Algorithm 1 Modulus(n)
Require: Nilai integer n > 0 atau n < 0.
Ensure: Nilai n 6= 0.
1: if n dibahagi dengan 2 6= 0 then
2: return nombor ganjil
3: else
4: return nombor genap·
5: end if
KLBarcamp 2010
Inserting codes
Pseudocode
Displaying algorithms II
\algsetup{indent=2em}
\begin{algorithm}[H]
\caption{$Modulus(n)$}\label{alg:mod}
\begin{algorithmic}[1]
\REQUIRE Nilai integer $n>0$ atau $n<0$.
\ENSURE Nilai $n \neq 0$.
\medskip
\IF {$n$ dibahagi dengan 2 $\neq 0$}
\RETURN $nombor$ $ganjil$
\ELSE
\RETURN $nombor$ $genap \cdot $
\ENDIF
\end{algorithmic}
\end{algorithm}
KLBarcamp 2010
Inserting codes
Pseudocode
Displaying algorithms I
Algorithm 2 Logic(n)
Displaying algorithms II
\begin{algorithm}[H]
\caption{$Logic(n)$}\label{alg:mod2}
\begin{algorithmic}[1]
\medskip
\IF {I am not here today}
\STATE I might resting back home
\ELSE
\STATE I rebel for free food!
\ENDIF
\end{algorithmic}
\end{algorithm}
KLBarcamp 2010
Arabic and Jawi characters
Mapping characters
As far as I know, there are several Arabic package which
provides support to LATEX
I only comfortable with arabtex package, and alqalam if you
need
arabtex provides support to Arabic characters, including Jawi
(Malay version)
alqalam if you want to print Quran verses
KLBarcamp 2010
Arabic and Jawi characters
\setmalay
\novocalize
\begin{RLtext} Jawi
cUbA tUlIs
ËñK AK. ñk
\end{RLtext}
\setarab
Arabic
\vocalize
\begin{RLtext} ? È ñ
Ë@ Õ»YJ« Éë
hal ‘indakum al-su’al?
\end{RLtext}
KLBarcamp 2010
Arabic and Jawi characters
@ H. H H h. h p X X P P
A b t _t j .h _h d _d r z s ^s .s
¨ ¨ ¬ ¼ È Ð à è ð ø
.d .t .z ‘ .g f q k l m n h w y
Non pure Arabic characters, including Jawi:
H ¬ h h P À h
¼ È P
p v ^c ,c ^z g c ^n ^l .r
KLBarcamp 2010
Arabic and Jawi characters
ËñK ÕË@X
ø
ðAg. àA ArabTEX Blocks
ÐAKQ¯ hñJJk
ËñK A¿ñ ø A
ø
ðAg. àA
KLBarcamp 2010
Arabic and Jawi characters
ËñK ÕË@X
ø
ðAg. àA ArabTEX Blocks
ÐAKQ¯ hñJJk
ËñK A¿ñ ø A
ø
ðAg. àA
@ð Y» hñJJk
ø A
ËñK A¿ñ I «A
ø
ðAg. àA
KLBarcamp 2010
Arabic and Jawi characters
ËñK ÕË@X
ø
ðAg. àA ArabTEX Blocks
ÐAKQ¯ hñJJk
ËñK A¿ñ ø A
ø
ðAg. àA
@ð Y» hñJJk
ø A
ËñK A¿ñ I «A
ø
ðAg. àA
A¾J
J» hñJJk
ø
ðAg.
ËñK AK
A
KLBarcamp 2010
Mathematics
Among the most frequent users (or must use) or LATEX are
math scholars/students
We, the IT people may rarely use this package unless you’re
doing math analysis of say, certain algorithm, or for social
science when you want to include your statistical formulas.
Math package provided by American Mathematical Society
(AMS).
KLBarcamp 2010
Mathematics
√
3
8=2
and,
√4
16 = 2
with
$\sqrt[4]{16} = 2$
KLBarcamp 2010
Mathematics
a1,1 a1,2 ··· a1,n
a2,1 a2,2 ··· a2,n
Am,n = .
.. .. ..
.. . . .
am,1 am,2 · · · am,n
KLBarcamp 2010
Mathematics
a1,1 a1,2 ··· a1,n
a2,1 a2,2 ··· a2,n
Am,n = .
.. .. ..
.. . . .
am,1 am,2 · · · am,n
can be done by:
\[
A {m, n} =
\begin{pmatrix}
a {1 ,1} & a {1 ,2} & \cdots & a {1 , n} \\
a {2 ,1} & a {2 ,2} & \cdots & a {2 , n} \\
\vdots & \vdots & \ddots & \ v d o t s \\
a {m, 1 } & a {m, 2 } & \cdots & a {m, n}
\end{ p m a t r i x }
\]
KLBarcamp 2010
Mathematics
Equation
(x + y )2 = x 2 + 2xy + y 2 (1)
2 2 2
(x − y ) = x − 2xy + y (2)
2
= (x + y ) − 4xy (3)
\begin{eqnarray}
( x + y ) ˆ 2 &=& x ˆ2 + 2 xy + y ˆ2\\
( x − y ) ˆ 2 &=& x ˆ2 − 2 xy + y ˆ2\\
&=& ( x + y ) ˆ 2 − 4 xy
\end{ e q n a r r a y }
KLBarcamp 2010
Mathematics
\[ 10
X
\ sum { i =1}ˆ{10} t i ti
\]
i=1
KLBarcamp 2010
Writing book
Book class
Instead of putting
\ documentclass [ a r t i c l e ]
we put
\ d o c u m e n t c l a s s [ book ]
in the preamble.
It really helps when the numbering of chapters, sections,
subsections, figures and tables being done automatically
In addition to that, the table of contents and table of figures
as well
Not only that, you are also able to simply create indexes and
glossaries
Check my free LATEX book in Bahasa at http:
//latex-my-docs.googlecode.com/files/book.pdf
KLBarcamp 2010
Writing book
Book cover
1 Intro to LATEX
Platform
2 Editors
Kile
Texworks
Vim
3 Simple example
4 Inserting codes
verbatim
listing
pygmentize
Pseudocode
5 Arabic and Jawi characters
6 Mathematics
7 Writing book
Book cover
8 Tools to generate LATEX codes
kdissert
KLBarcamp 2010
Writing book
Book cover
KLBarcamp 2010
Writing book
Book cover
KLBarcamp 2010
Tools to generate LATEX codes
You don’t always necessary to write the LATEX codes all time
There’s tools to help you
Something like MS Frontpage for web design
But you know. . . , automated stuffs :-)
KLBarcamp 2010
Tools to generate LATEX codes
kdissert
1 Intro to LATEX
Platform
2 Editors
Kile
Texworks
Vim
3 Simple example
4 Inserting codes
verbatim
listing
pygmentize
Pseudocode
5 Arabic and Jawi characters
6 Mathematics
7 Writing book
Book cover
8 Tools to generate LATEX codes
kdissert
KLBarcamp 2010
Tools to generate LATEX codes
kdissert
kdissert
KLBarcamp 2010
Tools to generate LATEX codes
kdissert
kdissert
writer2latex
It shouldn’t be long
KLBarcamp 2010
Tools to generate LATEX codes
OpenOffice
KLBarcamp 2010
BibTeX
BibTEX
@Book{ he−r o o t k i t ,
a u t h o r = ” M i c h a e l D a v i s and Sean Bodmer and Aaron L e M a s t e r s ” ,
t i t l e = ”HACKING EXPOSED MALWARE AND ROOTKITS” ,
y e a r = ”2010” ,
i s b n = ”0071591184 , 9780071591188” ,
p u b l i s h e r = ”McGraw−H i l l , I n c . ” ,
a d d r e s s = ”New York , NY, USA”
}
@Article{ barford2006inside ,
t i t l e = ”{An i n s i d e l o o k a t b o t n e t s }” ,
a u t h o r = ”P . B a r f o r d and V . Y e g n e s w a r a n ” ,
j o u r n a l = ” Malware D e t e c t i o n , s e r . A d v a n c e s i n I n f o r m a t i o n S e c u r i t y . S p r i n g e r −V e r l a g ” ,
p a g e s = ”171−−191”,
y e a r = ”2006”
}
KLBarcamp 2010
Reference
Bibliography
Brouwer, A. E.
http://www.win.tue.nl/~aeb/natlang/arabic/arabtex-verb-doc.html.
[Online; accessed 25-April-2010].
Brunton, K. (2010).
Why latex?
https://www.wiki.ed.ac.uk/pages/viewpage.action?pageId=11042821.
[Online; accessed 23-April-2010].
Wikibooks (2010a).
Latex.
http://en.wikibooks.org/wiki/LaTeX/Print_version.
[Online; accessed 23-April-2010].
Wikibooks (2010b).
Latex:mathematics.
http://en.wikibooks.org/wiki/LaTeX/Mathematics.
[Online; accessed 24-April-2010].
KLBarcamp 2010
Close
[email protected]
http://latex-my.blogspot.com/
http://code.google.com/p/latex-my-docs/