Wednesday, February 25, 2015

Getting File Basebase without Extension in GNU Makefile

Sometimes we would like to write a generic rule in GNU makefiles.

For instance, we would like to write a rule to process a LaTex file and then process BibTex entries for any LaTeX files. We can write the rule as follows,

%.dvi: %.tex
    latex $<
    bibtex $(basename $<)
    latex $<
    latex $<

In the example, if we issue a command make example.tex, the value of $< is example.tex while $(basename $<) yields the basename without the extension. The basename without the extension is required for bibtex to work in this example.

This solution is provided by the discussion here.

Tuesday, February 24, 2015

Installing lineno.sty in Ubuntu and Fedora Linux

When we prepare a document using LaTeX, sometimes we want to include line numbers in an article. In many peer reviewed journals, it is a requirement to include line numbers in the output.

For instance, Elsevier LaTeX instructions has a LaTeX template whose LaTeX template file starts with



You system has not had the lineno package installed, if you encounter the following error when you compile your LaTex file that uses package lineno,

! LaTeX Error: File `lineno.sty' not found.

Type X to quit or  to proceed,
or enter new name. (Default extension: sty)

Enter file name:

Although you can download and install it from CTAN, you may be better off by installing the appropriate package provided by your system and let your system manage it. For instance, on Ubuntu Linux, we can install the textlive-humanities package,

sudo apt-get install texlive-humanities

For instance, on Fedora Linux, we can install the texlive-collection-humanities package,

sudo yum install texlive-collection-humanities 

The solution comes from the posts at here and here.

Creating Small Footprint Linux Virtual Machine - Revisited

Although many virtual machine appliances exist today and are conveniently to download, such as the VMWare Virtual Appliance Marketplace and the TurnKey Linux Virtual Appliance Library, it may be necessary to create a virtual machine image of your own and distribute it among the others. The issue is that a virtual machine image can easily become a monster and can be difficult to host, upload, download, and distribute such a large image. Previously, I attempted to create Linux virtual machine images with small footprint using the approach of installing the system and removing unnecessary packages. That approach leads to virtual machine images compressible to around 1GB archives.

Lately, I have opted to a second approach in which we install a bare bone Linux system and then install necessary packages. This approach, I found, often leads to smaller footprint than the previous approach.

The only caveat is that this approach may not work well with certain Linux distributions if the Linux distribution does not provide a means to install bare bone systems. If a Linux distribution does not provide a means to install the bare bone systems, it is likely to be a desktop edition, for instance, Ubuntu Linux's Desktop Edition has no option for a user to install a bare bone system during its installation process. A workaround is to create the system image using its corresponding server edition distribution, for instance, Ubuntu Linux's Server Edition allows you to install a bare bone system.

At present, I have a 64-bit Ubuntu Linux Server Edition image with PostGreSQL, Apache Web Server, and PHP but without GUI and the image is compressed to about 350MB archive.