How to reset root/single_user password in Ubuntu on a Virtual Machine

November 10, 2011 3 comments

In order to access the grub menu on a virtual machine, you need to hold the shift key down for a while. You must let your virtual machine to capture your mouse before holding the shift key. Follow the steps to change your password:

1. Let your virtual Machine to capture your mouse.
2. Hold the shift key down to get the grub menu.
3. Select the recovery mode option.
4. Select drop to root shell prompt.
5. Now, change with # passwd [username] (You can also see the list of users using # nano /etc/passwd).

Categories: Uncategorized

How to span table/figure in two columns for writing paper in latex

While writing paper in latex in two columns, you might need to span table or figure in two columns. If you follow the template and use the following, then you might not get expected result.

\begin {table} …. \end {table}


\begin {figure} …. \end {figure}

To solve this problem, just use \begin{table*}   instead of  \begin {table} and \begin {figure*} instead of \begin {figure}.  And, you will find your expected result :)

Converting a Visio Image to EPS

I fought for two days to understand the way of embedding eps image in latex. You cannot convert a image directly to eps from VISIO. At first, you need to convert it to PS (Post Script format). To do that you need to add a printer which can print a visio document to ps. To do it in windows 7, go to devices and printer and select add printer.

After that, Open Microsoft Visio and click print and the following window will pop up and select the printer and don’t forget to print on file and save the file as

After that you need a software that will convert the ps file to eps and you can do it with GSview. I faced the bounding box problem while converting the file to eps. To do that when you convert to eps, follow don’t forget to check it automatic bounding box calculation.

So, now you have your eps file ready to be embedded. If you still face problem with the bounding box, then you can manually edit the bounding box by opening the file using textpad or winedit. You need to change the bounding box parameter (To do that take the mouse cursor to the top left most corner of the image to see the co-ordination (normally in pt (i.e 200,300 pt) and bottom right most corner of your image and change it accordingly).

If you want to use pdflatex then you will encounter an error saying that “EPS file not supported”. To do so, you need to add epstopdf package which will convert the eps to pdf on the fly.


But, using this package might not solve your problem. You can convert according to the following sequence to avoid the bounding box problem:

Tex>Dvi, and then Dvi>pdf


Reducing paragraph gap between items in latex

In order to remove the paragraph gap between two bullets or items in latex put the following in your document class.  First one removes gap between the numbered item and second one removes gap between the unnumbered items.

%%%%%       unnumbered item       %%%%%






%%%%%          for unnumbered item       %%%%%






You can define your items using the following way:





Some useful tips for Latex

To remove the hyphenation from the line break use the following in your document class:



To add urls in your document use the url package and include this in your document to use it:


And use  the following command to add URLs:

\url { your url}

Referring to a section, figure, subsection or table you can use  the following commands:

~\ref{your referring label}

And to refer a listing label use only \ref instead of ~\ref.

To generate a quotation in latex use this “ for left quote and use this for right quote.

For special character å use \r{a}, for ä use \”{a} and for ö use \”{o}.

Listing in Latex

In order to include code, algorithm, pseudo-code listing is very useful package. To include listing package, include this in your document class.


The following tag shows how you can place your code or algorithm in latex .

\begin{lstlisting}[float = h, caption= Title, label=label, belowcaptionskip=0.4cm]

Place your code or algorithm here.


You can even include your source code directly to your documents. For example:


To add the “List of Listings” in your documents use the following in your main.tex file.


I have got a style for listing somewhere from the internet as shown in  figure below:

To use the style add this in your document class:




basicstyle=\footnotesize\ttfamily, % Standardschrift

%numbers=left,               % Ort der Zeilennummern

numberstyle=\tiny,          % Stil der Zeilennummern

%stepnumber=2,               % Abstand zwischen den Zeilennummern

numbersep=5pt,              % Abstand der Nummern zum Text

tabsize=2,                  % Groesse von Tabs

extendedchars=true,         %

breaklines=true,            % Zeilen werden Umgebrochen



%        keywordstyle=[1]\textbf,    % Stil der Keywords

%        keywordstyle=[2]\textbf,    %

%        keywordstyle=[3]\textbf,    %

%        keywordstyle=[4]\textbf,   \sqrt{\sqrt{}} %

stringstyle=\color{white}\ttfamily, % Farbe der String

showspaces=false,           % Leerzeichen anzeigen ?

showtabs=false,             % Tabs anzeigen ?






showstringspaces=false      % Leerzeichen in Strings anzeigen ?


Subfigures in Latex

It took me so long to identify how to include subfigures. I have used the subfig package for this. Include the following in your document class to use subfigures.


To define subfigures use the following steps to configure it.

%%% %%             Starts of a table                      %%% %%


%%% %%           Center alignment                       %%% %%


%%% %%           starting first subfigure and a line break after the first figure. Starts with \subfloat tag  and command shown below                         %%% %%

\subfloat[Title] {{\label{subfig:lable_name}}\includegraphics[width=0.6\textwidth]{pic location}

} \linebreak

%%% %%           starting second subfigure and a line break           %%% %%

\subfloat[Title] {{\label{subfig:lable_name}}\includegraphics[width=0.6\textwidth]{pic location}

} \linebreak


\subfloat[Title] {{\label{subfig:lable_name}}\includegraphics[width=0.6\textwidth]{pic location}

} \linebreak

%%% %%          Caption of all the images     %%%%%

\caption{(a)Title 1; (b) Title 2; and (c) Title 3}

%%% %%         End of Figure tag    %%%%%


Image below shows an example of subfigures in latex:

Categories: Latex Tags: , ,

Get every new post delivered to your Inbox.