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}


There is a caveat, though. You’ll need to copy some Windows Chinese font files to your $localtexmf/fonts/truetype/... directory (don’t forget to run texhash!) to use ctex properly (font name in CJK/ctexart in brackets). These are all for simplified Chinese characters:
  • simsun.ttc 宋体 (song, default)
  • simfant.ttf 仿宋 (fs)
  • simkai.ttf 楷书 (kai)
  • simhei.ttf 黑体 (hei)
  • simli.ttf 隶书 (li)
  • simyou.ttf 幼圆 (you)

In any case, for more help on the ctex package and ctexart.cls, you’d best ask for help at the CTEX forum. (Language there is predominantly Mandarin Chinese.) I’m not aware of similar classes for Japanese nor Korean, though.

Pinyin and Ruby

Younger children learning Chinese characters (Hanzi/Kanji/Hanja) would often have the pronunciations annotated alongside/above/beneath the characters. For Chinese pinyin pronunciations, you would invoke

\usepackage{pinyin}
...\dian4 \deng1

to get diàn dēng.

To cite Martin Duerst:
Ruby are small characters used for annotations of a text, at the right side for vertical text, and atop for horizontal text, to indicate the reading (pronounciation) of ideographic characters.
And you can produce them with the ruby package:

\usepackage{CJKutf8,pinyin}
\usepackage[overlap,CJK]{ruby}
...

%% By convention, the pinyin would be *under* the Hanzi
%% so change the \rubysep to move it under

\begin{CJK}{UTF8}{gbsn}
\renewcommand\rubysep{-1.4em}
\ruby{电}{\dian4}\ruby{灯}{\deng1}
\end{CJK}

%% I find the default \rubysep (-0.5ex) too tight, so
%% let's enlarge it a little.

\renewcommand\rubysep{-0.2ex}

%% Shonen manga readers would get the written as
%% rival, pronounced as friend
 reference

%% (CORRECTED June 22)
\begin{CJK}{UTF8}{min}
\ruby{素敵}{ともだち}
\end{CJK}

%% Disclaimer: I'm actually unsure where the
ruby should be placed for Korean Hanja

\begin{CJK}{UTF8}{mj}
\ruby{南}{남}\ruby{宮}{궁}
\end{CJK}

The output of which looks something like this:

Wednesday, May 26, 2010

mylatex


I found out this shop just tonite when I went out for a dinner with her.

Friday, May 14, 2010

Diagramming Applications

This post answers the question

So how do I create high-resolution line drawings for use in LaTeX? Journal publishers request PDF or EPS with at least 800dpi.

Najmi’s post on Drawing diagram; the cryptic way covered tikz, ditaa and graphviz. (I myself swear by tikz.) However these may be too geeky for most people’s tastes. So here’s a list of free, open source, GUI-based diagramming applications that can produce PDF or EPS files.

  • OpenOffice Draw is a diagramming/drawing program that can save to PDF format. It’ a part of the OpenOffice suite. Personally I find it a bit clunky, but if you already have OpenOffice and don’t want to install new programs, it’ a good choice. Available on Linux and Windows. Mac users should look for NeoOffice instead.
  • Dia is an old favorite among Linux users, but some people might think it looks a bit rough. It does a very good job, though, with lots of elements and icons for UML diagrams, networking diagrams, ciruits, etc, etc etc. Dia supports saving to EPS files, and is available for Linux, Windows and Mac.
  • yEd. You know, I actually like yEd. A lot. The interface is easy to use, and there are also elements for UML, “people”, machines and more — in colour. (There’s even an iPod icon!) The output it produces does look more modern and polished then Dia. yEd supports saving to SVG, EPS and PDF, and is available on Linux, Windows and Mac.

Migrating to LaTeX: Producing High-resolution Line Drawings

Recently I was asked this question by not 1, but 3 people, so I guess that makes for a valid blog post!
I’m now migrating my paper/presentation to LaTeX from Microsoft Word/Powerpoint. It feels great! But is there any way I can transfer my existing line drawings over as high-resolution PDF or EPS? The publisher is asking for 800-1200 dpi.
Of course you can. I’ll outline what has worked for me below.

As for the question
So how do I create high-resolution line drawings for use in LaTeX if not the drawing tools in Word?
See the posts on Diagramming Applications and Drawing diagram; the cryptic way instead.

Mac OS X 10.5 Preview

If you’re on a Mac, first print your drawing diagram as a PDF. Open the PDF in Preview. Click the Select button on the Toolbar, and draw a rectangle around your drawing diagram. Then go to Tools menu and select Crop, or just hit Command-K. Save your cropped drawing back as a PDF.

OpenOffice Draw

If you have OpenOffice, you can try copying-and-pasting your drawing objects over to OpenOffice Draw, change the page size (Format > Page...) to fit the drawing just right, then export the drawing to PDF. However, elements and formattings often get distorted when copied over to OODraw, so personally I’d go for the procedures described next.

PDF Freeware Tools

Disclaimer: The tools described in this section are mainly for use in Windows, and are free-of-charge, but not all are open source.
Big thanks to Kevin Klement for pointing me toward PDFCreator and BRISS, true FOSS solutions!

Convert Your Drawing to PDF
First get PDFCreator. Once installed, you will be able to produce PDF out of any documents that is printable.

In your Word or Powerpoint document, select/highlight your line drawing, and go to File > Print. Choose “PDFCreator” as your printer, and select “Selection” or (“Current Page”) as the page range. You should also open the Print Properties, click on the Advanced button, and make sure that Print Quality is set to a sufficiently high dpi (e.g. 1200).

Click OK to print, and you will be prompted to enter any metadata (author, title, etc) you would like about the PDF. Save the PDF. You now have a high-resolution line drawing PDF, but it needs to be cropped to remove the surrounding white space.

First, install PDF995. You’ll need the 2 files from Pdf995 2-Step Download, i.e. the “Printer Driver” and the “Free Converter”. (A warning though: PDF995 is adware.)

In your Word or Powerpoint document, select/highlight your line drawing, and go to File > Print. Choose “PDF995” as your printer, and select “Selection” as the page range.

When you click OK you will be asked to enter a file name to save your PDF to. Bear with the annoying advertisement that pops up for 10 seconds.



Cropping Your PDF
You have a few choices.
  • Photoshop. If you’re one of the lucky souls to have a copy of Photoshop, you can use it to do the job. Just remember to set the Resolution to 800 or 1200 when you open the PDF in Photoshop. Crop, and then save the file back as PDF.
  • GIMP. But chances are that you don’t have Photoshop. GIMP can also open PDF files, and you’ll also be able to specify a sufficiently high resolution when you open it and then crop it. However, while GIMP can save it as an EPS (fine if that’s what you need), it cannot save/export to PDF format. And GIMP rasterises the file before saving (as Kevin pointed out), which defeats the purpose, really. So the winner really goes to...
  • BRISS, which needs a JRE to run. Unzip the BRISS zip file, and double-click on briss-<version number>.jar to launch. Load your diagram drawing PDF file, and draw a rectangle around the drawing objects. Click Crop PDF, and you’re done after saving the file.
  • PDF-cropper. You will need .NET 3.5 and GhostScript, so download and install those first before installing PDF-cropper.

    (Theoretically, you can use the GhostScript on command line to crop your PDF, but that involves figuring out the crop box and margins yourself, which I suspect not many people enjoy. Hence PDF-copper.)

    In PDF-cropper, go to the Configure menu and set the path to GhostScript binaries (usually C:\Program Files\GS\GS8.6x\bin), as well as your fixed output folder. Now load all your PDF files containing your drawings (PDF-cropper processes them by batch.) You can choose to crop off all surrounding white space around your drawings, or leave 5mm or 10mm space around them. Click the Action button, and the automatically cropped PDFs will be saved in the fixed output folder you specified.

Congratulations, you should now have high-resolution line drawings in PDF (or EPS) format, that are suitable for journal publication. Now just to include them in your LaTeX file with \includegraphics[width=...]{filename}.

Sunday, May 9, 2010

LaTeX Lab, a web-based (collaborative) LaTeX editor

LaTeX Lab is a web-based LaTeX, using Google Docs as its platform so you'll need a Google login to try it out. Since “sharing” a document is a default feature in Google Docs, LaTeX Lab can be used as an online collaborative editor.



Once saved, your LaTeX file will show up in your Google Docs file list, but you must access open it again via the LaTeX Lab link to get the LaTeX editor GUI. Opening the file from Google Docs will just show it as a plain text file, without the LaTeX syntax highlighting and toolbars etc.

However it’s still a preview release, so you probably don’t want to depend on it for your day-to-day use just yet!

Thursday, May 6, 2010

Slides on LaTeX intro

Hello,

Recently I got a chance to talk on LaTeX on 25th April 2010 at SEGI College, USJ, Malaysia. The slot was given un KLBarCamp's Miniconference slots


Here are my slides, click here

Saturday, April 10, 2010

Creating book cover with PSTricks


I don't know, maybe since was triggered by Lian's post, I decided to try creating my book cover as well. I always wanted to write some books since I think always need of extra money hehe. Note that the example above is using wallpapers from an open source project, while the following bird is from my own photo collections.




The following codes actually were modified from here [PDF] . At first I thought by modifying few stuffs I can straight away used to code.. but maybe because of different configuration that I have (I'm using Ubuntu 9.04 with the default TexLive).. I met several issues. I'm using pdflatex by the way.. perhaps that caused the problem.
\documentclass[12pt]{article}
% load the necessary packages
\usepackage[paperheight=9in,paperwidth=13.24in,margin=0in]{geometry}
\usepackage[dvipsnames,prologue,table]{pstricks}
\usepackage{pst-all}
\usepackage{graphicx}
\usepackage{lipsum}
\usepackage{rotating}
\usepackage{color}
\usepackage[ISBN=978-80-85955-35-4]{ean13isbn}
%\EANisbn[SC4]
% begin the document and suppress page numbers
\begin{document}
\pagecolor{Maroon}
\pagestyle{empty}
% create the box with the front cover picture
\newsavebox\IBox
\sbox\IBox{\includegraphics[height=9in]{itik2.png}}
% set up the picture environment
\psset{unit=1in}
\begin{pspicture}(13.24in,9in)
% set up the fonts we use
\DeclareFixedFont{\PT}{T1}{ppl}{b}{it}{0.5in}
\DeclareFixedFont{\PTsmall}{T1}{ppl}{b}{it}{0.4in}
\DeclareFixedFont{\PTsmallest}{T1}{ppl}{b}{it}{0.3in}
\DeclareFixedFont{\PTtext}{T1}{ppl}{b}{it}{11pt}
\DeclareFixedFont{\Logo}{T1}{pbk}{m}{n}{0.3in}
% place the front cover picture
\rput[lb](7.24,0){\usebox\IBox}
% put the text on the front cover
\rput[lb](8,7){\PTsmall \color{white}{Anak Itik yang Sombong}}
\rput[lb](8.94,6.5){\PTsmallest \color{white}{Najmi Zabidi}}
\rput[lb](9.04,0.8){\PTsmallest \color{white}{Fesbuk Press}}
% put the text on the spine (note the rotation over 270 degrees)
%\rput[b](6.62,8,0.75){\PTsmallest \color{black}

\rput[b](6.62,3,0.75)
{
\begin{turn} {-90}
{
\PTsmallest \color{white}Anak Itik yang Sombong
}
\end{turn}
}

% put the publisher’s logo on the spine
\rput[b](6.62,0.75){\color{white}{\fbox{\Logo FP}}}
% Create a Box containing the text for the back cover
\newsavebox\Blurbbox
\sbox\Blurbbox{\begin{minipage}{4.5in}
\textcolor{white}{\lipsum[1]}
\end{minipage}}
% And position the box
\rput[tl](1,8){\usebox\Blurbbox}
% Then we close all open environments

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5

\newsavebox\Authorbox
\sbox\Authorbox{\includegraphics[width=.75in]{najmi-pass.png}}
%\psframe[fillstyle=solid,fillcolor=white](1,4)(1.7,4.95)
% now place the picture
\rput[lb](1.1,4.1){\usebox\Authorbox}
% create a savebx for the biography. The width has been adjusted so
% that the right margin matches with that of the book blurb
\newsavebox\Biobox
\sbox\Biobox{\begin{minipage}{3.6in}
\textcolor{white}{Najmi Zabidi is toying around with \LaTeX{}. Contact him
by at bla@bla.com}
\end{minipage}}
% and put it where it belongs
\rput[tl](1.9,4.95){\usebox\Biobox}

\rput(4.5,1.2){
\colorbox{white}{\EANisbn[SC1]}}

\rput[lb](1,1.2){\color{white}{\fbox{\Logo FP}{\PTsmallest { Fesbuk Press}}}}
\rput[lb](1,1){\PTtext \color{white}{Kuala Lumpur --- MY}}
\rput[lb](1,0.8){\PTtext \color{white}{http://www.latex-my.blogspot.com}}
\end{pspicture}

\end{document}


Thursday, March 25, 2010

Shameless Barcode Ads

\documentclass{article}

\usepackage{fancyhdr}
\usepackage{soul}
% Font für Code 39
\font\xlix=wlc39 scaled 1200
\newcommand{\barcode}[1]{{\xlix@#1@}}

\pagestyle{fancy}
\renewcommand{\headrulewidth}{0.4pt}

\rhead{\begin{tabular}{ll|ll}
\multicolumn{2}{c|}{\barcode{0193870980}} & \multicolumn{2}{c}{\barcode{0361965666}} \\
\textsc{\textbf{\sc{{{\so{ Muhammad}}}}}} & \so{019$\;$3870980} & \textsc{\textbf{\sc{{{\so{Najmi}}}}}} &\so{03$\;$61965666}
\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.

Feel free to download:

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}

Read this post for more information.

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


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)


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}
\LARGE\bfseries\color{SaddleBrown!30!black}

\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):






Download links of the LaTeX code producing the above:

Illustrations courtesy of PublicDomainImage.com here, here and here; OpenClipart Project here.


Epilogue

Well it's been fun writing this series. It sure took me some time to prepare the sample code, search for appropriate illustrations and write up the posts, but I'm glad I documented how I achieved some of the effects in that Grid Computing Cluster book. Many thanks to all the readers and especially those who kept the comments section lively. You sure motivated me to finish writing this series! :D