Is there a package to generate a receipt which has following information. Header with a company name , date , receipt number which should be automatically generated and text saying - Received Xx amount from Mr xyz as a payment for xyz.


  • 4
    In case there isn't, if you provided more info about how you want to input that information, yes, it would be possible to write it. By the way, “receipt number which should be automatically generated” how can you know on a compilation which number to start? You must provide the starting point.
    – Manuel
    Oct 20, 2014 at 19:53
  • May be using data tool
    – Vaibhav
    Oct 21, 2014 at 1:39
  • 3
    As it stands I don't think this question is going to get answered. It's not clear which parts are an issue, and with no example code we've no real idea what you have already done.
    – Joseph Wright
    Oct 28, 2014 at 11:42
  • 1
    lualatex may be useful here, since it can open databases etc. But, indeed, you should speficy your needs more precisely in order to get a useful answer.
    – nplatis
    Oct 28, 2014 at 14:10
  • 1

3 Answers 3


I made a sample receipt using datatool and tikz. For printing such receipt, you may need a database in which you store the data of your customers. I made it by creating a cvs file named database:

11234,Name,Family,"No. 1, First St.", "2014,06,02",1000
21485,Name,Family,"No. 1, First St.", "2014,06,02",1000
35987,Name,Family,"No. 1, First St.", "2014,06,02",1000
45784,Name,Family,"No. 1, First St.", "2014,06,02",1000
56874,Name,Family,"No. 1, First St., City, Country.", "2014,06,02",1000
69851,Name,Family,"No. 1, First St.", "2014,06,02",1000

By running the code bellow, you will ask the latex to read the receipt or bill number you enter in front of the \def \query { } and all the data you need will be printed in the output pdf file.

I used the tikz package to create a sample logo too, you may change this part and add your own company's logo or even omit it from the file.

enter image description here


\usepackage[a6paper, margin=10mm, landscape]{geometry}

% ------------- | ---------- Please enter the bill number you want to print
\def \query {56874}
% ---------------------------------------------------------------------------------

\begin{tikzpicture}[overlay,remember picture]
\draw [line width=1.0pt,rounded corners=10pt,]
    ($ (current page.north west) + (5mm,-5mm) $)
    ($ (current page.south east) + (-5mm,5mm) $);       
\begin{tikzpicture}[overlay,remember picture]
\draw [line width=1.0pt,rounded corners=10pt,]
    ($ (current page.north west) + (15mm,-10mm) $)
    ($ (current page.south east) + (-105mm,65mm) $);
    \node at (-2.11,-1) {Logo};
{\bf \LARGE Your Store Name}\\[2.5mm]
Address Line Here\\
Phone: 555-555-555555\\
Fax: 123-123-123456\\[15mm]
{\bf \Large Cash Receipt}\hfill$\overline{\text{cashier's signature}}$\\[10mm]

\noindent {\bf Cash Receipt Number:} \billnumber \hfill {\bf Date:} \billdate \vfill
\noindent Cash Received from\hfill \firstname{ }\surname\hfill of \hfill \$\amount \hfill payed in cash~$\blacksquare$~/~by check~$\square$\vfill
\noindent{\bf Customer's address:} \address\vfill

  • This is off-topic : why % ------------- | ---------- ? What is the purpose of this | ?
    – Clément
    Nov 3, 2014 at 15:53
  • 2
    @Clément its just a marker to point to the invoice number which needs to be changed, directly below on the next line. Personally, I don't see why you would want to do receipts with latex when there are about a million accounting packages built for this purpose (amongst other things)... Nov 3, 2014 at 19:28
  • @Clément I think nicholas's comment perfectly answers your question.
    – enthu
    Nov 3, 2014 at 20:02

A partial answer, just to show how you can increment a counter (to be fair, this trick was found somewhere here, on TeX.sxe, but I can't find where anymore…).


This document was compiled \theNumberOfRuns~times so far!

This small code will store in the aux file the number of times your tex was compiled so far. You can edit it or remove it to affect the value of your NumberOfRuns counter.


I have a solution, which you can modify for your needs:


\read\NoFile to \fileline




Receipt No. \theNoReceipt


\read\DataFile to \fileline
\read\DataFile to \fileline
as payment for
\read\DataFile to \fileline



Furthermore, you need two files, NoFile.txt and DataFile.txt. NoFile.txt contains the current number, so you need to provide this file initially with just the content 0 and DataFile.txt contains the information in this format:

Mr. X

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .