Manual update of LaTeX packages on Ubuntu

June 21, 2012

I installed LaTeX in both the OS that I have: Windows 7 and Ubuntu 12.04.

Recently I just discovered a new command of LaTeX that lets you change the default margins of your output document. This command requires the package called “geometry“.

In Windows 7 I use MikTeX to write any LaTeX document. The first time I used the new command, the program asked me to download and install the new package. After this operation, everything worked fine and I obtained an output file with custom margins.

However, when I tried to compile the exact .tex file on Ubuntu, I would get an Undefined control sequence error.

The strange thing is that I already installed every basic, extra, recommended and math packages.

After some research on web, I found out that maybe my geometry package was not the newest version.

So I decide to download the newest version from CTAN and manually update the package.

The overall process are:

1) Download the package that you want. You need to save the file XXX.dtx, where XXX is the name of the package. In this case is geometry.dtx

2) Now we need to get a file ending with .sty that LaTeX can use. To do so we just need to type in the terminal:

tex geometry.dtx

This command works only if you are inside the same directory of the package you downloaded. Otherwise you need to write the full path.

3) Locate the geometry.sty that the command above created and move or copy it to

/usr/share/texmf-texlive/tex/latex/geometry/

in order to replace the old one.

Or, as said in the source (below), for any manual update you should put the new version in /usr/local/share/texmf/tex/latex/geometry/ (which always gets searched *before* the texmf-texlive tree). However I have not tested this option so I don’t know if it works or not.

4) After any (manual) update you need to run the command

sudo texhash

to update the texmf-texlive tree. Otherwise new files will not be found out.

Sources:


Installing MATLAB on Ubuntu

June 18, 2012

MATLAB (matrix laboratory) is a software developed by MathWorks that allows matrix manipulations, plotting of functions and data, implementation of algorithms, creation of user interfaces, and interfacing with programs written in other languages, including C, C++, Java, and Fortran.

Although a lot of software are designed for OS like Windows, this software has also a version designed for Linux.

The installation is quite easy and one can just follow the instructions described inside the “install_guide.pdf” that can be found in the DVD of Matlab (or you can download it from the source at the end of this post) and if you are lucky you can start working with this software without encountering any errors during the overall process.

I decided to summarise the overall process trying to point out the most important part that could led to error.

1) obviously the first thing to do is insert the DVD inside the DVD drive of your pc. Otherwise if you have a back up copy of the DVD like as a disk image in the format .iso, then you just need to mount it.

2) open your terminal and change the location to the directory of your DVD. For my case it is: cd /media/cdrom1/

3) now we need to launch the installer. To do so you just need to type: ./install or sudo ./install

the secondo version with sudo is to give the permission to the installer to create directory in special directory that requires root privilege.

4) now you just need to follow the instructions that appear to complete the installation.

To start MATLAB software you just need to type in the terminal the path where is located the script-shell type file called “matlab“.

For my case it’s:

/usr/local/MATLAB/R2012a/bin/matlab

In the case you have Ubuntu 11.04 or newer you will notice a message of warning(although the software will open up just fine):

/usr/local/MATLAB/R2011a/bin/util/oscheck.sh: 605: /lib/libc.so.6: not found

Some answer to why there is this warning can be found here (it’s written in Italian). To solve this problem you just need to type this in the terminal:

for 32 bit version of Ubuntu

sudo ln -s /lib/i386-linux-gnu/libc-2.13.so /lib/libc.so.6

for 64 bit version of Ubuntu

sudo ln -s /lib64/x86_64-linux-gnu/libc-2.13.so /lib64/libc.so.6

In my case I noticed that insted of libc-2.13.so I have in my system libc-2.15.so. So I just changed the command up in this:

sudo ln -s /lib/i386-linux-gnu/libc-2.15.so /lib/libc.so.6

—————————————————————————————————————————————————–

UPDATE: I also noticed that, instead of doing the above command, you can just copy the file libc.so.6 that is inside the folder /lib/i386-linux-gnu/ into the required folder that is  /lib  . This method is the same as the above command that is creating a file called libc.so.6 that is linked to the file libc-2.15.so.

—————————————————————————————————————————————————–

Then I just relaunched MATLAB and now the warning has disappeared.

To have a fast access to the program we can create a Launcher inside of our Dash or better put in the sidesibar of Unity.

First we need to get an icon for our Launcher. Just type this inside of your terminal:

sudo wget http://upload.wikimedia.org/wikipedia/commons/2/21/Matlab_Logo.png -O /usr/share/icons/matlab.png

or simply save this image and put it in the directory /usr/share/icons/

then you just need to follow this tutorial.

PS: in the following links you can read about some extra problems and their solutions not indicated in this tutorial because for now it’s not of my interest.

Sources:


How to create custom Launcher for the Dash of Unity

June 16, 2012

When I finally installed a particular program in Ubuntu, I noticed that during the installing process Ubuntu didn’t create a shortcut launcher inside the Dash, let alone inside the sidebar.

The whole process of creating a custom launcher is really simple, all you need to do is to create a simple file with the format .desktop.

To begin you just need to paste the following code inside a text editor like gedit:

[Desktop Entry]
Name=
Comment=
Exec=
Icon=
Terminal=false
Type=Application
Categories=

Name-> refers to the name that will be displayed inside the Dash

Comment-> you can put a comment to describe the use of this launcher or whatever (by this you can guess that this parameter is optional)

Exec-> you need to type the path of the executable program that this launcher will run. Example: /usr/local/Matlab/R2012a/bin/matlab. If the program doesn’t start maybe you can add at the end ot the path the option -desktop. When I have this sort of problem, this solution works just fine. So the path will become this way /usr/share/Matlab/R2012a/bin/matlab -desktop

Icon-> you need to type the path of the icon that this launcher will display. Example: /usr/share/icons/matlab.png

Terminal-> determine if the program need to be run through the terminal or not.

Type-> describe which type is this launcher. It could be Application, Link or Directory

Categories-> indicates in which category the launcher will be put inside the Dash.

After filling up the all parts you just need to save this file in XXX.desktop, where XXX could be whatever name you want.

The last operation is to give this file the permission to run as an executable. To do so you just need to type this inside the terminal:

sudo chmod +x XXX.desktop

This works only if you are inside the same directory of the file .desktop, otherwise you need to change the XXX.desktop with the full path.

you should be able to notice a little difference in the displaying of the file .desktop you just created.

Before the command it was visible in this way

After, it become this way

To make it visible inside the Dash of Unity you just need to move it inside the directory

/usr/share/applications/

or

~/.local/share/applications/

In the second case the launcher will be visible only to the user that created it.

Now that everything is done you can open the Dash and type the name of the launcher you just created and if you did everything okay, you should find it easily.

To add it to the sidebar of Unity, you just need to drag and drop the launcher inside the Dash to the sidebar, just like with any other launcher already inside the Dash.

PS: The file .desktop let you also to create a menu that gives you access to custom shortcuts of the program. However that is not in my interest in this moment so I will not describe it now, but I thought it was useful to point it out.

Source: LauncherFileDesktop



LaTeX: include eps files in pdflatex

June 10, 2012

My problem is I have several image files that are in .eps format.

I need to include these images inside a .tex file and then compile it by pdflatex to create a pdf file.

I already knew that if I compile my .tex file using pdflatex it will give me an error because it doesn’t support .eps graphics but only jpeg, png, pdf…

After some search on the net I found an online solution. In this website you can upload your .eps files and as a result you will have your converted .pdf files to download and to use in your .tex file.

The only disadvantage about this online solution is that if you have a lot of files you need to convert, you will have to stay there to upload one by one because it doesn’t support multiple files.

So the next solution is what I prefer.

You need to declare these two package in your preamble:

\usepackage{graphicx}
\usepackage{epstopdf}

then you can include .eps files as any other simple images:

\includegraphics[option]{file_name}

The trick is that when you are compiling by using pdflatex it will check if the corresponding pdf version of the file exists or not. If it does, it will simply use the pdf version, otherwise it will convert the eps version to a pdf version and then use the pdf file.

NB: To compile the .tex file you need to add “-shell-escape” in your command of pdflatex:

pdflatex -shell-escape name_file.tex

Sources:


									

How to mount an ISO image on Ubuntu

June 10, 2012

An ISO image is an archive file of an optical disc.

In OS such as Windows you can mount it by using software like DAEMON tools lite.

However Ubuntu let you mount it just by typing some simple command on your terminal.

1) First you need to create a directory for your ISO image. To do this open your terminal and write this in it:

sudo mkdir /media/ISO

and then press enter. You will be asked to enter the password for root user.

2) Now is time to mount your disk image by executing this command on terminal:

sudo mount -t iso9660 -o loop /xxx/name_image.iso /media/ISO/

“/xxx/name_image.iso” is the path where is located your disk image.

“/media/ISO/” is the path where you want your disk image to be mounted. In this case it’s the directory that we just created before.

If everything goes well, it will open by itself the directory in which your mounted disk image is, otherwise you can access it like any other directory knowing its path.

To unmount the disk image you just need this command:

sudo umount /media/ISO/

Source:  montare-le-iso-senza-problemi


Fixing a stuck CD/DVD tray

February 2, 2012

It’s really a long time the last time that I used my DVD drive from my old desktop computer (bought in 2000) to read some CD/DVD.

But for some reason the CD tray just doesn’t want to open. So I decided to remove it from the pc to give a better view to the inside of this hardware.

It was easy to remove it from the pc, but I can’t seem to open it completely to reach the inner part to see how the hardware is working in order to search for the problem. (Maybe I was afraid of breaking it)

So I searched on Internet and I found out that all process that I was doing was unnecessary.

To open the disk tray, you can just do a manual eject.

  1. Search for a pinhole in the front panel of the CD/DVD drive;
  2. Then just use a paperclip or something similar and insert it inside the hole (with force if need it);
  3. Magically you will see your disk tray open up by itself.

This is a really simple way to solve the problem temporarily, but it’s annoying to go this way every time you need to use the disk drive.

Eventually I found a really interesting video that show you how to disassemble completely the DVD drive. In addiction it shows what’s the problem of the drive and a simple way to solve it.

It’s really a must see to all people who have the same problem and want a lasting solution.

Sources:


Firefox “save and quit” option

February 2, 2012

I don’t even remember from which version of Firefox that the useful option of asking you if you want to save the multiple tabs you opened before closing firefox disappeared.

At first I didn’t even care much about it, but in the few times that you need it, it’s really annoying not having with you.

In the end I found out that you just need to change some parameters of  Firefox to display it again.

You need to do the following actions:

  1. In the address bar type about:config. It will show a warning messages but it’s okay so just click the button to enter in the configuration page;
  2. Search for the variable called browser.warnOnQuit. If it has value false, then double click on it to change its value to true. In this way if you have multiple tabs opened, when you are going to quit Firefox it will display a message asking the confirmation of closing Firefox (This is really useful to me because quite often I click by mistake the quit button);
  3. Search for the variable called browser.showQuitWarning. Change this value again to true. This will activate the “save and quit” option.

Tips:

  • To reach the required parameters, you can just type the name of these in the filter bar.
  • If you can’t find some of these variables, you just need to create them by yourself. (Right click inside the page and then select new and eventually boolean)

Sources:


Follow

Get every new post delivered to your Inbox.