Malaysian LaTeX User Group https://tex.my TeX and LaTeX in Malaysia Sun, 17 Nov 2024 11:32:53 +0000 en-US hourly 1 https://wordpress.org/?v=6.9.4 187202412 Cuti-cuti Malaysia: Customisable state-by-state holiday calendar for 2025 https://tex.my/2024/11/17/cuti-malaysia-2025-calendar/ https://tex.my/2024/11/17/cuti-malaysia-2025-calendar/#respond Sun, 17 Nov 2024 09:41:58 +0000 https://tex.my/?p=1092 Annual cuti-cuti Malaysia calendar time — 2025 is nigh upon us.

The Cuti-cuti Malaysia 2025 calendar LaTeX source files are available as an Overleaf Overleaf read-only project here. By default, when you open the project, it compiles and generates (may take about half a minute) an A4-sized portrait calendar that highlights national and Penang state public holidays and school holidays, along with the nongli (Chinese lunisolar) calendar. Once the compile has finished and the PDF preview is updated, click on the icon above the PDF preview panel, or Overleaf Menu >   PDF to download it.

Cuti-cuti Malaysia 2025 calendar template on Overleaf
Cuti-cuti Malaysia 2025 calendar template on Overleaf

Other sizes and layouts

Other size or layout options are available: refer to the infographic below; choose the corresponding file name from the file tree panel, then click Recompile above the PDF preview panel.

Infographic showing the different size and layout versions available
Different sizes and layouts available for the Cuti-cuti Malaysia 2025 calendar

This year I added the 1610 and 169 versions, to produce PDFs with 16:10 and 16:9 aspect ratios: you can then generate wallpapers from them using GhostScript and ImageMagick.

First generate .jpg images from the .pdf using GhostScript — I chose 600 dpi to make sure that I get good resolution:

$ gs -o cuti2025-1610-%02d.jpg -sDEVICE=jpeg -r600 -dTextAlphaBits=4 -dGraphicsAlphaBits=4 cuti2025-1610.pdf
$ gs -o cuti2025-169-%02d.jpg -sDEVICE=jpeg -r600 -dTextAlphaBits=4 -dGraphicsAlphaBits=4 cuti2025-169.pdf

We’ve already got 12 .jpg there, one for each month. But the file sizes are unnecessarily large, so I’d use ImageMagick to resize them a bit:

$ mogrify -unsharp 0x0.75+0.75+0.008 -resize 3456x cuti2025-1610-*.jpg
$ mogrify -unsharp 0x0.75+0.75+0.008 -resize 1920x cuti2025-169-*.jpg

Obtaining/editing the source files

You’ll need to edit the source code if you’d like to make calendars for other states (modify \providecommand{\mylocation}{Penang}), change the pictures, or add other events etc (see my blog post from last year or the cdcalendar README file for details on possible customisations.) You can either clone an editable copy of the project to your own Overleaf account; or download the full source code as a .zip file to your local machine by Overleaf Menu > Source. When compiling on a local machine, use XeLaTeX and compile twice to get the event location markers correct.

Data sources

The calendar data used in this sample were obtained from the following sources.

  1. Malaysian public holiday data was sourced from BKPP, JPM’s portal.
  2. Malaysian school holiday data was sourced from the Malaysian Ministry of Education’s portal.
  3. Chinese lunar calendar data was generated from here, converted to a CSV file and Simplified Chinese and some minor editing for typesetting purposes (inserting \\ for line breaks.
  4. Watercolour paintings in the sample calendar are by Instagram Wong Mun Choong.
  5. The codebase uses the custom LaTeX document class, GitHub cdcalendar. The basic template is also available on Overleaf Overleaf.
]]>
https://tex.my/2024/11/17/cuti-malaysia-2025-calendar/feed/ 0 1092
Updated Thesis Template for Universiti Putra Malaysia https://tex.my/2024/11/14/updated-thesis-template-for-universiti-putra-malaysia/ https://tex.my/2024/11/14/updated-thesis-template-for-universiti-putra-malaysia/#respond Thu, 14 Nov 2024 04:09:03 +0000 https://tex.my/?p=1089 University Putra Malaysia has an updated thesis LaTeX template by Sina Abdipoor! Available as an Overleaf template here.

]]>
https://tex.my/2024/11/14/updated-thesis-template-for-universiti-putra-malaysia/feed/ 0 1089
Are you loading incompatible packages with a template? https://tex.my/2024/08/21/beware-incompatible-packages-with-a-template/ https://tex.my/2024/08/21/beware-incompatible-packages-with-a-template/#respond Wed, 21 Aug 2024 02:56:32 +0000 https://tex.my/?p=1062 (Reader, this is going to be a long, ranty, rambling piece; I apologise beforehand.)

There are LaTeX packages for typesetting all kinds of things. And sometimes, there are more than one LaTeX  packages that can do (almost) the same thing — but are not compatible with each other so you often cannot load them at the same time.

If you had been given a template e.g. for typesetting your report, thesis, conference or journal manuscript, be sure to read through the instructions and example code provided in the .tex file. There may be important information re the specific packages that had already been loaded by the template or class to help you typeset certain elements (e.g. algorithms; code listings; sub-figures or sub-tables) — you should then use the commands and environments provided by these packages (i.e. the packages that the template intend you to use), and avoid loading other packages that provide similar functions.

It would also be good to add \listfiles to the top of the .tex file, and then compile the .tex file. The generated .log file will then contain a list of packages used (and their version numbers), similar to the following:

 *File List*
    book.cls    2023/05/17 v1.4n Standard LaTeX document class
    bk10.clo    2023/05/17 v1.4n Standard LaTeX file (size option)
titlesec.sty    2021/07/05 v2.14 Sectioning titles
 tocloft.sty    2017/08/31 v2.3i parameterised ToC, etc., typesetting
   alltt.sty    2021/01/29 v2.0g defines alltt environment
   ...

Keep a copy of this initial .log file, so that you can refer back to it later, to check which packages are loaded by the template.

For example, you may have heard (or seen a code snippet) that, to typeset subfigures side-by-side, you can load the subfigure package and then use \subfigure commands like this:

\begin{figure}\centering
\subfigure[first caption.]{%
  \includegraphics[width=0.4\textwidth]{example-image}%
  \label{fig:1a}%
}
%
\subfigure[second caption.]{%
  \includegraphics[width=0.4\textwidth]{example-image}%
  \label{fig:1b}%
}
\caption{Main caption}
\end{figure}

…so you happily copy-and-paste this code snippet into your thesis .tex file, and even made sure that you have added \usepackage{subfigure} in your preamble, too. But then you promptly got some glaring compile error messages, when you compile your .tex file. For example (but not limited to):

! LaTeX Error: Command \c@subfigure already defined.
               Or name \end... illegal, see p.192 of the manual.

See the LaTeX manual or LaTeX Companion for explanation.
Type H return  for immediate help.
 ...                                              
                                                  
l.113 \newcounter{subfigure}
                            [figure]
! LaTeX Error: Command \l@subfigure already defined.
               Or name \end... illegal, see p.192 of the manual.

See the LaTeX manual or LaTeX Companion for explanation.
Type H return  for immediate help.
 ...                                              
                                                  
l.123 ...xxxline{\ext@subfigure}{2}{3.8em}{2.5em}}
! Missing number, treated as zero.
 
                   \unhbox 
l.9 }
! Extra }, or forgotten \endgroup.
\@endfloatbox ...pagefalse \outer@nobreak \egroup 
                                                  \color@endbox 
l.15 \end{figure}
! LaTeX Error: Command \c@lofdepth already defined.
               Or name \end... illegal, see p.192 of the manual.

See the LaTeX manual or LaTeX Companion for explanation.
Type H return  for immediate help.
 ...                                              
                                                  
l.124 \newcounter{lofdepth}

In the worst cases your document might not even be able to generate a PDF at all — your compile .log file ends with a disheartened

*** (job aborted, no legal end found)

!  ==> Fatal error occurred, no output PDF file produced!

Now if you had that \listfiles added to your .tex file, look at your .log file again for the list of package files used. You now notice that subcaption.sty or subfig.sty was already loaded by your thesis template, by the .cls, .sty or other preamble in your .tex file — and subfigure is not compatible with these packages.

Therefore it is important to be aware of packages that perform similar functions, but that are incompatible with each other, and check which package has been loaded by the class, style file or template you’re using.

…yes I know, this is why LaTeX is hard . You can’t just copy-paste-duct-tape solutions from the internet or ChatGPT and chuck them together — some of them just won’t work together…

The rest of this post will (non-exhaustively) list some common scenarios and packages. Note that I don’t personally recommend any particular package over others (except packages that are marked obsolete on CTAN or have been unmaintained for a very long time). IMHO it’s important to first check if a particular package for a particular function has been loaded by the template/class/style provided to you; and then use only the commands/environments provided by that package. If you disagree with a package choice or think another package should be used instead, I’d recommend contacting the template author/maintainer to discuss further.

Algorithms, pseudocode

To typeset algorithms or pseudocode in LaTeX you can use one of the following options:

Note that you should choose only one of the above groups of packages, and use only the commands and syntax provided by the package you choose. These packages cannot be loaded simultaneously; otherwise you will get lots of errors. This Overleaf help page provides a nice overview about these packages, so we won’t delve further about them here.

Subfigures, subtables (subfloats)

Check the .log file of the template to see if one of memoir.cls, subfigure.sty, subfig.sty, or subcaption.sty has been loaded. If yes: you do not need to load another package for typesetting “subfigures” and “subtables”, but you do need to make sure that the commands you’re using adheres to the command argument syntax provided by the package already loaded. Refer to each relevant section below for example code for each package.

If none of these class or packages had been loaded, you can choose one from them, but I would recommend using the subcaption package, because the subfigure and subfig packages aren’t maintained, and hadn’t been updated in a very long time.

Is memoir.cls loaded?

If so, this class already provides the \subcaption{...caption...}, \subbottom[...caption...]{...body...} and \subtop[...caption...]{...body...} command, after declaring the type of subfloat you need with \newsubfloat{figure} or \newsubfloat{table}. (See section 10.9 of the memoir documentation). You don’t need to load any other packages.

\documentclass{memoir}
\newsubfloat{figure}
...
\begin{document}
\begin{figure}[hbt!]
\centering
\begin{minipage}{.3\textwidth}
  \includegraphics[\width=hsize]{example-image}
  \subcaption{First subfigure\label{subfig:11}}
\end{minipage}
%
\begin{minipage}{.3\textwidth}
  \includegraphics[width=\hsize]{example-image-1x1}
  \subcaption{Second subfigure\label{subfig:12}}
\end{minipage}

\caption{Main caption}\label{fig:main1}
\end{figure}

\begin{figure}[hbt!]
\centering
  \subbottom[First subfigure\label{subfig:21}]
    {\includegraphics[width=0.3\textwidth]{example-image}}
%
  \subbottom[Second subfigure\label{subfig:22}]
    {\includegraphics[width=0.3\textwidth]{example-image-1x1}}
\caption{Main caption}\label{fig:main2}
\end{figure}

Figures \ref{subfig:11} and \ref{subfig:12} ...
figures \ref{subfig:21} and \ref{subfig:22} ...

Using subcaption and subbottom commands from the memoir document class

Note that \subcaption must be used within \minipages or \parbox or similar.

Is subfigure.sty loaded?

If so, use \subfigure[...caption...]{...body...} within the figure environment, or  \subtable[...caption...]{...body...} within your table environment. (subfigure package documentation here)

\begin{figure}[hbt!]
\centering
\subfigure[First subfigure\label{subfig:11}]{%
\includegraphics[width=.3\textwidth]{example-image}
}
%
\subfigure[Second subfigure\label{subfig:12}]{%
\includegraphics[width=.3\textwidth]{example-image-1x1}
}

\caption{Main caption}\label{fig:main1}
\end{figure}

Figures \ref{subfig:11} and \ref{subfig:12} ...

Using subfigure command from the subfigure package

Is subfig.sty loaded?

If so, use \subfloat[...caption...]{...body...} within your float environment. (subfig package documentation here)

\begin{figure}[hbt!]
\centering
\subfloat[First subfigure\label{subfig:11}]{%
  \includegraphics[width=.3\textwidth]{example-image}
}
%
\subfloat[Second subfigure\label{subfig:12}]{%
  \includegraphics[width=.3\textwidth]{example-image-1x1}
}

\caption{Main caption}\label{fig:main1}
\end{figure}

Figures \ref{subfig:11} and \ref{subfig:12} ...

Using subfloat from the subfig package

Is subcaption.sty loaded?

If so, use \subfloat[...caption...]{...body...} or \subcaptionbox{...caption...}{...body...} within your environment. Note carefully that the subcaption text is given as an optional argument in square brackets [...] for \subfloat, but as a mandatory argument in curly braces {...} for \subcaptionbox! (subcaption package documentation here)

\begin{figure}[hbt!]
\centering
\subcaptionbox{First subfigure\label{subfig:11}}{%
  \includegraphics[width=.3\textwidth]{example-image}
}
%
\subcaptionbox{Second subfigure...\label{subfig:12}}{%
  \includegraphics[width=.3\textwidth]{example-image-1x1}
}
\caption{Main caption}\label{fig:main1}
\end{figure}

\begin{figure}[hbt!]
\centering
\subfloat[First subfigure\label{subfig:21}]{%
  \includegraphics[width=.3\textwidth]{example-image}
}
%
\subfloat[Second subfigure...\label{subfig:22}]{%
  \includegraphics[width=.3\textwidth]{example-image-1x1}
}
\caption{Main caption}\label{fig:main2}
\end{figure}

Using the subfloat and subcaptionbox commands from the subcaption package

Very similar commands, be careful!

By now you have probably noticed that some of these commands share very similar argument syntax:

  • \subbottom[...caption...]{...body...} and \subtop[...caption...]{...body...} from the memoir class;
  • \subfigure[...caption...]{...body...} and \subtable[...caption...]{...body...} from the subfigure package;
  • \subfloat[...caption...]{...body...} from the subfig package;
  • \subfloat[...caption...]{...body...} from the subcaption package.
  • \subcaptionbox{...caption...}{...body...} from the subcaption package. Note curly braces around the caption instead of square brackets, unlike other commands from other packages!!!

So if you ever need to copy existing code from one journal paper/report to another, keep an eye out for the packages that had been loaded in the original LaTeX document, and compare with the packages that are loaded in the new template/skeletal file that you’re copying your code to.

The \subcaptionbox from the subcaption package also has optional arguments for specifying a width for the subcaption, and also for the inner alignment of this box: \subcaptionbox{...caption...}[box width][inner pos]{...body...}

\begin{figure}[hbt!]
\centering
\subcaption{...}{...}
%
\subcaptionbox{Second subfigure...\label{subfig:32}}[.3\textwidth][c]{%
  \includegraphics[width=2cm]{example-image-1x1}
}
\caption{Main caption}\label{fig:main3}
\end{figure}

Or you can use a subcaptionblock environment instead, if that makes things a bit easier to read:

\begin{figure}[hbt!]
\centering
\begin{subcaptionblock}[t]{.3\textwidth}
  \includegraphics[width=\hsize]{example-image}
  \caption{First subfigure}\label{subfig:41}
\end{subcaptionblock}
%
\begin{subcaptionblock}[t]{.3\textwidth}
  \centering
  \includegraphics[width=2cm]{example-image-1x1}
  \caption{Second subfigure...}\label{subfig:42}
\end{subcaptionblock}

\caption{Main caption}\label{fig:main4}
\end{figure}

Using extended optional argument for subcaptionbox, and also the subcaptionblock environment

Note that we also used [t] for the subcaptionblocks in Figure 4, to align the subcaptions at the top. The environment name subcaptionblock can also be replaced with subfigure or subtable, depending on whether we’re in a figure or table environment.

Following that last point — since the existence of an environment Env means the commands Env and Endenv are defined, This means you should never copy \subfigure[...caption...]{...body...} or \subtable[...caption...]{...body...} from another LaTeX document that uses the subfigure package, into a document that uses the subcaption package, because the argument syntax for \subfigure and \subtable are different for both packages!

Packages for citations

(Note that “Harvard style” is just a very broad term for author-date styles; it is not really any specific bibliography style. By harvard here I am specifically referring to the harvard.sty LaTeX package.)

The packages cite, natbib, harvard, biblatex are mutually exclusive. Whenever one of them has been loaded, you should not load any of these other packages. Remember also that the BibTeX way (i.e. if using cite or natbib packages) is \bibliographystyle{...}bibliography{...}; but the biblatex way is \usepackage[style=...]{biblatex}\addbibresource{xxx.bib}...\printbibliography.

cite.sty is exclusively used for numerical bibliography styles and citations. If you’re using a journal, conference or thesis template that uses an author-year bibliography style and has loaded natbib.sty, you should not load \usepackage{cite} at all!

Having said that, if natbib has been loaded and a numerical style is in use (with natbib‘s [numbers] option , and you had wanted to load cite so that consecutive numerical citations are compressed: use natbib‘s sort&compress package option instead to enable this behavior. If natbib has been loaded by the .cls or .sty, then write \PassOptionsToPackage{sort&compress}{natbib} before the \documentclass declaration. As for biblatex — check if a -comp version is available for the style that is already in use; e.g. style=numeric-comp.

Do not load harvard and natbib together. The harvard package is compatible only with some author-year bibliography styles; but these styles are all compatible with natbib — so my personal recommendation is to always choose natbib over harvard.

apacite: this package provides the APA6 style for BibTeX, only load it if you need specifically APA6. Do not load cite nor biblatex! You can load natbib package after apacite. But if apacite has already been loaded by the .cls and you prefer to use natbib-style commands \citep and \citet, then use \PassOptionsToPackage{natbibapa}{apacite} before the \documentclass declaration. (If you need APA7, currently the only offering is via biblatex i.e. \usepackage[style=apa]{biblatex}).

By default, biblatex provides the \parencite and \textcite commands, for parenthetical and text citations respectively. If you would like to use the \citep and \citet commands instead, pass the natbib option (not load the natbib package!) to the biblatex package.

Packages for multiple reference lists

Usually there can only be one reference list or bibliography in a LaTeX document. But sometimes you may need more than one — e.g. per-chapter reference lists, or bibliographies by different topics or categories, etc. For BibTeX, chapterbib, bibunits, multibib offer some possibilities, while biblatex‘s refsection or filter mechanisms can achieve similar tasks. These are all covered in this Overleaf help page, so we won’t delve further about them here.

Packages for customising lists

Do not load enumerate and enumitem together. If enumitem has already been loaded by the .cls, but you’d really like to use enumerate‘s shortcut way of saying \begin{enumerate}[a)], you can write  \PassOptionsToPackage{shortlabels}{enumitem} before \begin{document} to enable this syntax with enumitem.


Right! I think that’s gotten most things off my chest now; but the above is by no means exhaustive. I’ll add to this post if some other commonly confused packages comes to mind!

]]>
https://tex.my/2024/08/21/beware-incompatible-packages-with-a-template/feed/ 0 1062
Cuti-cuti Malaysia: Customisable state-by-state holiday calendar for 2024 https://tex.my/2023/11/12/cuti-cuti-malaysia-customisable-state-by-state-holiday-calendar-for-2024/ https://tex.my/2023/11/12/cuti-cuti-malaysia-customisable-state-by-state-holiday-calendar-for-2024/#respond Sun, 12 Nov 2023 10:01:28 +0000 https://tex.my/?p=965 Annual cuti-cuti Malaysia calendar! This year I’ve made quite a lot of updates to the underlying code for cdcalendar; the documentation has been shaken up quite a bit too.

The Cuti-cuti Malaysia 2024 calendar LaTeX files is available as an Overleaf read-only project here. By default, this generates an A4 landscape calendar that highlights national and Penang state public holidays and school holidays, along with the nongli (Chinese lunisolar) calendar.

Cuti-cuti Malaysia January 2024 for Penang, A4 landscape without mini calendars
Cuti-cuti Malaysia January 2024 for Penang, A4 landscape without mini calendars ([giantsolo, landscape])
If you’d like to generate a calendar for a different state, or choose a different layout or size, or use your own pictures, or add/mark your own events, you can clone that Overleaf project to edit your own copy; or download the source files to edit on your own local LaTeX installation.

So, a quick recap of what this is: depending on which state (negeri) or federal territory (wilayah persekutuan) you’re in, the public holidays and school holidays would differ. It can get really hard to keep up with which holiday your local bank or your kid’s school is observing… so I decided to make my own calendar that would mark the holidays with different colours, depending on which state you’re in.

Generating for different states and layout options

The screenshots below show how holidays are highlighted differently, by changing \def\mylocation{Penang} to \def\mylocation{Kuala Lumpur} or \def\mylocation{Kedah}. Essentially holidays marked with solid colours are holidays that are observed in the state you’re in: National holidays are in solid pink; state holidays are in solid purple. Holidays observed in other states are marked with empty purple circles.

Cuti-cuti Malaysia February 2024 for Penang Cuti-cuti Malaysia February 2024 for Kuala Lumpur

Cuti-cuti Malaysia February 2024 for Kedah

Holidays are marked differently depending on which state name \mylocation is set to.
  • Instead of giantsolo, these three calendars use the giant class option, so will also generate two mini calendars on each page for the previous and next months.
  • For the Kedah calendar we also used the sundayweek document class option, to make the weeks start with Sunday instead of Monday.
  • Using giant or giantsolo without the landscape class option will generate A4-sized portrait calendars.

There are two variants of smaller sizes:

  • Without any particular class options (i.e. the default output size for cdcalendar actually), each calendar page is 11.7cm × 13.65cm and would fit a CD case
  • With the small class option, each calendar page is 9cm × 7.5cm, similar to a 3.5″ floppy disk.
Without any document class options, each calendar page is 11.7cm × 13.65cm and fits a CD case.
Without any document class options, each calendar page is 11.7cm × 13.65cm and fits a CD case.

With [small] class option, each calendar page is 9cm × 7.5cm
With [small] class option, each calendar page is 9cm × 7.5cm like a 3.5″ floppy disk

At such small sizes, it may be better to turn off the nongli calendars by changing \toggletrue{chinese-nongli} in the .tex file preamble to \togglefalse{chinese-nongli}.

Changing the pictures

For convenience the images are numbered 01–12. You can create a folder with a different name and place your own image files in it, and then update the \graphicspath{{.../}}. Images of 9:16 or 1:2 aspect ratio work best.

Adding your own events

The public holidays are listed in the tab-separated values files 2024-my-holidays.tsv; and school holidays in 2024-my-school.tsv. If you would like to add your own custom events, you can use the \event command in the .tex files themselves. The mark styles can be customised too. Here’s an example adding 1-day and 5-day events to the monthly of July, 2024:

\begin{monthCalendar}{2024}{07}
%% This is a 1-day event
\event{2024-07-03}{}{Birthday!}
%% This is a 5-day event starting July 15th
\event{2024-07-15}{5}{Exam week}
%% You could also write equivalently
%\event{2024-07-15}{2024-07-19}{Exam week}
\end{monthCalendar}
Use the \event command to insert custom events of your own
Use the \event command to insert custom events of your own

Data sources

The calendar data used in this sample were obtained from the following sources.

  1. Malaysian public holiday data was sourced from the Google Calendar here using the Google Calendars API, then converted to a tab-separated values file.
  2. Malaysian school holiday data was sourced from the Malaysian Ministry of Education’s portal (2023/2024) (2024/2025).
  3. Chinese lunar calendar data was generated from here, converted to a CSV file and Simplified Chinese and some minor editing for typesetting purposes (inserting \\ for line breaks.
  4. Photos in the sample calendar are sourced from Pexels and provided under the Pexels License.
]]>
https://tex.my/2023/11/12/cuti-cuti-malaysia-customisable-state-by-state-holiday-calendar-for-2024/feed/ 0 965
Did you know — you can now use CSL reference styles in LaTeX https://tex.my/2023/09/30/did-you-know-you-can-now-use-csl-reference-styles-in-latex/ https://tex.my/2023/09/30/did-you-know-you-can-now-use-csl-reference-styles-in-latex/#respond Sat, 30 Sep 2023 09:46:33 +0000 https://tex.my/?p=961 (I like this so much that I’ll repost it here after writing about it on the Overleaf blog!)

It’s now possible to use Citation Style Language stylesheets (.csl files) to format citations and reference lists in LaTeX documents! Make sure your LaTeX packages are reasonably up-to-date for this to work.

You can find .csl styles here (let’s use uoy-archaeology-jsm.csl as an example); and put it in the same folder as your .tex file. Load the citation-style-language package in the preamble:

\documentclass[12pt]{article}
\usepackage{citation-style-language}
\cslsetup{style = uoy-archaeology-jsm}
\addbibresource{researchDesign.bib}

\begin{document}
... This combination of data from multiple sources may present problems 
in the categorisation and comparison of sites across the region as a 
whole, in particular the Scottish region where few radiocarbon dates are
available and many site not been classified by date 
\cite{elliot-email-2023,beckensall-northumberland-2005}

\printbibliography

\end{document}

Then after compiling with latex/pdflatex/xelatex, instead of running bibtex to process the citations and .bib file, run the citeproc-lua command instead. Follow up with the usual one or two more runs of latex/pdflatex/xelatex, and watch your citations and references appear. A .bbl file will be generated, which you can include in your manuscript submissions to journals.

But if you’re compiling with LuaLaTeX, things will “just work” with just a single compile.

This will be useful if your institution or journal requires a particular reference style that doesn’t have a corresponding BibTeX or biblatex style file, but does have a CSL style file.

]]>
https://tex.my/2023/09/30/did-you-know-you-can-now-use-csl-reference-styles-in-latex/feed/ 0 961
usmthesis has a new maintainer! https://tex.my/2023/01/08/usmthesis-has-a-new-maintainer/ https://tex.my/2023/01/08/usmthesis-has-a-new-maintainer/#respond Sun, 08 Jan 2023 02:05:00 +0000 https://tex.my/?p=956 A great welcome to the new year — wnarifin has agreed to take up the maintenance of usmthesis! Please follow new updates at https://github.com/wnarifin/usmthesis. The old repo is now archived.

Thank you again wnarifin!

]]>
https://tex.my/2023/01/08/usmthesis-has-a-new-maintainer/feed/ 0 956
Cuti-cuti Malaysia: Customisable State-by-state Holidays Calendar for 2023 https://tex.my/2022/12/13/cuti-cuti-malaysia-customisable-state-by-state-holidays-calendar-for-2023/ https://tex.my/2022/12/13/cuti-cuti-malaysia-customisable-state-by-state-holidays-calendar-for-2023/#respond Tue, 13 Dec 2022 12:35:53 +0000 https://tex.my/?p=943 I’ll cut to the chase: Cuti-cuti Malaysia calendar for 2023!

PDF for Penang version: download here.

For other states download the .zip or clone this Overleaf project to your own Overleaf account. Change

\def\mylocation{Penang}

to e.g.

\def\mylocation{Selangor}

If you would just like a calendar without the Malaysian holidays and/or Chinese lunisolar calendars, see this Github repo or this Overleaf template.

See this post for instructions on how to customise your calendar.

Data sources

The calendar data used in this sample were obtained from the following sources, and I cannot guarantee their accuracy and correctness.

  1. Malaysian public holiday data was sourced from the Google Calendar here using the Google Calendars API, then converted to a tab-separated values file.
  2. Malaysian school holiday data was sourced from the Malaysian Ministry of Education’s webpage.
  3. Chinese lunar calendar data was sourced from here, converted to a CSV file and Simplified Chinese and some minor editing for typesetting purposes (inserting \\ for line breaks.
  4. Photos in the sample calendar are sourced from Pexels and provided under the Pexels License.
]]>
https://tex.my/2022/12/13/cuti-cuti-malaysia-customisable-state-by-state-holidays-calendar-for-2023/feed/ 0 943
Using APA7 with usmthesis https://tex.my/2022/06/05/using-apa7-with-usmthesis/ https://tex.my/2022/06/05/using-apa7-with-usmthesis/#respond Sun, 05 Jun 2022 06:13:27 +0000 https://tex.my/?p=928 Following up from the previous post Using APA7 with umalayathesis, but about usmsthesis. Likewise, I am hoping (against hope?) that one day, apacite package will be updated to support APA7, so that usmthesis.cls won’t need to undergo overhauling either.

But until that day comes, if you need to use APA7 with usmthesis now, then it may actually be easier to make the following changes within usmthesis.tex itself (don’t modify usmthesis.cls).

Add these lines before \documentclass.

\RequirePackage{scrlfile}
\PreventPackageFromLoading{apacite,multibib}
\AfterClass{book}{
  \RequirePackage[style=apa,natbib]{biblatex}
  \let\bibsep\bibitemsep
  \addbibresource{mybib.bib}
}

Remove these lines from usmthesis.tex: (They may be far away from each other; look carefully for each line in your .tex)

\newcites{own}{List of Publications}
\bibliographystyle{apacite}
\bibliographystyleown{apacite}
\bibliography{mybib}

Where you had \bibliography{mybib}, write instead:

\printbibliography[heading=bibintoc]

If you have lists of your own publications, remove these lines too:

\nociteown{lim:2007,lim:latextypesetting}
\bibliographyown{mybib}

and write instead:

\begin{refsection}
\nocite{lim:2007,lim:latextypesetting}
\printbibliography[title={List of Publications},heading=bibintoc]
\end{refsection}

After making these changes, delete the previously generated .bbl files (if any) in the directory.

Then run pdflatex, biber, pdflatex, pdflatex. Note that the biber processor must be used instead of bibtex now.

(If compiling on Overleaf, it should all “just work” because the build tool knows which processor to use.)

]]>
https://tex.my/2022/06/05/using-apa7-with-usmthesis/feed/ 0 928
Using APA7 with umalayathesis https://tex.my/2022/05/28/using-apa7-with-umalayathesis/ https://tex.my/2022/05/28/using-apa7-with-umalayathesis/#respond Sat, 28 May 2022 05:58:43 +0000 https://tex.my/?p=918 Currently the umalayathesis class uses apacite to implement the bibliography style, but apacite supports only APA6. For full APA7 it would be necessary to use biblatex-apa; no BibTeX style for full APA7 exists yet.

I’m still hoping (against hope?) that one day, the apacite package will be updated to support APA7, so that umalayathesis.cls won’t need to undergo overhauling…

But for now, if you want to use full APA7, it may actually be easier to make the following changes within thesis.tex itself.

Add these lines before \documentclass:

\RequirePackage{scrlfile}
\PreventPackageFromLoading{multibib}
\providecommand{\newcites}[2]{}

Make sure to add the custombib option in the \documentclass declaration:

\documentclass[english,singlespacedlisttitles,custombib]{umalayathesis}

And then add these lines after \documentclass:

\usepackage[natbib,style=apa]{biblatex}
\addbibresource{myrefs.bib}
\setlength\bibitemsep{2\onelineskip}
\setlength\bibhang{0.5in}
\renewcommand{\bibfont}{\SingleSpacing}

Next remove or comment out these lines:

\bibliography{myrefs}
\nociteown{Lim:2009,Bond:etal:WordNetBahasa:2014}
\bibliographyown{myrefs}

Add instead:

\cftinserthook{toc}{PlainChapTocLines}
\cftinserthook{toc}{disableuppercase}
\printbibliography[heading=bibintoc,title=\refname]

\begin{refsection}
\nocite{Lim:2009,Bond:etal:WordNetBahasa:2014}
\printbibliography[heading=bibintoc,title=\listpubname]
\end{refsection}

If you are using the splitpubs environment to separate your publication list for journal articles and conference proceedings, then change your splitpubs in your .tex file to be:

\begin{splitpubs}
\begin{refsection}
\nocite{Bond:etal:WordNetBahasa:2014}
\printbibliography[heading=subbibintoc,title={List of Publications:}]
\end{refsection}

\begin{refsection}
\nocite{Lim:2009}
\printbibliography[heading=subbibintoc,title={Papers Presented:}]
\end{refsection}
\end{splitpubs}

After making these changes, delete the previously generated .bbl files (if any) in the directory.

Then run pdflatex, biber, pdflatex, pdflatex. Note that the biber processor must be used instead of bibtex now.

(If compiling on Overleaf, it should all “just work” because the build tool knows which processor to use.)

]]>
https://tex.my/2022/05/28/using-apa7-with-umalayathesis/feed/ 0 918
Cuti-cuti Malaysia: Customisable State-by-state Holidays Calendar for 2022 https://tex.my/2021/12/10/cuti-cuti-malaysia-calendar-2022/ https://tex.my/2021/12/10/cuti-cuti-malaysia-calendar-2022/#respond Fri, 10 Dec 2021 06:03:18 +0000 https://tex.my/?p=901 OK, time for another Cuti-cuti Malaysia calendar for 2022… and yes I’m shamelessly reusing text wholesale from last year’s post 🙂

You can download the PDF customised for Penang here. If you would just like a calendar without the Malaysian holidays and/or Chinese lunisolar calendars, see this Github repo or this Overleaf template.

Preview of first two months in the calendar

Federal public holidays are highlighted in solid shaded pink circles, as in 1–2 February. Public holidays that are applicable for your home state (Penang in the above example) would be highlighted in solid shaded purple circles, as in 1 January. Public holidays in other states (relative to your home state) are also highlighted, but only in a hollow purple circle. See e.g. 14 January (Birthday of Yang di-Pertuan Besar) which is a public holiday in Negeri Sembilan, but not in Penang. School holidays are highlighted in light orange.

If you’d like to generate your own calendar for your own home state, or to change the illustrations/fonts/colours/etc, you can download the source code and compile with XeLaTeX. If you have an Overleaf account, you can also visit my read-only project and clone it to your own Dashboard. See this post for instructions on how to customise your calendar.

Data sources

The calendar data used in this sample were obtained from the following sources, and I cannot guarantee their accuracy and correctness.

  1. Malaysian public holiday data was sourced from the Google Calendar here using the Google Calendars API, then converted to a tab-separated values file.
  2. Malaysian school holiday data was sourced from the Malaysian Ministry of Education’s webpage.
  3. Chinese lunar calendar data was sourced from here, converted to a CSV file and Simplified Chinese and some minor editing for typesetting purposes (inserting \\ for line breaks.
  4. Photos in the sample calendar are sourced from Pexels and provided under the Pexels License.

Happy New Year 2022!

]]>
https://tex.my/2021/12/10/cuti-cuti-malaysia-calendar-2022/feed/ 0 901