March 12, 2017


I spent the weekend preparing a few LaTeX templates, one of which happened to be for generating rent receipts. As I am both a house owner as well as a tenant, I thought there was a case to reduce it to filling just a few blanks, and be done with. The following does just that. It takes furnished data and converts it into a form ready to be printed for signature.

%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
% -- Enter rental details below --
\newcommand{\mfr}{April 2016} % Month from
\newcommand{\mto}{March 2017} % Month to
\newcommand{\mrent}{30000} % monthly rent
\newcommand{\trent}{360000} % total rent for the period
\newcommand{\addr}{9, Some street, City 710210} % rented property
% Owner details
\newcommand{\owner}{John Doe}
\newcommand{\oaddr}{5, Somerset Heights \\ Crescent Villa, City 710001}
\newcommand{\opan}{XXXX0504Y} % Owner PAN no.
% -- End of data entry. Do not edit below this line. --

    \textbf{RECEIPT OF HOUSE RENT} \\
    (Under Section 1 (13-A) of Income Tax Act) \\

\noindent Received a sum of \num{\trent}.-- \emph{(Rupees \NumToName{\trent} only)} 
as rent at Rs. \num{\mrent}.-- per month from \emph{\mfr} to \emph{\mto} for the 
property at \emph{\addr}.


\noindent Date: \today \hfill Signature of House Owner \\\\
\noindent Name: \owner \\
\noindent Address: \oaddr \\
\noindent PAN No: \opan \\


And yes, it prints the total rent received in words automatically using numname package.

Rent receipt example

But there is room for improvement, of course. Ideally, I’d just like to fill in a monthly rent, start and end months, and let LaTeX generate the total rent for the period by calculating these on the fly, and insert it in the form, all of which I could not find a simple way to incorporate in the above. A version of the above script is available at my gist repository; feel free to fork, and improve.

March 5, 2017

Odds + ends

Science day. We strolled through IISc on its Open Day yesterday, attending poster-sessions, live-exhibits, and demonstrations — as part of its National Science Day + Founder’s Day celebrations. The place was swelling with young aspiring students, and everyone seemed interested in the research and the on-goings there. Along the way, I picked up the Special Centenary Year Issue of the Journal of the Indian Institute of Science, a collection of priceless papers, including those from Raman, and Bhabha. It weighs a ton, and I am very grateful to IISc for giving these away.

Flat. On our way back, we had a flat tire. The mechanic pulled a large nail out of our rear tubeless tire, inserted a sticky plug in the hole, and inflated the tire back, as shown in this video. It was my first time witnessing this, and I realised how quick and painless this was, when compared to fixing a tire with tube inside.

Commute. With the office move to a remote location a month ago, my commute has gotten a lot worse. I now spend over two mindless hours a day just to go to work and back, adding up to 13 hours a week. Side effects include insufficent time to work, fatigue, inflexible routine, and road-hazard exposure, summing-up the travesty of urban life.

Hot-desking. Adding minutes to those already wasted in commuting, we now play musical chairs called hot-desking. There’s, of course, just no music in finding a workspace, adjust desk + chair, and then get to managing keyboard-video-mouse hygiene every single day. After two weeks of scrubbing the shit off keyboards people leave behind, I decided to carry my own to work. In the process, I replaced my broken with G610, a mechanical keyboard, which my nerve-endings seem to like.

February 5, 2017

Small caps in Word

There are times when I resort to converting all instances of capitalised words (or caps) into small caps in a document, because they look best in certain classic serif fonts like Garamond. To do this manually would be insane, and therefore I resort to using regular expressions instead, which Word thankfully has support for.

Under Advanced Find, enter [A-Z]{2,}, select Use wildcards, click on Find In, and choose Main Document as shown below.

Finding all capital words in Word

The above would select all instances of caps with 2 or more characters. From the Aa menu bar in the Home tab, select lowercase to format all selected capital words to lowercase. Then with the words still selected, press Ctrl+Shift+K to convert them all into small caps.

Sublime Text 2: See TEX to do this in ST2.