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, June 22, 2012

LaTeX and Graphics Contest

LaTeX-Community has teamed up with Packt Publishing to hold a LaTeX and Graphics contest, where participants can write about anything related to graphics. There are 10 superb contributions, jam-packed with lots of things to take away. Readers can now vote/share/like/blog/comment on the entries, while the judges deliberate over the 2 winners.

My entry is about a technique for efficiently creating visually non-repeating tiled pattern backgrounds, while using only small-sized graphics files, which I’ll cross-post here eventually I suppose, after the contest has ended.

Monday, June 18, 2012


Ever since I knew how to use Beamer, I try to use it every wherever I could (including my progress presentation to my supervisor). Been doing that since 2009. But as forgetful as I am, I usually save my .tex file to be recycled for the next presentation. Some of my slides are available online. You know it's written with Beamer when looking at the template so...

Some slides:
here, here and here.. and the rest you can see from my uploads.. not a big thing just usual stuffs.

Sunday, June 3, 2012

More Ways to Typeset CJK

Rather a long time ago, I wrote about how to typeset CJK (Chinese, Japanese and Korean) in pdfLaTeX, using the CJK and ctex packages. However, the font choices are rather limited. With CJK, you have only the wadalab (3 Japanese fonts) and arphic (2 Simplified Chinese fonts, 2 Traditional Chinese fonts) packages and 1 Korean font. If you have access to Windows fonts, the ctex packages further configures 6 Chinese fonts shipped with Windows for use in pdfLaTeX (may also work with dvi output, but I didn’t test).

More Fonts in XƎLaTeX: xeCJK

If you’re willing to use XƎLaTeX, the xeCJK package makes it a breeze to typeset CJK, using any font (TTF or OTF) installed on your operating system. The following uses Chinese fonts typically found on a Mac:


% Sets font for Roman text.
% There are also \setsansfont, \setmonofont.
% See fontspec documentation.


% Traditional Chinese typesetting has no "bold" nor "italic".
% 黑体 ("blackbody") and 楷体 ("regular script") fonts are
% used instead.

\setCJKsansfont{Hiragino Sans GB}


The fonts are identified by their names as displayed in your OS' font manager application. Here’s the output:

More Fonts in pdfLaTeX: zhmCJK

If you absolutely need to use pdfLaTeX instead of XƎLaTeX, the new zhmCJK package is useful for introducing more CJK font choices into you documents. It’s not included in MikTeX nor TeXLive, however; so you will have to download it from CTAN and install manually: read the instructions carefully.

The zhmCJK packages make use of the premise that all CJK fonts share the same metrics (note that this is not true for Japanese half-width characters! Use ptex if you have serious needs for Japanese typesetting), and can therefore create the NFSS font definition and actual font mappings dynamically. The consequence is that zhmCJK can use TrueType CJK fonts to generate PDF output with pdfTeX or with the dvipdfmx driver. Here’s an example:

\setCJKmainfont[BoldFont=simhei.ttf, ItalicFont=simkai.ttf]{HanNomA.ttf}


You will need to pass the file name of the TTF font, which must have no space characters and only ASCII characters. And for LaTeX to find the TTF files, you need to do one of the following:
  • Set OSFONTDIR in texmf.cnf
  • Move or symlink the TTF file in TEXMF/fonts/truetype
  • Move or symlink the TTF file in the same directory as your document.