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

Showing posts with label latex. Show all posts
Showing posts with label latex. Show all posts

Wednesday, December 30, 2015

Source code for "LaTeX: More than just academic papers & theses"

I’ve posted the source code for my presentation LaTeX: More Than Just Academic Papers and Theses as an example on Overleaf.

Enjoy!

Saturday, December 26, 2015

LaTeX Cookbook and Beginner's Guide ebooks at $5 Each

Until January 6, that is!

Both books are written by Stefan Kottwitz. The LaTeX Beginner's Guide came out in 2011, and I still consider it as a very valuable book to newcomers — e.g. a useful tome to assign your new research student as prerequisite research-skills reading. (You can read my review of it here) (whoa where did I find the energy to write such long form back in the day?!)

The LaTeX Cookbook is actually still quite new, having been published just a couple of months ago in October. (Which makes this deal even more amazing, especially with the currency situation in this part of the world right now…) Anyway! amazing deal or no amazing deal, this book is another one in the “keeper’s” category. Kottwitz continues his style of accompanying lots of useful code with an equally illustrative amount of explanations and best-practice tips. You know how some cookbooks are all “You want to do this? OK take this code” without too much explanation? This isn't one of them. So in a pinch, you may be thinking “why can't I just slap this code in and get it done with” (well actually most code in this book will do that for you anyway), but trust me, you’ll learn much more about LaTeX if you spend a few minutes reading. It’s written in a very easy-to-ready way anyway.

This book doesn’t beat around the bush with introductory material much, but digs into all the interesting things that you’ve probably wanted to do after writing up that first paper with LaTeX, or for writing up your own thesis or book — How do I change the fonts exactly the way I want? Can I draw my circuits/plots/chemical diagrams/flowcharts in LaTeX now? (Yes I enjoyed the chapter on Creating Graphics a lot — in fact you can download it as a sample chapter!) Mmmm you think your doc needs some pretty decorations, let’s see how we can spruce it up — Ah! Ornaments, coloured lettrines, images with rounded corners or badge-shaped, so designer-ish! (Come on, admit it, you know when those creative/productive procrastination mood hits…)

Another chapter worthy of mention is on how to ask a good question, and formulate a minimal working example (MWE), to make it easier for others to help you solve a problem. Having lectured students myself, I cannot emphasise enough how important this skill is. *meaningful nod*

So. Should you get these books? You bet. $5 per book until 6 January 2016!

Wednesday, March 4, 2015

"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!

Monday, October 8, 2012

Updates for mmuthesis and umalayathesis

Just a quick note that updated classes of mmuthesis and umalayathesis has been uploaded at my website.

mmuthesis

Based on feedback from a MMU student who submitted her thesis recently, IPS now requires that the Publications List be categorised in to Journal Articles and Conference Proceedings, and that text in the appendices should be 10pt. Please read the updated user manual on how to prepare the Publication List under the new scheme.


umalayathesis

Bug fixes of some spacing of appendices entries in the ToC, as well as adjusting the overall line spacing to conform with the expected output by IPS. Font of the cover page now uses Arial Narrow look-alike.

Saturday, October 6, 2012

New uumthesis LaTeX Class and LyX Layout

On request, I have created a LaTeX class and LyX layout for writing Universiti Utara Malaysia theses. Credit goes to Dr. Mohd. Hasbullah bin Omar for getting the output endorsed by UUM’s Graduate Office.

The uumthesis LaTeX class, LyX layout, sample files and user manual can be downloaded from my website. Happy LaTeXing to UUMians!

Friday, August 24, 2012

Putting Dates in Watermarks

It’s been rather a long time sine I last posted anything as I’ve been working on my thesis and article… sorry!

Theses and articles typically go through many versions, ding-dong to-and-fro between supervisors and co-authors. Some people keep track of the version number (or date-last-modified) by giving each draft a different file name. Personally, though, I tend to get inconsistent with the file naming, especially when it's 2:30am. So I figured it might work better for me if the date-last-modified was printed in the PDF of the thesis/article draft itself.

One could always put the date in the header or footer, but there might already be some content in those regions. Besides, it's probably not a good idea to mess with the formattings for a journal article. Instead, I put \today in a watermark, so the date would get updated I compile my draft:

\usepackage{draftwatermark}
\usepackage{datetime}
\ddmmyydate
\SetWatermarkLightness{.9}
\SetWatermarkText{Draft\string@\today}
\SetWatermarkScale{.6}

The colour, lightness, font and other attributes of the watermark are configurable. I also used the datetime package to configure the date formatting. Here’s how the output looks like (a page from my thesis draft):


Saturday, March 17, 2012

Working collaboratively.. which one you prefer?

I found out this website, perhaps from an event organizer whom advising on the usage of MS Word over LaTeX.

Perhaps somebody out there could point out if there is any business entity that does the same business but in the other way around - using LaTeX


Thursday, February 9, 2012

Creating an Online Academic Portfolio with LaTeX and TeX4ht

This was originally asked on TeX.SX, the requirements being:

Any one know of a good script to turn a bibtex file into a nice academic portfolio that:
  • links to electronic versions where known (from url or doi)
  • works with local files (e.g. with bibdesk's format or otherwise)
  • automatically creates a thumbnail of the first page
  • and generally produces a polished web page suitable for showing off your work?

Well, I maintain my own online publication list by generating the HTML code from my BibTeX, using BibLaTeX, Biber and TeX4ht. So my answer to the above question was a quick modification of my own workflow, adding Ghostscript to the mix to generate thumbnail images of the papers. The output looks like this: (The publication lists can be split according to their types)


(BibLaTeX is a complete reimplementation of the bibliographic facilities provided by LaTeX in conjunction with BibTeX. It’s very flexible, and many find it easier to deal with compared to the BST language. Biber is the replacement of the BibTeX binary, for users of BibLaTeX.)

The source codes can be downloaded here as a .zip file. Further elaborations follow.

The Bibliography File

Back to the task at hand. First we have the BibTeX file, the content of which is pretty much the norm, except that I used the custom BibLaTeX field to hold the local PDF file name. My publications.bib contains entries like:

@ARTICLE{Lim:Ranaivo:Tang:2011,
author = {Lim, Lian Tze and Ranaivo-Malan\c{c}on, Bali and Tang, Enya Kong},
title = {Low Cost Construction of a Multilingual Lexicon from Bilingual Lists},
journal = {Polibits},
year = {2011},
volume = {43},
pages = {45--51},
url = {http://polibits.gelbukh.com/2011_43/43-06.htm},
usera = {LLT-polibits.pdf}
}

The LaTeX Source File

Next is the portfolio.tex file, in which I set up a hook at every bibliography item to include the first page of the file pointed to by usera. I've also added a bibmacro called string+hyperlink, to make the publication title link to the url or doi field if these are available, as shown in this answer.

\documentclass{article}
\usepackage[backend=biber,bibstyle=authoryear,sorting=ydnt]{biblatex}
\usepackage{graphicx}
\bibliography{publications}
\usepackage{hyperref}

\ExecuteBibliographyOptions{doi=false,url=false}
\newbibmacro{string+hyperlink}[1]{%
\iffieldundef{url}{%
\iffieldundef{doi}{#1}{\href{http://dx.doi.org/\thefield{doi}}{#1}}}
{\href{\thefield{url}}{#1}}}
\DeclareFieldFormat*{title}{\usebibmacro{string+hyperlink}{#1}}


\newbibmacro{usera}{%
\iffieldundef{usera}{}{%
\savefield*{usera}{\filename}%
\usebibmacro{string+hyperlink}{\includegraphics[width=100pt]{\filename}}\\}%
}
\AtEveryBibitem{\usebibmacro{usera}}


\begin{document}
\section{My Academic Portfolio}
\nocite{*}
\printbibliography[title={Articles},type={article}]
\printbibliography[title={Conference Proceedings},type={inproceedings}]

\end{document}


TeX4ht Configuration File

I then set up a TeX4ht personal configuration file, called portfolio.cfg (included in the .zip file). It contains some simple CSS, and tells TeX4ht to convert the first page of the local PDFs into PNGs using ghostscript. (So yes you will need to have ghostscript installed for this to work.)


Generating the HTML

Right, now we can run the following commands:

$  htlatex portfolio "portfolio"
$  biber portfolio
$  htlatex portfolio "portfolio"

And you should then get portfolio.html, which you can further embellish with more CSS. Well that was fun!

Thursday, January 12, 2012

Use of LaTeX in Industry

A question on TeX.SX about “How is LaTeX used in industry and what are some examples?” has garnered over 6k views since posted yesterday. I had mentioned during my MOSC talk that LaTeX would be very useful in scenarios where some printable content has to be batch-generated or on-the-fly, and now some actual real life examples are given in the answers.

For example, this website allows users to query transportation timetables and returns the results as a pdfTeX-generated PDF:


And here’s another schedule generated by another German transportation website (PDF):


If you read the other answers, you’ll see what and how LaTeX is used in other companies (besides academic publishers). For example, this answer by Peter Flynn:

As a LaTeX consultancy, we have produced classes and styles for many organisations, including companies, government departments, and non-profits. A London auction house uses LaTeX to generate invoices; an electronic systems training company uses LyX and LaTeX to create their course workbooks and white papers; a Dublin printer uses LaTeX for pharmaceutical labelling; a local government organisation uses TeX to generate the Register of Voters; a professional scientific association uses LaTeX for its regular series of technical reports; and of course we use it internally for client reports, newsletters, and invoicing.

Thursday, June 23, 2011

Book Review: LaTeX Beginner’s Guide

(Thanks to Packt for the complimentary eBook copy for this review.)


When I read about the publication of the book on various forums and blogs, my interest was definitely piqued: the author, Stefan Kottwitz, is a frequent and helpful contributor/moderator on TEX.SX. On the other hand I wondered if anyone would actually want to buy an introductory book to LaTeX, considering the many free tutorials and eBooks available on the Web (although there are many out-of-date ones, so beware! See some recommended ones at the end of this post).

After a quick flip — erm, clicks with the mouse — through my complimentary eBook copy courtesy of Packt, I felt the answer was a very firm “YES”. First off, this is certainly an up-to-date book with descriptions of recent packages, and warnings about obsolete ones. While the first few chapter headings read like most other beginner’s guide to LaTeX, Kottwitz’s approach of using complete step-by-step examples throughout the book is something seldom seen in other books or tutorials. By that I mean you don’t just get the first few handful of “Hello World” examples, but for much more advanced usage scenarios as well. (BTW, The examples are based on TeXLive and TeXworks.)

Your mileage may vary, but I do feel that such a hand-holding approach (that’s what my training course had been described as) — at least in the early days of learning LaTeX — is very reassuring. Especially so since LaTeX can be rather intimidating for people who have only used WYSIWYG word processors before. Pop quizzes are interspersed throughout the content (answers in the appendix).

The book has 13 chapters on the following topics:
  1. Getting Started with LaTeX
  2. Formatting Words, Lines, and Paragraphs
  3. Designing Pages
  4. Creating Lists
  5. Creating Tables and Inserting Pictures
  6. Cross-Referencing
  7. Listing Content and References
  8. Typing Math Formulas
  9. Using Fonts
  10. Developing Large Documents
  11. Enhancing Your Documents Further
  12. Troubleshooting
  13. Using Online Resources

While the early chapter headings are kind of expected of any beginner’s guides, they do still contain valuable nuggets. For example, the microtype package is introduced in Chapter 2, as is how to define your own macros with \newcommand. Imagine a beginner’s joy at the even more beautiful typesetting afforded by microtype. And the new-found freedom of defining one’s own commands for consistent typesetting of certain materials. Personally I think such tips, introduced at an early stage, would boost beginner’s confidence in using LaTeX.

While some might consider the installation instructions of TeXLive and TeXworks in Chapter 1 as frivolous, I certainly welcome the instructions on how to install extra packages in Chapter 11.

Chapter 3 on designing pages is particularly useful, as this seems to be one of the most frequently asked beginner’s questions these days. (at least, indicated by the fact that the post on setting page sizes and margins being the 5th all-time most favorite post on this blog.)

I also like the mention of getnonfreefonts in the chapter on fonts. Another favorite chapter of mine is that on Troubleshooting, as this is definitely one of the most important skills if one is to use (and learn!) LaTeX. And everyone who’s going to write a thesis or a business report will definitely want to read Chapter 10 on large documents.

Overall, the book does cover everything a beginner should learn about LaTeX, IMHO anyway. My only nitpicks are that the LaTeX logo isn’t typeset ‘properly’ in the text; and that the LaTeXed output images seem a tad blurry in the PDF eBook version. But these are just petty nitpicks, really.

So do I recommend LaTeX Beginner’s Guide for people interested in learning LaTeX? I’d say Yes. This would be a very nice addition to libraries, or as a communal copy in a research lab, so that newly registered graduate students who’re not yet quite busy with their research can spend their first month learning up LaTeX with it. (You can, of course, get your very own copy; I only mention a communal copy as I know some Malaysians — especially poor grad students — might be reluctant to fork out about RM120 for a book. Everyone really should fork out money to buy a good book sometime, though.)

The book is available as a printed copy (£25.19), eBook copy (£16.14), or multi-format (£28.04). Shipping is free if you’re in UK, US, Europe, Brunei, Hong Kong, Indonesia, Japan, Malaysia, Philippines, Korea, Singapore, Thailand, China, Macau and Taiwan — sweet!

Further Reading

Having said all that, you’ll probably want to complement this beginner’s guide with other, more reference-typed books, such as the LaTeX Companion (I don’t know if the books are available separately), as well as some free (often rather shorter) tutorials and eBooks:
  • Getting to Grips with LaTeX. A personal favorite short beginner’s tutorial.
  • The LaTeX WikiBook. A nice quick online reference.
  • LaTeX and Friends. This is truly a very comprehensive up-to-date eBook for reference purposes (but it does not have complete examples as Kottwitz’s book does). I understand that the author is still updating it from time to time.

Monday, June 20, 2011

LaTeX: More Than Just Academic Papers and Theses

Update 2 July 2011: OK source code uploaded per request, see link below.

So my slides for the talk on LaTeX during MOSC2011 are done and available for download. (This version without animations etc. to minimise the file size. Updated and corrected 30 June 2011; Thanks to Stefan Kottwitz, Felipe and Per for pointing out some mistakes.)


As mentioned before, it won’t be a tutorial, rather I plan to give teasers of what LaTeX is capable of beyond the usual journal or conference articles. I have undoubtedly left out many interesting use cases, so please don’t flog me if I haven’t included your favorite package or class! ;-) But do drop me a line and we’ll do a future post on it.

(Update: See this post about the Beamer theme used for the slides.)

Typesetting SI Units

Most people would already have heard of the siunitx package, but in case you haven’t, here’s a small, humble request:

<rant>
Please use the siunitx package more to typeset your measurements. Please. I beg you. It’s so much easier and makes things look so much more professional.
</rant>
(Yes, this is going to be a rather ranty post, but don’t worry, I’ll keep it short.)

I mean, just compare the output when using siunitx:

\usepackage{siunitx}
\SI{3.563d4}{\square\volt\cubic\lumen\per\farad}


And doing it manually:

$3.563 \times 10^4$ V$^2$ lm$^3$ F$^{-1}$


I rest my case. And if you’re not convinced yet, you can also do lists and ranges of values like this:

\SIlist[per-mode=symbol]{40;85;103}{\kilo\metre\per\hour}
\SIrange{75}{110}{\kilo\pascal}



So please. Start using siunitx.

Thursday, June 16, 2011

Upcoming Book Review

Perhaps it’s all the publicity work by the good people behind MOSC 2011 (thank you!), during the last week or two I’ve definitely been getting more LaTeX enquiries (thanks to all of you too!).

So much so that I was very kindly offered by Packt to review a recent book on LaTeX by Stefan Kottwitz!

(The publisher, Packt, specialises in books on open source projects and pays royalties to the projects it publishes about. I’m rather impressed by that.)


I’ve read about the publication of the book on other blogs and forums and my interest was already piqued; not least because Stefan is a very frequent and helpful contributor on TeX.SE.

Well, I have a book to read and a review to write. Stay tuned!

Monday, June 6, 2011

University of Malaya Thesis Class

I have developed a LaTeX class and template for writing an UM (University of Malaya) thesis, complying with the IGS Universiti Malaya IGS Guide to the Preparation of Research Reports, Disertations & Theses, for a friend pursuing her PhD there.

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

Saturday, May 28, 2011

Talk at MOSC2011

My proposed talk on LaTeX has just been accepted by the organisers of MOSC2011.

Now I need to actually write the slides!

Anyway, I plan to speak on “LaTeX: More Than Just Academic Papers and Theses”. It won’t be a tutorial, rather I plan to give teasers of what LaTeX is capable of beyond the usual journal or conference articles.

This will also be my first time attending an OSS conference. I do rather feel queasy at the thought of being intimidated by crusty h4x0rs. :-)

UPDATE: The organisers have posted my speaker’s profile.

Friday, April 22, 2011

Making Leaflets with LaTeX

Just for fun, I thought I’d make some leaflets to accompany my poster presentation during a recent conference. It would be nice if I could reuse materials from my paper and poster, so I sought for a LaTeX solution, and that solution was the leaflet document class. It automatically sets up a layout for 6 small pages on 2 normal-sized paper pages, so that you can print the output PDF out on double pages, then fold it up into a real, er, leaflet.

Here are the thumbnails of my leaflet, and here are the source code. Notice the little mark (highlighted by the red circle) on the second page to guide you in folding the leaflet. Just make sure that you set your PDF viewer to “Do not scale pages” when printing the PDF.


Sunday, March 20, 2011

Creating Academic Posters (and Printing Them)

I presented a poster paper at CICLing 2011 in Tokyo (that was the end of February so I wasn’t there during the earthquake, but it seems the organising committee members are all alright, thank heavens) and I naturally created my poster with LaTeX. Here’s a thumbnail of my poster:


I created this A0-sized poster (source code the TikZ drawings and CJK characters are externalised as PDF graphics and the bibliography embedded, so it should be compilable on most LaTeX installations without extra packages) with the beamerposter package, mainly by modifying Rob Hyndman’s style file. (There are other packages for creating posters in LaTeX, see this link for an overview.)

You can download my .sty and a simple sample poster .tex files here. I’ve put the colour themes (ComingClean in the left thumbnail, ConspiciousCreep on the right, inspired by this and this respectively) in their own separate .sty files. ConspiciousCreep is probably not so suitable for an academic poster… but perhaps it could be useful for a not-so-serious occasion.


Note that the sample poster is A1-sized; change the poster size in the .tex file as you require. I also defined a \footimage command that can be used to put whatever material you want in the bottom right hand corner. (I included photos of the authors in my poster not because of vanity, but because the organisers asked us to do so, so that it’d be easier for participants to locate the relevant authors.)

I brought my A0-sized PDF along to a printing shop who happily printed it out on one glorious giant A0-sized synthetic paper material. However, if you have trouble finding a printing shop who can print out these big sizes, you can use the pdfposter utility (available on all major GNU/Linux distros) to process your PDF into smaller-sized tiles. For example, if the input LLTposter-sample.pdf is A1-sized, then

pdfposter -s1 -ma4 LLTposter-sample.pdf a4tiles.pdf

will take the input file LLTposter-sample.pdf, split it into 8 A4 pages and save them in a4tiles.pdf. You can then print out the A4 pages and assemble them back into an A1-sized poster at the conference venue. (-s1 means no resizing of the original poster size, hence A1 as the result.) Enjoy!

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, 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!