Featured Post
We've moved to tex.my!
It’s been great writing on Blogger.com, but we’ve decided to move to a new platform, thanks to some valuable help from a great, great friend...
Thursday, December 3, 2009
MikTeX 2.8 and WinEdt 5.6
Monday, November 30, 2009
Customising running headers and footers
By default, the running headers in a two-sided book (resp. article) produced by LaTeX displays the chapter (resp. section) number + title and the page number on even pages; and the page number and section (resp. subsection) number + title on odd pages. On chapter pages, however, the running header is blank, and the page number is displayed in the centre of the footer.
All these default headers and footers can be customised, either with the facilities already provided by the memoir class, or via the fancyhdr package. Basically, you need to redefine the "plain" pagestyle for chapter pages, and the "headings" pagestyle for the non-chapter pages. Using memoir, you'd do something like
\makeoddhead{plain}{left}{centre}{right}
\makeevenfoot{plain}{left}{centre}{right}
\makeoddfoot{plain}{left}{centre}{right}
% respectively \makeevenhead{headings}...
While if you're using the fancyhdr package:
%% Clear all headers and footers
\fancyhf{}
%% e.g. if right footers on odd pages and left footers
%% on even pages are some content:
\fancyfoot[RO,LE]{...}
%% this applies to right headers on odd pages:
\fancyhead[RO]{...}
%% and this to left headers on even pages:
\fancyhead[LE]{...}
%% and this to centre headers on both even and odd:
\fancyhead[C]{...}
}
\fancypagestyle{headings}{...}
As always, see the respective manuals/user guides for extensive instructions.
Here are some examples of what I've done:
(Download links of the .tex source files are at the end of this post)
Here are my specs:
- On chapter pages:
- page number in a coloured box on the right in the footer on odd pages;
- ditto, but on the left in the footer on even pages;
- blank running headers.
- On non-chapter pages:
- same footers as above;
- on even pages, the chapter title on the left in the header, and a decorative line extending to the right all the way to the paper margin;
- on odd pages, the section title on the right in the header, and a decorative line extending to the left all the way to the paper margin.
You'll probably notice that on the non-chapter pages, I've got some coloured background going on, too. I could've used the wallpaper package to achieve this effect, but just for kicks, I did them using the tikz package, using the headings pagestyle as a hook.
So here are the .tex source (plus the public domain images used) for producing the sample pages above:
Note that my examples require wallpaper.sty v2.5. If you're using MikTeX, your wallpaper.sty is most likely v2.4, so you'll have to grab the latest version yourself.
Saturday, November 7, 2009
Fancy Chapter Headings
If you look at my post that started this series, you might notice that the first page of every chapter in the Grid Computing Cluster report is rather fancy. I've initially got my inspirations from Stefan Kottwitz's post on 'Fancy chapter headings with TikZ'.
Here are the samples of how the chapter pages would look like:
(Download links of the .tex source files are at the end of this post)
The chapter number and title are rendered with TikZ, similar to what's described in Stefan Kottwitz's post. I threw in a background image across the top of the page, and another one at the lower corner, using the wallpaper package.
Just so we can choose a different image for every chapter, I defined a new command that holds the image filename (\newcommand\chapterillustration{}) and re-define it at each chapter (\renewcommand\chapterillustration{cherry-tomatos}).
Notice that the positioning of the chapter title and the fern leaf background image is different depending on whether the chapter starts on an odd or even page. The memoir document class provides the commands \checkoddpage and \ifoddpage...\else\...\fi, so that you can define what to do in each case. Don't worry if you're not using the memoir document class, these commands are also available via the changepage package.
Now to actually implement these definitions. The memoir document class lets you define chapter styles (e.g. \makechapterstyle{FancyChap}{\def\printchaptertitle##1{...}} see the manual on "Chapter Headings" for more details) in the preamble, which you would activate in the document body with \chapterstyle{FancyChap}.
On the other hand, if you're not using the memoir document class, use the \titleformat and \titlespacing commands from the titlesec package instead.
Sorry I'm too tired to even post relevant snippets; here are the links to the .tex sources to produce the sample pages above. I've incorporated the code for Changing page size and sizes, too. (By the way I used the lipsum package to generate the dummy text. You know, Lorem ipsum dolor sit amet...)
The sample public domain images are from here (cherry tomatos), here (computer chips) and here (fern leaf).
Sunday, November 1, 2009
Using Colours in LaTeX
The most useful commands for applying colours made available by xcolor are:
- \color{color} (applies color to the text in the currrent group)
- \textcolor{color}{text} (applies color to the specified text only)
- \pagecolor{color} (colors the entire page to be color)
- \colorbox{color}{text} (creates a box containing the specified text, with color as the background)
- \fcolorbox{frame color}{bg color}{text} (same as above, but with a coloured border around the box)
The xcolor package has quite a collection of pre-defined colours; they are listed in Section 4 Colors by Name in the manual. Apart from the 19 "base" colours that are always available, you can also access more pre-defined colours via the dvipsnames, svgnames and x11names options. Here's a quick example:
\usepackage[x11names]{xcolor}
\begin{document}
% 'LemonChiffon1' from x11names
\pagecolor{LemonChiffon1}
% 'magenta' is a base colour
\textcolor{magenta}{Hello World!}
% 'CadeBlue1', 'Firebrick2' and 'Goldenrod1'
% are available via x11names
What a \colorbox{CadetBlue1}{wonderful}
\fcolorbox{Firebrick2}{Goldenrod1}{world}.
\end{document}
You can mix up your own colours, too. \color{LemonChiffon1!80} means 80% LemonChiffon1 and 20% white, while \color{lime!30!yellow!60!Mahogany} would be 30% lime, 60% yellow, and 10% Mahogany. You can also give names to the colours you concoct, so that you can reuse them at various points in your document. For example:
- \definecolor[named]{CoolBlack}{cmyk}{.3,0,0,1} defines the CMYK 'Cool Black' (useful if your printer asks for CMYK black instead of 'rich black')
- \definecolor[named]{AquaBlue2}{rgb}{.553,.769,.98} defines 'AquaBlue2' with decimal RGB values (range [0,1])
- \definecolor[named]{Hazelnut}{HTML}{BDA59B} defines 'Hazelnut' with HTML RGB values. Useful if you're re-using colour definitions from CSS styesheets.
Have fun and happy LaTeXing!
Thursday, October 29, 2009
Setting page size and margins
So instead, I'll be doing a series of short posts on how I achieved certain effects and book design, starting with this one. It's probably faster for people to "zero-in" on what they need. ;-) Posts in this series will be tagged "book design". But before you implement your next major book project with LaTeX, do check with your printing company about the printing process used. If you'll be using on-demand laser printing, everything should go fine since the RGB colour model of your PDF should be adequate. However, if you're going with offset printing, your printing company will most likely prefer CMYK colour model to be used instead, and I haven't quite figured out how to tweak that perfectly with (pdf)LaTeX. In our case, only the book cover was printed with offset printing, and the effect was acceptable — so that ended well...
IMPORTANT DISCLAIMER: I am NOT a graphics designer, so my choice of colours/illustrations/etc probably sucks. Don't shoot me. :-)
Now there are multiple ways to achieve the same effect in LaTeX (that's FOSS for you). For this report, I've decided to use the memoir document class, which incorporates the functionalities of many other packages. (Do take some time to browse or search through the excellent manual with texdoc or mthelp.)
The flowfram package looks like a very interesting solution for designing dynamic layout, but I didn't find out about it until too late into my own project. Do find some time to look at it yourself. If you want to go with the standard document classes (report, book) or the koma-script classes, I'll indicate what extra packages you'll need where relevant.
In this first post we'll just look at how (custom) page sizes and margins can be specified. Basically my page design is:
- Stock paper size is 303mm x 216mm. The stock paper is the raw original paper that a commercial printer will print the page on, which will be trimmed down to the page size
- Page size is A4 i.e. 297mm x 210mm.
- The printer advised us to leave a good 10mm from the page edges around any printed text.
- I decided the main typeblock will be 20mm from the top, bottom and spine (inner) edge of the page, and 15mm from the outer edge.
- Also, the running header should occupy the height of a line of text, 7mm from the top edge of the typeblock. Whereas the baseline of the running footer is 7mm from the bottom edge of the typeblock.
These are not necessarily good measurements for an aesthetically-pleasing book design, but more because I was trying to strike a balance between aesthetics and to fit everything in (Lesson: Get in touch with the printing company early to check with their printing specifications per minimum page margins, etc!)
These can be implemented using commands from the memoir class. (The notion of 'stock', although a common concept in publishing and printing industries, is only available in memoir, not in the standard document classes.)
%% The stock paper size
\setstocksize{303mm}{216mm}
%% The 'real' page size
\settrimmedsize{297mm}{210mm}{*}
%% The stock paper will be trimmed 3mm from the
%% top edge and 3mm from the left edge
\settrims{3mm}{3mm}
%% Spine and trim page margins from main typeblock
\setlrmarginsandblock{20mm}{15mm}{*}
%% Top and bottom page margins from main typeblock
\setulmarginsandblock{20mm}{20mm}{*}
%% Header occupies height of a single line;
%% Bottom edge of footer is 7mm from bottom edge
%% of typeblock
\setheadfoot{\baselineskip}{7mm}
%% Bottom edge of header is 7mm from top edge of
%% typeblock
\setlength\headsep{7mm}
%% Apply and enforce layout
\checkandfixthelayout
In my case, due to some later issues with colouring the 3mm bleeding edges too (as per our printing company's request), I decided to make the trimmed page size the same as my stock size and increased the page margins instead:
%% Custom stock paper and page size
\setstocksize{303mm}{216mm}
\settrimmedsize{\stockheight}{\stockwidth}{*}
%% Adjust margins accordingly to achieve
%% same previous layout
\setlrmarginsandblock{23mm}{18mm}{*}
\setulmarginsandblock{23mm}{23mm}{*}
\setheadfoot{\baselineskip}{7mm}
\setlength\headsep{7mm}
\checkandfixthelayout
If you just need to print on exactly A4-sized paper, you can forget about setting the stock and trimmed size explicitly and just do
\setlrmarginsandblock...
\setulmarginsandblock...
...
\checkandfixthelayout
One last thing: if you're not using the memoir class, you can still change the page margins via a high-level interface with the geometry package:
\usepackage{geometry}
\geometry{
paperwidth=216mm, paperheight=303mm,
left=23mm, %% or inner=23mm
right=18mm, %% or outer=18mm
top=23mm, bottom=23mm,
headheight=\baselineskip,
headsep=7mm,
footskip=7mm
}
Again, if you're just going to print on A4 (or letter) paper, you can just do
\geometry{
left=20mm, %% or inner=20mm
right=15mm, %% or outer=15mm
top=20mm, bottom=20mm,
headheight=\baselineskip,
headsep=7mm,
footskip=7mm
}
i.e. just pass the a4paper option to the geometry package; there's then no need to set the paper height and width explicitly.
Wednesday, October 28, 2009
Unfolding vim-latex fold
So now, the cruelest method is by
:set foldlevel = 5
usually I put 10 heh.
(since section,subsection and subsubsection may =3 .. so play safe with above that level).
But so far I did not managed to get it work by putting in in $HOME/.vimrc . Any hints?
Monday, October 26, 2009
My first presentation with LaTeX
Next 6th Nov I'll be going to present another talk.. I hope I can avoid such problem again.
Tex Source
My Presentation Slides [HTML]
My Slides [PDF, 70 slides since I did some overlays]
You can refer my .tex file and do whatever changes that you want... but I'll be happy if you tell me where will you present your talk using my so called *masterpiece* :D
By the way, I converted those Beamer PDFs using external command, that is gs
I tweak some recommendations here
So, what I did was;
gs -dNOPAUSE -g1024x768 -r205 -sDEVICE=pngalpha -sOutputFile=./temp/slide_%02d.png -dBATCH beamer-foss-my-09.pdf cd temp/new/
//02d since this will correctly numbers your slides sequence from 00,01,10,11.. otherwise it will assume 1,11,10 is within the same order(as you can see, in the link that I gave before it doesn't stated that... so "man gs" did helped :)
for i in *.png; do convert -resize 600 $i temp/new/$i ; done
//you need to install ImageMagick package to do this.. "convert" command will resize the initially generated PNG from gs to smaller size. I did tried to set smaller size in gs command but seems it just bring partial of the slides into smaller pieces...
igal2 -r *.png -xy 300 -w 4
//this will create HTML galleries, initially the tool named "igal"
Some components of my *.tex file were adapted from texample.net ...
Tuesday, October 20, 2009
Following Curutari
I spent nites on beamer (with yesterday's nite mistakenly "rsync"ed my new .tex with the old one.. badly need my own SVN repo, sigh) . I seems to like "beamerthemestree" so much.
KDE Beamer Themes
By the way, you'll find templates for OOImpress and KPresenter via that link, too.
To use the Oxygen-style theme:
\usetheme{oxygen}
\begin{document}
\begin{frame}
...
\end{frame}
...
\end{document}
Sample output:
To use the Air theme and the output:
\usetheme{air}
...
There's also a PNG image which can be used as background for presentations at the link above (desenho.png). To use this with the default beamer theme, do:
\setbeamertemplate{background}{\includegraphics[width=\paperwidth,height=\paperheight]{desenho}}
...
Happy LaTeXing!
Sunday, October 18, 2009
Background images
\includegraphics[width=\pagewidth,height=\textwidth]{wallpaper_filename}
But the included graphics, even though it looks the right size, would refuse to budge beyond the page margins, leaving a white border all round it. And you'd probably have problem placing any text at all on the graphics, thus defeating the purpose of a "background" image.
The wallpaper package offers an easy way to add background images or wallpapers in LaTeX, including tiling. The following commands are available:
- \CenterWallPaper{<scaling>}{<filename>} where <scaling> is a value between 0 and 1, for specifying the fraction of paper width or height. The aspect ratio of the graphics will not be changed, i.e. you won't get a "stretched" wallpaper as you would with your desktop wallpapers.
- \ULCornerWallPaper{<scaling>}{<filename>}
- \LLCornerWallPaper{<scaling>}{<filename>}
- \URCornerWallPaper{<scaling>}{<filename>}
- \LRCornerWallPaper{<scaling>}{<filename>}
For tiling wallpapers, there are:
- \TileWallPaper{<width>}{<height>}{<filename>}, where you can specify (in pt, cm, in...) the width and height of the included image.
- \TileSquareWallPaper{<number>}{<filename>}, where the included image would be re-shaped as a square, and <number> is the number of "image tiles" that will fill up the width of the paper.
Also, for each command \XXXWallPaper command above, there is a \ThisXXXWallPaper command that takes the same arguments but would apply the background image on only the current page.
You can now run wild with your imagination to design letterheads, chapter headings, covers, etc. Have fun!
Saturday, October 17, 2009
Latex beamer and blocks
\begin{frame}
\frametitle{Portable Object (PO) files}
\begin{block}{Nature}
\begin{itemize}
\item It's a raw, untranslated file
\item Created automatically using gettext package
\item Ready to be translated
\end{itemize}
\end{block}
\end{frame}
produce this :
Alertblock
\begin{frame}produce this :
\subsection{gettext}
\frametitle{gettext}
\begin{alertblock}{gettext in short}
\begin{itemize}
\item Part of GNU packages
\item Enables internationalization of software
\item Enables the creation of Portable Object (PO) file
\end{itemize}
\end{alertblock}
\begin{center}
\alert{\emph{Portable Object?}}
\end{center}
\end{frame}
Exampleblock
\begin{frame}
\frametitle{Machine Object (MO) files}
\begin{exampleblock}{Description}
\begin{itemize}
\item \alert {Compiled file}, derived from PO
\item It's a binary, thus \emph{machine readable}
\end{itemize}
\end{exampleblock}
\end{frame}
produce this:
Good luck !
Tuesday, October 13, 2009
Name that symbol!
In LaTeX, the Comprehensive LaTeX Symbol List has just about every symbol imaginable in LaTeX, from mathematical operators and symbols (including Greek letters), the Euro symbol, wingdings, dingbats, blah blah blah. The list is accessible as a PDF on your local installation via the commands texdoc comprehensive on TeXLive, or mthelp --view comprehensive on MikTeX.
However, browsing through the list is still rather tedious, even if the document has a good index to make searching a leeeeeetle bit easier. Detexify is a free online tool that greatly simplifies the hunt for a LaTeX symbols. You sketch your symbol with the mouse, and detexify tries to classify it and returns the appropriate LaTeX package and command required for rendering it.
Here's an example of a "null" symbol. The 2nd symbol in the list is the one I'm looking for, so I'm going to include the lines
\usepackage{amssymb} ... $... \varnothing ... $
in my .tex file.
Here's another example of a maths symbol.
Wingdings and dingbats work, too. In fact, I haven't even finished drawing the envelope, and detexify has already showed me \Letter from the marvosym package.
Drawing diagram; the cryptic way
I managed to tried out 3 applications:
%modified from texample.net
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{mindmap,trees}
\usepackage{verbatim}
\begin{document}
\pagestyle{empty}
\begin{tikzpicture}
\path[mindmap,concept color=red!50!black,text=white]
node[concept] {Hidup}
[clockwise from=0]
child[concept color=green!60!blue]
{
node[concept] {Pertimbangan}
[clockwise from=90]
child { node[concept] {cari duit} }
child { node[concept] {buat amal ibadat} }
child { node[concept] {belajar sungguh-sungguh} }
child { node[concept] {bina keluarga bahagia} }
}
child[concept color=orange] {
node[concept] {research}
[clockwise from=-30]
child { node[concept] {jurnal} }
child { node[concept] {artikel} }
};
\end{tikzpicture}\end{document}
will produce
then how about ditaa;
Raw source snapshot:
will produce:
and finally graphviz;
Source, the "dot" file:
returns;
digraph process{
node [color=blue,fontcolor=black,font=helvetica,]
nodesep=1.5
A[label="Machine Object (MO)"]
B[label="Portable Object (PO)"]
C[label="developer"]
D[label="translator"]
E[label="tools"]
F[label="POedit"]
G[label="kbabel"]
C->B[label="prepares PO",style=dashed]
C->A[label="compiles MO",style=dashed]
C->B->D [label="send PO files/i18n",fontcolor=red]
D->B->C[label="return translated files/l10n",fontcolor=green ]
D->E[label="translate using",fontcolor=blue,style=dashed]
E->F
E->G
}
Monday, October 12, 2009
TeXample aggregator
Saturday, October 10, 2009
True or False: LaTeX can produce only boring, drab-looking stuff
I was too stupid to learn how to use PageMaker, Illustrator or FreeHand properly in a short time, so I jumped at LaTeX as my tool. Well after all, the glossaries (or acronym) package kept the acronyms and abbreviations consistent, and biblatex (a new, experimental package that offers much more flexible citation and bibliography features) meant easy inclusion of list of publications anywhere in the report and without having to manually format the entries. The tikz package provides drawing capabilities which I used liberally all over the page designs. Heck, even adding a barcode for the ISBN was effortless with ean13isbn.
I reckon a few eyebrows were raised, and indeed the printing company expressed surprise when told that our PDF was prepared with LaTeX ("You mean LaTeX can produce colour stuff?")
Without going into too much details on all the packages I used, here are some excerpt pages from the final product, designed and typeset by yours truly. While I'm certainly not a graphics designer by any means, and really professional layout designs is much more easily achievable with other applications mentioned earlier (if you know how to use them properly), I'm pretty happy with the end result. But never, ever let it be said that LaTeX is capable of producing drab, boring, black-and-white scholarly articles only again!
Friday, October 9, 2009
Google Scholar Supports BibTeX
It is a good news, doesn't it?
Google Scholar also supports export to End Note (RIS, perhaps?)
For mine above, it gonna be like this
@article{zabidi2003open,
title={{Open Source Software Localization Project}},
author={Zabidi, M.N.A.},
year={2003}
}
Who's who behind this blog
- Curutari / Lian Tze - USM (ex?)
- Rizal / Joey - Kent State Univ, Ohio
- Bahathir (Senpai) - M'sian Linux Guru
- Najmi - flying under radar
Accessing Package Documentations
How do you access these documentations and manuals, though? Do you google (or search on CTAN) and download the manuals every time you want to look up the details of user commands in, say, the glossaries package? Occasionally, though, you may find that the manuals you just downloaded are the wrong versions for the package files installed on your system.
Chances are that the documentations are already installed on your system, when you first installed those packages. They're usually located in $TEXMF/doc/tex/latex, or $TEXMF/doc/bibtex for BibTeX-related packages.
There's an easier way to look up a package's documentation than manually navigating the TEXMF trees, though. In TeXLive (that's probably what you have if you're on a *nix or Mac system), type
$ texdoc glossaries (or whatever package you're interested in)
at the shell prompt. VoÃla! The documentation for the glossaries package would open automatically for your perusal.
If the file that appears seem like an example file demonstrating a package's functionalities and not the documentation proper, try
$ texdoc --list glossaries
instead. You'll be presented with an interactive list from which you can select the file you want to open.
MikTeX users on Windows can use the command
mthelp glossaries
at the command prompt or from the "Start → Run" dialog instead. A browser window would open, listing possible documentation files associated with the package name you supplied. Click on a link to view the file you're interested in. And if you trust the system enough to hit upon the "main" documentation file at the first try, use
mthelp --view glossaries
instead.
Menyimpan TeX fail sebagai Office readable
Caranya ialah;
*.tex ----> *.html ----> OpenOffice format ---> *.doc
Kita senaraikan dulu tools yang digunakan selain cara yang saya sebutkan:
Buat masa ini, saya selesa dengan tth, disebabkan conversion yang saya buat menggunakan tools ini tidak memerlukan tuning yang banyak.
tth -e2
Selepas ubah ke HTML, import dokumen HTML tadi menggunakan OpenOffice.org, dan Save As sebagai *.doc . Mungkin anda perlu betulkan sedikit sebanyak indentation, tetapi sebahagian besar teks, dan citation yang dihasilkan oleh BibTeX tetap boleh digunapakai
Using .eps Graphics Files with PDF output
For quite some time now, the
graphicx
package would automatically sort out which file types to use whenever it encounters \includegraphics{some_file}
, where the extension of some_file
is not specified.That is to say, if you are generating to a
.dvi
, the system would look for some_file.eps
. If you are generating to a .pdf
, it looks for some_file.{pdf|jpg|png}
.But what if you want a
.pdf
and you work with .pdf, .jpg and .png graphic files, but suddenly you received a .eps graphics from your collaborator? (This actually happened to a lecturer at my university.)Well, you could always convert it manually to a .pdf yourself with GhostScript or GIMP, of course. But now the process can be automated if you're using MikTeX 2.8 or TeXLive 2009, as highlighted by Rob Hyndman.
In MikTeX 2.8, use the
epstopdf
package together with graphicx
, like so:\documentclass{article}\usepackage{graphicx,epstopdf}\begin{document}\includegraphics[width=\textwidth]{some_file}\end{document}
If all you have is
some_file.eps
, it will be automatically converted to a some_file-eps-converted-to.pdf
during the first time the LaTeX document is compiled and included in the final document output.If you're using TeXLive 2009, you don't even have to load
epstopdf
explicitly, but I say include it anyway, for portability's sake.
Thursday, October 8, 2009
Real Time (Almost) Preview For Latex
Unfortunately these tools are only available in Emacs (or fortunately, it is time for you to learn!).
These tools are:
Both tools are available in Ubuntu Linux. Auctex can be invoked in Emacsw32 (windows), while Whizzytex can be done, but I believe it is difficult.
Whizzytex works by invoking M-x and later whizztex-mode (that is, Meta (Escape/Alt button) and x plus the external command. You may simply list them all by Tab button), and this only need to be done once. It will directly fire up ADVI viewer. Every change that you did will be rendered right away... so perhaps you want to put it side by side with your editor.
Auctex in the other hands works by invoking C-c C-p C-d ;
For now I can't get the Arabic characters work.. maybe need some more manual reading.
All these tools need some editing in your $HOME/.emacs , which means it will not just work straight away.
Jawi support for Latex
For the character mapping on how to make the Jawi characters appear on screen, you can refer here
Say we have the following
%specifying class
\documentclass{article}
%calling arabtex package.. you may need to install texlive-lang-arab
\usepackage{arabtex}
\begin{document}
%initializing Jawi char map
\setmalay
%since Jawi does not need vocalization
\novocalize
\huge
%I leave it blank, except date for header
\title{ <>}
\author{}
\date{<2009>}
\maketitle
%This is Jawi mode
%Now let's see for Arab
\setarab
\fullvocalize
%This will enable transliteration, automatically!
\transtrue
\arabtrue
%Right to Left text will be append
\begin {RLtext}
al-salAm `alaykum\\
bismi al-ll_ahi al-rra.hm_ani al-rra.hImi
\end{RLtext}
\end{document}
Now let's see the output!
Asas-asas LaTeX
Saya sarankan pembaca yang ingin mencuba LaTeX, supaya membaca dokumentasi penggunaan LaTeX ini terlebih dahulu.
The Not So Short Introduction to LATEX2ε
Ianya mengandungi asas-asas pengunaan LaTeX bersama-sama contoh ringkas.
Terdapat beberapa lagi dokumentasi tunjuk ajar di Internet, dan harap pembaca dapat menafaatkannya.
Terima kasih.
Tables in LaTeX (crash course)
When you start to use Latex seriously to write your paper, thesis, documentation, book or what not. You will eventually find the need to display tables for various reason. Presentation of your tables is somewhat important, to convey the right ideas and to help people understand what you are trying to tell them.
However, displaying tables in LaTeX can be a little bit of a challenge. But, when you get a hang of it. It should be relatively easy and you can display nice and clean tables. Here is a short tutorial for you to get started.
Suppose for the sake of example, you want to display a table below in LaTeX.
Student | MidTerm | Finals | Total |
Ali | 43 | 33 | 73.0 |
Abu | 20 | 23 | 43.0 |
And here’s is how your tex code should look like.
\begin{table}
\centering
\begin{tabular}{|l|c|c|r|}
\hline
Student & Midterm & Finals & Total \\ \hline
Ali & 43 & 33 & 73.0 \\ \hline
Abu & 20 & 23 & 43.0 \\ \hline
\end{tabular}
\caption{Example for student grades.}
\label{fig:sampleStud}
\end{table}
For most part of the code above, the LaTeX code is self-explanatory. But I'll give you a short guide anyways.
The {|l|c|c|r|} means that there are four columns. The first column is left aligned, the second and third column is centered and the fourth column is right aligned. Between each of the columns, there should be a line. This is represented by the pipe character. Try removing one of the pipes and see how it will affect your table. Experimenting with the code above is the first few ways for you to start making good looking tables on your own.
Now, about \hline. As you might guess, the \hline stands for horizontal line. The first \hline is used to insert a line at the top of the table. Each line represents a row. The \hline after that represent the next few horizontal lines in each row. Try removing one of the \hline and see how it will affect your table.
The ampersands marking "&" is to show separations of the column. You can really mess up the tables by getting rid of the ambersand sign.
Finally, the \\ means line break; or in this case, row break. You have to do this for each row to indicate that you are done with one row, and ready to work on the other.
Hope this helps.
Wednesday, October 7, 2009
Carta Alir TeX dan LaTeX
Kalau ditanya kenapa saya guna Latex :
1- Auto numbering untuk heading, section dan subsection, gambar rajah, diagram, table dan sebagainya. Jadi tak perlu pening kepala nak trace diagram ni nombor berapa, dan kalau masuk diagram baru semua nak kena check balik. Saya tak pasti word processor ada sokong ke tidak ciri-ciri (feature) ini
2- Untuk citation pun dengan mudah kita boleh beralih format, katalah IEEE ke APA dan sebagainya, dengan sokongan BibTeX. Seperti yang saya sebut di dalam posting lain, contohnya untuk IEEE, sistem penomboran citation itu dilakukan secara automatik, seperti yang dilakukan oleh EndNote, satu perisian pengurusan citation (komersial, tapi universiti-universiti ada yang beli. Contohnya USM punya EndNote boleh download di laman web mereka oleh pelajar USM)
3- Layout dan font yang menarik (by default!)
4- Sokongan teks Arab/Jawi dengan menggunakan ArabTeX (dibangunkan oleh seorang profesor di Jerman)
Untuk memahami bagaimana proses penulisan fail Latex (dengan extension *.tex) sehinggalah kepada format PostScript (*.ps) dan akhirnya PDF (*.pdf), rujuk carta alir berikut:
Tuesday, October 6, 2009
Editor Lateks
Untuk menulis fail Latex, secara asasnya, kita boleh menggunakan mana-mana penyunting teks seperti NotePad, WordPad dan lain-lain. Tetapi, penyunting yang dipilih seboleh-bolehnya perlu memenuhi kriteria berikut:
-mempunyai sokongan syntax highlighting
-tidak memerlukan anda compile setiap kali melakukan perubahan
-mempunyai auto completion (tetapi kadang-kadang saya rasakan agak mengganggu proses penulisan)
Antara penyunting Latex mengikut platform sistem operasi:
Linux:
-Kile (berasaskan KDE)
-TexMaker
-Emacs
-VI
Windows:
-WinEdt
-LEd
-TexMaker
-EmacsW32 (Emacs untuk Windows)
-GVIM
Macintosh:
-TexShop
Monday, October 5, 2009
Komen dari Bro Root (Bahathir)
Itulah yang dikehendaki oleh Prof. Dr. Donald Knuth, seorang pakar sains komputer, yang tidak berpuas hati kerana artikel yang dicetak oleh syarikat percetakkanya tidak tepat dari apa yang sepatutnya. Bidang sains dan matematik amat memerlukan kejituan, kerana tersalah simbol, operasi and angkubah dalam fugnsi formula dapat memberi makna yang jauh berbeza dari yang dikehendaki. Ya, TeX dicipta oleh PAKAR sains komputer untuk pakar-pakar lain. Jadi tidak hairanlah kita lihat ramai Prof-prof, Dr. Dr. di universiti diluar negara khasnya, tahu guna TeX atau LaTeX ini.:)
Saya pernah memperkenalkan TeX kepada rakan-rakan dalam forum tempatan, kerana saya rasa ianya sangat berguna, walaupun untuk kerja-kerja dokumentasi biasa. GNU Emacs hanyalah alat/tool, dan bukanlah maksud saya untuk promo GNU Emacs sangat. Tak kisahlah anda nak guna penyunting apa pun untuk menyunting fail TeX ini. Terdapat pelbagai 'plugin' untuk GNU Emacs yang amat berguna dan mempercepatkan kerja suntingan, anda saya syorkan AUCTeX, seperti saudara kita sarankan diatas tadi.
Untuk preview, sekarang saya lebih gemar bayangkan 'preview' didalam minda saya, tanpa perlu sebarang pertolongan visual. Untuk permulaannya, tool untuk preview boleh digunakan bagi memudahkan kerja dan penggunaan TeX ini. Anda boleh buka tetingkap xdvi dan 'resize'kan kepada saiz yang membolehkan anda melhat skrin penyunting serentak. Anda 'compile' fail TeX dan xdvi akan mengemaskini paparan secara otomatik. Tak perlu apa-apa plugin pun. Kacang kan.:)
Baguslah, saudara sudah mula berjinak-jinak dengan TeX dan jadilahnya sebaga sahabat karib anda.
Semoga sama-sama mendapat menafaat dan selamat maju jaya.
Yang benar,
root.
Latex Beamer untuk "presentation"
Latex juga mempunyai pakej presentation iaitu Beamer.
Ia boleh dicapai di sini
Bagi pengguna Ubuntu semudah apt-get install latex-beamer dan boleh gunakannya sekarang!
Kelebihannya ialah apabila kita telah selesai menulis katakan laporan di dalam format latex, hanya beberapa tune up yang perlu dilakukan untuk membolehkan fail latex tersebut dialihkan ke frame Latex beamer tersebut
Pengenalan Latex
Selain itu, Dr Azzudin yang mendapat ijazah kedoktoran di Poland, rakan di pejabat saya turut mengatakan yang beliau menggunakan LaTeX untuk membuat kertas soalannya, apabila saya menanyakan kepada beliau bagaimana menulis notasi matematik pada kertas soalan yang ditulisnya.
Sehinggalah pada suatu hari, saya diminta oleh seorang editor syarikat di Amerika untuk menghantar satu bab dalam buku mereka yang akan diterbitkan bagi dinilai.
Pada mulanya saya hanya menggunakan cara konvensyional, di mana saya menggunakan pemprosesan kata seperti MS Word / Open Office. Tetapi apabila saya mula ke tahap menambahbaik sorotan kesusasteraan saya (literature review), saya mula menghadapi masalah untuk membetulkan citation dan sebagainya. Sebagai contoh, jika menggunakan citation jenis IEEETrans, seelok-eloknya susunan rujukan pada perenggan pertama adalah mengikut jujukan 1,2... sehingga akhir. Saya pernah melihat kertas persidangan yang memulakan citation dengan nombor entah keberapa, yang menunjukkan penulis tidak menggunakan tools untuk memperbetulkan catatan citationnya.
Rakat sepejabat saya, joey mengesyorkan BibTeX, yang dicipta untuk digunakan bersama LaTeX. Yang demikian menyebabkan saya "terpaksa" belajar LaTeX, alhamdulillah dalam masa kurang dari seminggu saya berjaya memindahkan tulisan saya ke dalam format LaTeX.
BibTeX memudahkan kerja saya di mana saya boleh memilih format citation seperti APA, IEEETrans, dan sebagainya dengan mudah.