Quick reminder about bahasa-babel

Just a quick note to help people who might be confused: If you’d like to write your report/thesis etc in Bahasa Malaysia (Standard Malay) (ISO-639 zsm), the correct language option to pass to babel is bahasam:

\usepackage[bahasam]{babel}

The babel option bahasa is actually a synonym for bahasai and loads Bahasa Indonesia (ISO-639 ind).

(For the linguistically minded, both zsm Standard Malay and ind Bahasa Indonesian, as well as many other languages, are members of the Malay macrolanguage (ISO-639 msa).

In addition, if you’d like to change a LaTeX string when babel is loaded, you’ll have to use the \addto\captionsXXX method. For example, to re-define figure captions to be “Rajah 1” instead of “Gambar 1”, you’ need to write

\addto\captionsbahasam{
  \renewcommand{\figurename}{Rajah}
}

UPNMThesis — LaTeX document class for Universiti Pertahanan Nasional Malaysia Theses

I’ve created a LaTeX document class and template, upnmthesis, for Universiti Pertahanan Nasional Malaysia (UPNM), as commissioned by the university’s Centre for Graduate Studies.

It’s also available on Bitbucket, as well as on Overleaf.

The user guide/manual is also my first attempt at using the tufte-book class, as well as minted for the code listings. I must say I like the look!

[Rant Warning] I don’t want hyphenation in my document; what do I do?

In recent months, I’ve been getting this query/complaint about “broken words” at the end of lines in LaTEX documents. Some asked me whether this is allowed in thesis writing and documents at all, and could I fix this “serious bug” in my LaTEX thesis templates ASAP.


tl;dr: OK, a quick way to disable hyphenation is to put \sloppy just after your \begin{document}. There are other ways, but personally I think this is pretty simple. ;-)


Now — here’s the long explanation about the role of hyphenation in professional typesetting. It’s ranty and may be a bit incoherent in places — you’ve been warned.

Not only is hyphenation acceptable in thesis writing (unless your institution expressly forbids it, that is), it is essential in professional book design and publishing. Without hyphenation (like default setting in Microsoft Word), the space between words would be inconsistent, some narrow and some wide, resulting in “rivers” (publishing jargon). See this article on self-publishing, under section “Hyphenation is nonexistent”.

If you look at professional text books published by large publishers (or books published in the 70’s before Microsoft Word became popular) you will notice that those which do not hyphenate words at the end of lines are all left-aligned (not justified) — so that spaces between words don’t have to be stretched. Professionally published books which justify their text, always hyphenate the words at the end of the lines if they do not fit nicely on the same line. See also journal papers published by IEEE and ACM — you will see the hyphenations in action (because they use LaTEX document classes).

Earlier versions of Microsoft Word could not hyphenate words. This is actually a shortcoming of Microsoft Word, not a feature. As comparison, professional desktop publishing software like Adobe InDesign, QuarkXpress, all support text hyphenation (some only recently). Unfortunately, since Microsoft Word was/is so popular (no thanks to bootlegged copies of Microsoft Office) during everyone’s secondary school and undergraduate days (in this part of the world anyway, back when copyright laws were not really enforced and intellectual property an unfamiliar concept), one whole generation grew up thinking that hyphenating words is a “bug” and a “defect” (← one thesis examiner actually used these words).

Since TEX and LaTEX was developed to create beautiful books, the default behavior is to hyphenate words. A few papers doctoral theses (co-authored or supervised by Knuth) developed the algorithms to compute the optimum hyphenations, line-breaking and page-breaking, to maximise reading and visual aesthetics:

More recently, there is now also efforts to get good hyphenation working on Web documents, first using JavaScript, and more recently with HTML5 and CSS3. Here are some links:

So is hyphenation a “defect”? NO. It may not always be what you want or suitable for the occasion (e.g. when the text width is narrow!), but it is most definitely not a bug.

(mmmm it’s good to get that rant out of my system)

A multilingual, customisable CD/floppy disk jewel case calendar with LaTeX

This post is also published on the Overleaf blog.

LaTeX‘s versatility makes it a rather handy (and free!) tool for creating various goodies, including monthly calendars. So here’s my stab at creating a LaTeX class and template for creating customisable, multilingual monthly calendars, that fit in CD or 3.5″ disk jewel cases. Pictures and events can be added, and you can choose any month range for your calendar — it’s not necessary that they begin on January and end on December.

You can make them for personal use, gifts or memorabilia for special events e.g. anniversaries. They may also be used for publicity or merchandise if you happen to be running a club or society.

For example, you could make a calendar showcasing birds frequenting your neighbourhood for your local birdwatching club. Work-wise, you might want to make a calendar for your journal paper reading group, highlighting important dates for assignments and conference submissions in your field in the coming semester.

Getting the Templates

You can clone the git repository on Bitbucket, or download a .zip file. Alternatively, you can also open and edit a CD-sized or floppy disk-sized calendar template on Overleaf.

The Monthly Calendars

The cdcalendar class will set up the calendar size to fit in a CD jewel case, and lay them out on an A4-sized paper:

\documentclass[12pt]{cdcalendar}
\begin{document}
%% June 2015
\monthCalendar{2015}{06}
\clearpage
 
%% July 2015
\monthCalendar{2015}{07}
\end{document}

If you want to make a smaller calendar to fit in 3.5″ floppy cases instead, pass the small option to the cdcalendar class:

\documentclass[9pt,small]{cdcalendar}

For those who are interested in the technical details: the calendar is rendered with tikz, and the 2-up or 4-up layout is done with pgfpages.

Adding Illustrations

I’ve defined a \illustration command for adding graphics to each page of the calendar:

\usepackage{graphicx}
%% syntax: \illustration[caption]{width}{image-file-name}
\illustration[We had fun at the birthday party!]{8.5cm}{Party.jpg}

The image will be added at the top left of the current page. The original proportion will be preserved, so you do have to choose an illustration of appropriate proportions to fit the empty space.

Adding/marking events

You can mark events on each month using the \event command:

\event{2015-10-25}{Daylight saving time ends}

The event will be listed above the monthly calendar, and the date is circled in the calendar itself. Events must be given after the relevant \monthCalendar and on the same page.

If your event spans over several days, you can give the duration (in days) as an option to \event:

\event[5]{2015-07-26}{ACL 2015, Beijing}

Alternatively, you can also give the end date as the option instead:

\event[2015-07-31]{2015-07-26}{ACL 2015, Beijing}

Both forms of the command will give the same output.

If an event spans two months, e.g. \event[9]{2015-06-27}{Summer Camp}, you’ll have to issue this command in both months i.e. once for June and once for July:

\monthCalendar{2015}{06}
\event[9]{2015-06-27}{Summer Camp}
\clearpage
 
\monthCalendar{2015}{07}
\event[9]{2015-06-27}{Summer Camp}
\clearpage

Multilingual Calendars

The dates, month names and weekday initials can be localised to languages that are supported by the babel, translator and datetime2.

For example, to get a calendar with Spanish dates, just pass spanish as a class option:

\documentclass[12pt,spanish]{cdcalendar}

We’ve tested the following language options: british, spanish, french, ngerman, italian, portuges, polish, croatian, greek.

Just remember to use LuaLaTeX to compile your project if it’s in french — it doesn’t work well with PDFLaTeX, and XeLaTeX doesn’t work well for this template.

Customising styles

The fonts and colours of most elements can be customised at any point in the calendar; take a look at the templates to see some examples. For convenience’s sake, a \makeCover command (and the necessary metadata commands) is also provided.

It’s been a lot of fun creating this template, and I’m sure you’ll find many more uses for this calendar. Enjoy!

“LaTeX Beginner’s Guide” by Stefan Kottwitz Available for Free Today (4 March 2015)

The LaTeX Beginner’s Guide ebook by Stefan Kottwitz is available for free for 24 hours today (4 March 2015)! I’ve previously reviewed this book on this blog, and here’s further information about the event.

This is a great book if you prefer a step-by-step tutorial approach to learning LaTeX. So if you’re interested, go ahead and download it now!