## 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...

## Friday, November 26, 2010

### Coffee stains on your PDF docs

It's funny and seems pointless, but you may want to play around

Taken from here

Here what I got:

And important point is that, it does not work with pdflatex, use latex compiler instead

(Thanks Toriq for this package. How on earth did you ever came across this package anyway? ;) )

Update: coffee2.sty works with pdflatex, thanks Sharuzzaman and Curutari for pointing that out. I didn't check the current sty after I downloaded the old one.

## Wednesday, November 17, 2010

### “Why isn’t Arial in my LaTeX installation by default?”

“Or Cooper Black, or a bunch of other fonts? They’re free, aren’t they? They’re already there on my computer!”

If you’ve ever wondered about this, this article on Free Fonts: Free Is Not Always Free may help you understand some of the underlying issues about font licensing. (Some people would argue that the M$-bundled fonts are of inferior quality compared to the real stuff anyway e.g. Times Roman, Helvetica etc) On the other hand, rest assured that all is not lost as there are free clones of many of such fonts that you can use in your LaTeX documents anyway. For example, \usepackage{mathptmx} loads Nimbus Roman, a look-alike for Times Roman, while \usepackage{helvet} loads Nimbus Sans to stand in for Helvetica, which is pretty much indistinguishable from Arial — to the untrained eye anyway. One last thing: You can still use some non-free fonts: install them using the getnonfreefonts script. One really last thing: The last thing I want to do is to start a font war on this blog, so please spare me the hate mails! ;-) ## Friday, November 12, 2010 ### TeX, LaTeX and Friends Out of Beta The community-driven LaTeX-specific Q&A site: TeX, LaTeX and Friends is now out of beta and has a new design. I’m most pleased to see the Tengwar Ring-lore in the top left corner! :-D ## Thursday, August 26, 2010 ### Writing Systems and Calligraphy of the World This post has nothing to do with LaTeX, but if you’ve enjoyed using LaTeX, I think you’ll enjoy reading about this very well-researched write-up about the various writing systems (scripts) (Part 1) (Part 2). Simply beautiful. ## Friday, August 20, 2010 ### Tamil and Hindi Support in LaTeX Doing a post on typesetting Tamil and Hindi is only natural after sorting out Jawi and CJK! Just after I managed to get them working using the itrans package and the devanagari fonts, this exact question was asked on the TeX-LaTeX Stack Exchange site, to which I posted what worked for me. So this post is essentially a re-write of my answers there. (These instructions are LaTeX-only; I’ve not dabbled much in XƎLaTeX.) ## Installation on Ubuntu (TeXLive) This one’s easy. Grab the itrans and itrans-fonts packages for Tamil, and also the texlive-lang-indic package for the Hindi fonts via synaptic (or apt-get). ## Installation on Windows XP (MikTeX) Grab the devanagari package using MikTeX’s Package Manager. As for itrans, since it’s not packaged properly in MikTeX, so we’ll need to install it manually. Download itrans53-win32.zip from CTAN. After unzipping the contents (say C:\itrans53\), assuming <texmf> being your local TEXMF tree, • Move the contents of the lib folder into <texmf>\tex\latex\itrans • Move the contents of the fonts folder into the appropriate locations, i.e. • *.mf in <texmf>\fonts\source\itrans • *.afm in <texmf>\fonts\afm\itrans • *.tfm in <texmf>\fonts\tfm\itrans • *.pfb, *.pfa, *.pfm in &lt;texmf&gt;\fonts\type1\itrans • *.ttf in <texmf>\fonts\truetype\itrans • *.fd in <texmf>\tex\latex\itrans • Refresh the file name database (e.g. via MikTeX Options/Settings) ## Using itrans itrans doesn’t let you type in Tamil or Hindi (or Marathi, Sanskrit, Telugu and Gujarati) directly, rather you have to key in the ASCII transcription, then process it with itrans from the command prompt, then run (pdf)latex on the resultant file. Say I have the following file indic-pre.tex: \documentclass[11pt]{article} \usepackage[preprocess]{itrans} \newfont{\tmlb}{wntml12} \newfont{\tmls}{wntml10} \newfont{\devnf}{dvng10 scaled \magstep1} #tamilifm=wntml.ifm #tamilfont=\tmlb #hindiifm=dvng.ifm #hindifont=\devnf \begin{document} Thank you! {#tamil na^nRi #endtamil} {#hindi dhanyavaad #endhindi} \end{document} Process it with itrans: (Windows MikTeX users need to change path to itrans53\bin to evoke itrans.exe$ itrans -i indic-pre.tex -o indic.tex

Then run (pdf)latex on indic.tex, which is of course the file to edit if you have further text to add. Here's the output of that little file:

## Hold on! How’d you know you needed to type na^nRi etc?

I peeked at the transliteration map files ☺. For example, tamil.ps for the Tamil transliteration, dvng.ps for the Hindi (devanagari) transliteration, etc. If your LaTeX set up doesn’t install these files by default, you can download the package source .zip and look in the doc folder. The .itx files are sample source .tex files that generated the .ps files.

## Wednesday, August 4, 2010

### New (La)TeX Q&A Site

I’m sure many people have looked up Stack Overflow for programming-related Q&A. Well there’s now a similar community-driven LaTeX-specific Q&A site: TeX, LaTeX and Friends. Here’ a short snippet from the site FAQ (my own emphasis):

What kind of questions can I ask here?
TeX - LaTeX - Stack Exchange is for expert users of TeX, LaTeX and other related typesetting systems. Please do look around to see if your question has already been asked (and maybe even answered!) before you ask.

What kind of questions should I not ask here?
Avoid asking questions that are subjective, argumentative, or require extended discussion. This is not a discussion board, this is a place for questions that can be answered!

After just 7 days in private beta, the site has 323 users and 658 answers to 242 questions. With many (La)TeX experts already onboard answering questions, this is definitely one for the bookmarks (especially if you still can’t get used to comp.text.tex!)

## Wednesday, July 28, 2010

### MMU Thesis LaTeX Class

I have developed a LaTeX class and template for writing an MMU thesis, complying with the MMU IPS Guide for Preparation of Thesis.

The LaTeX class and template files is available at http://liantze.penguinattack.org/latextypesetting.html#mmuthesis. Hopefully this will be helpful to MMU students!

## Tuesday, July 6, 2010

### April Fool came late this year

River Valley TV has posted the video of Donald Knuth’s “earth-shattering” announcement at the TUG 2010 Conference about a “successor to TeX” that he’s been “secretly working on”.

Utterly hilarious, in which Prof Knuth parodies almost every single recent software and technology trends. And taking lots of “inspirations” from the c.t.t. newsgroup posts methinks. ;-) (Gotta love the transparencies too. Really takes me back to my undergrad days...)

As many have commented on the Web, “April Fool came late/early” for TeXies!

## Wednesday, June 30, 2010

### Another Beamer Thingy: Internet Malicious Miscreants

Tomorrow will be the last day of Malaysian Open Source Conference (MOSC 2010) where in this three days event I got a chance to talk on something which perhaps everybody knows about : Malicious Software and friends.

Anyway, the following is my PDF slides, ready for download here . In future, perhaps I considering drawing diagram using Tikz (again), but this one, maybe with something which I really love to draw.

## Monday, June 21, 2010

### CJK support in LaTeX

(Oh gosh. This is one post I should have written a loooong time ago.)

Najmi has previous posted about Jawi support on LaTeX. Well then, what about CJK (Chinese, Japanese, Korean) characters?

(The process may be simpler using XƎLaTeX, but I personally use LaTeX more, so this post won’t touch on XƎLaTeX.)

## Short snippets

If you need only short CJK snippets, use the CJK package. (While you’re at it, you may as well grab cjk-fonts and wadalab for the fonts.) On Debian-based systems, just grab latex-cjk-all and you should be good. Or if you don’t want the whole package (it’s huge), grab whatever you need for latex-cjk-chinese, latex-cjk-japanese or latex-cjk-korean (and whatever relevant font packages).

Here’s a basic example for Chinese:

\usepackage{CJK}
...
%% if your file is saved as GB simplified encoding
... as we say in Chinese,
\begin{CJK}{GB}{gbsn}子曰：有朋自远方来，不亦乐乎？\end{CJK}

%% if you file is saved as Big5 traditional encoding
... as we say in Chinese,
\begin{CJK}{Bg5}{bsmi}子曰：有朋自遠方來，不亦樂乎？\end{CJK}

But if you're saving as UTF-8 then you need CJKutf8.sty (included in CJK package):

\usepackage{CJKutf8}
...
as we say in Chinese,
\begin{CJK}{UTF8}{gbsn}子曰：有朋自远方来，不亦乐乎？\end{CJK}
or \begin{CJK}{UTF8}{bsmi}子曰：有朋自遠方來，不亦樂乎？\end{CJK}

You have a few font choices (make sure you get the latex-cjk-chinese-arphic-* files!)
• gbsn (简体宋体, simplified Chinese)
• gkai (简体楷体, simplified Chinese )
• bsmi (繁体细上海宋体, traditional Chinese)
• bkai (繁体标楷体, traditional Chinese)

Japanese and Korean text are typeset much the same way. If you save everything as UTF-8, then it’s just a matter of knowing what fonts to invoke:

\usepackage{CJKutf8}
...
%% Japanese
\begin{CJK}{UTF8}{min}

\end{CJK}

%% Korean
\begin{CJK}{UTF8}{mj}
편편황조 자웅상의 염아지독 수기여귀
\end{CJK}

The Japanese fonts are from the wadalab packages (latex-cjk-japanese-wadalab-*):
• min (明朝 Mincho)
• goth (ゴシック Gothic)
• maru (丸ゴシック Maru Gothic)

As for Korean, well I’ve only been able to get mj (明朝体 MyongJu) working so far.

## Entire Document in Chinese

On the other hand, if your entire document is going to be in Chinese, you might be better off using the ctexart document class (in the ctex package):

\documentclass[UTF8]{ctexart}

\begin{document}

\section{论语}

\end{document}

\end{tabular}}

\begin{document}

\centering{\ul{Cheap}\so { \LaTeX{} trainer for hire, at risk}}\\
\centering{\texttt{\small{najmi.zabidi@gmail.com}}}
\end{document}

Code was modified from somebody else on the web, I don't remember the link. I invoke the soul package for space between characters.

## Monday, March 22, 2010

### LaTeX Documentation in Malay language

Hello,

I am gradually writing for a booklet for LaTeX in Malay language. If you also want to contribute, you're welcome. Lian and some other friends also had contributed on comments and others stuffs.

PDF

Note that I don't use version number for the PDF as of now, since I assume it's a BETA for every time I commit. But it's readable and hopefully beneficial.

Or, if you're cool enough, download the .tex files and the rest by yourselves and compile it. I have created a script called Make, just chmod +x and ./Make

hg clone https://latex-my-docs.googlecode.com/hg/ latex-my-docs

## Thursday, March 18, 2010

### Using the TeX FAQ

The (English language) TeX FAQ is a real treasure trove, maintained by the amazing Robin Fairbairns, who also co-maintains CTAN. (Yep, that repository of all contributed TeX & friends packages!!)

I would say 80% of the time, a LaTeX user can find a solution or pointers to a question in the FAQ, so the next time you're tempted to hack your own solution or is frustrated by all the old, obsolete advices churned up by Google, try searching in the TeX FAQ first.

In fact, you might even have a local copy on your LaTeX installation. Here's how to access them:
• On TeXLive, run texdoc faq-en at the CLI.
• On MiKTeX, run mthelp --view faq-en at a DOS prompt, or in the Windows Start → Run dialog.
Another alternative is via the Visual FAQ. Run texdoc visualfaq (or mthelp --view visualfaq). Browse through the PDF and click on an element which effect you're trying to replicate; you will be directed to the relevant entry in the online TeX FAQ.

## Tuesday, March 9, 2010

### Introductory Workshop to LaTeX at MMU Cyberjaya

I conducted an Introductory Workshop to LaTeX at MMU (Cyberjaya Campus) yesterday (8 March). If anyone's interested, the workshop materials (slides, worksheet, sample code, MiKTeX installation guide) are available here.

## Saturday, March 6, 2010

### Bibtex2html and Springerlink BibTeX converter

I found out these useful tools:

BibTeX2HTML : http://www.lri.fr/~filliatr/bibtex2html/doc/

Springerlink BibTeX converter; http://www.cs.usyd.edu.au/~niu/cgi-bin/springer.cgi

...and I wonder why on earth Springerlink did not put their BibTeX export format by default...? IEEE and ACM did that!

## Tuesday, March 2, 2010

### Latest version of geometry.sty breaks beamer

So if you updated all your packages in one go and finds that your beamer presentations don't compile anymore, this is why. Don't panic though (42), there's a workaround: put the following line before \documentclass{beamer}:

\makeatletter\let\ifGm@compatii\relax\makeatother
\documentclass{beamer}

## Sunday, February 21, 2010

### New Malaysian CTAN Mirror!

There is now finally a Malaysian CTAN mirror server at ftp://mirror.upm.edu.my/ctan/! Oh joy oh joy! Hopefully now all downloads and updates will be a breeze (M'sian network latency being what it is :p) (oh ye of little faith liantze, baaad girl!)

It's already showed up in MikTeX's mirror list. For TeXLive users, just point your repository to ftp://mirror.upm.edu.my/ctan/systems/texlive/tlnet/.

## Friday, February 19, 2010

### CMYK Output for Printing Prepress

This is the 6th and real last post in the bookdesign series. Previous posts in this series:

Happy Chinese New Year! Well traditionally CNY is celebrated up till the 15th day, so this isn't a belated greeting. ;-)

I thought my post on the front and back covers (+ISBN bar codes) was the last thing I wanted to document in the bookdesign series, but I just realised that I'd still yet to talk about producing a CMYK version if your printer is using a offset-printing process.

You can read about the CMYK colour model and how it it's different from RGB. In a nutshell, RGB is for on-screen viewing and is more vibrant, CMYK is for commercial printing and seems more "dull". Check with your printing service if they're using (on-demand) laser printing or offset-printing to print your material; it may depend on the type of printing stock (i.e. the paper) you choose.

If laser printing is used, RGB is fine, and you can hand over your pdflatex-generated file over as it is. However if offset-printing is to be used, you'll need to produce your PDF in CMYK colour model instead. Your printing service might be willing to do the conversion for you at their end; but I think it's more efficient to do this yourself as you'll have more control over the final PDF. It'll also give you a more accurate idea of how your design will look in print, so you'll have a chance of selecting your colours.

### Convert all graphics files to CMYK

Any graphic files that you include (via \includegraphics, for example) must be converted to CMYK. If you have imagemagick, the quick way is

convert image_RGB.jpg -colorspace CMYK image_CMYK.jpg

But I've been told that the resulting PDF, when loaded into other applications e.g. Illustrator, contains the "wrong" colours. For more accurate results, you'll need to use colour profiles as discussed here.

### Invoke xcolor CMYK mode

By default, the xcolor package uses the RGB colour model. To invoke CMYK mode:

\usepackage[cmyk, ...other options...]{xcolor}

And then there's the issue of different kinds of black. If your design contains large areas of black, and particularly if it involves light-coloured text (e.g. white) on a black background, the RGB black directly converted to CMYK would have values of C: 100% M: 100% Y: 100% K: 100% (over-saturated rich black). You then run high risks of getting unwanted "shadows" if the four colours print out of registration, as shown in the sample on the right from this excellent article:

Now the cmyk mode of the xcolor package automatically redefines the colour black to C: 0% M: 0% Y: 0% K: 100%, i.e. flat or standard black. Flat black can look rather "washed-out", so you might want to define a different shade of black, especially for large areas of black. Check with your printing service for further advice. E.g. our printer recommended to use a "cool black"  C: 30% M: 0% Y: 0% K: 100% for the covers of our Grid Computing Cluster book. Unfortunately I couldn't figure out how to do it previously, but now I do:

\usepackage[cmyk, ...other options...]{xcolor}

%% cmyk values have range [0,1]
\definecolor{CoolBlack}{cmyk}{.3,0,0,1}

%% In case you want to redefine the basic black
%% (0,0,0,1) across the board. Check with your
%% printer if this is advisable!!

\definecolor{black}{cmyk}{.4,.3,.3,1}

%% Force the new black into effect, because
%% xcolor issues \color{black} with the old
%% black before all its initialisations.

\color{black}

In other words, you should always liaise with your printing service concerning the technical specs. You'll thank them for their expert advice, and you'll learn a lot about graphics design and the printing process as well.

OK that's it! That's truly the last of the bookdesign series. I hope you've enjoyed it as much as I did.

## Sunday, January 17, 2010

### Front and Back Covers (and ISBN Bar Codes)

This is the 5th and last second last post in the bookdesign series. Previous posts in this series:

Sorry this post is so late after the last one, it was hard finding time to write between work and a toddler. We're drawing to a close for this bookdesign series now... just as we're starting a new year.

I'm not very imaginative, nor am I a graphic designer. So for my book cover, I go for a huge title across the top, a background illustration, and author/editor and publisher information at the bottom. Yes, very boring, but playing it safe — I think with a careful choice of fonts, colours and illustration, the end result wouldn't look too bad at all. :) I personally find the wallpaper package very handy for the cover page. So it might go something like this:

%% No header nor footer on the cover
\thispagestyle{empty}

%% Cover illustration
\ThisLLCornerWallPaper{1}{grapes-in-my-studio-little-too-much-dust}

%% Bar across the top
\tikz[remember picture,overlay]%
\node[fill=Sienna,text=white,font=\LARGE\bfseries,
text=Cornsilk,minimum width=\paperwidth,
minimum height=5em,anchor=north]%
at (current page.north){Exercises in \LaTeX};

\vspace*{2\baselineskip}

{\bfseries\itshape\color{LightGoldenrod!50!Gold}
\fontsize{36pt}{46pt}\selectfont
The Wonderful Calmness\par
of Still Life Photos\par}

\vspace*{2\baselineskip}

{\LARGE\color{LightGoldenrod}
A small dummy example book by
\scshape{Curutari}\par
}

\tikz[remember picture,overlay]%
\node[fill=Sienna,font=\LARGE\bfseries,
text=Cornsilk,minimum width=\paperwidth,
minimum height=3em,anchor=south]%
at (current page.south) {Malaysian \LaTeX\ User Group};

\begin{center}

\end{center}

%% Clear to next odd page
\cleardoublepage

Then comes the back cover. Now if the book is published with an ISBN, you'd want to put a bar code for it. I was wondering where I could get a free bar code generator, when a gut instinct told me to look around CTAN for a LaTeX solution. And sure enough, the ean13isbn package does the trick without any hassle:

%% In preamble
\usepackage[ISBN=978-80-85955-35-4]{ean13isbn}

...

%% Print the ISBN bar code
%% See the documentation for other sizes e.g. SC0, SC1...
\EANisbn[SC4]

So here's the code for my backcover:

%% Temporarily enlarge this page to push
%% down the bottom margin
\enlargethispage{3\baselineskip}
\thispagestyle{empty}
\pagecolor[HTML]{0E0407}

\begin{center}
\begin{minipage}{.8\textwidth}
\color{Cornsilk}\Large\bfseries
\lipsum[1]

\begin{center}
\huge\bfseries\sffamily\color{lime}`So Calming.'
\end{center}

\lipsum[2]

\end{minipage}
\end{center}

\vspace*{\stretch{1}}

\begin{center}
\colorbox{white}{\EANisbn[SC4]}

\vspace*{\baselineskip}

\textbf{\textcolor{LightGoldenrod!50!Gold}{Malaysian \LaTeX\ User Group \textbullet\ \texttt{http://latex-my.blogspot.com}}}

\textbf{\textcolor{LightGoldenrod}{Cover Illustration by Dusan Bicanski \textbullet\ \texttt{http://www.public-domain-image.com}}}
\end{center}

I've also added a table of contents with a simple \tableofcontents. The ToC heading is printed as a chapter heading, so I created a fancy style for it, without the chapter number and background picture, by modifying our fancy chapter code from earlier.

All in all, here's what our sample book now looks like (empty pages omitted):