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  your_file_name.ps

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.

\usepackage{epstopdf}

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       %%%%%

\newenvironment{enumerate*}

{\begin{enumerate}%

\setlength{\itemsep}{0pt}%

\setlength{\parskip}{0pt}}%

{\end{enumerate}}

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

\newenvironment{itemize*}%

{\begin{itemize}%

\setlength{\itemsep}{0pt}%

\setlength{\parskip}{0pt}}%

{\end{itemize}}

You can define your items using the following way:

\begin{itemize*}

\item

\item

\end{itemize*}

Some useful tips for Latex

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

\hyphenpenalty=5000

\tolerance=1000

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

\usepackage{url}

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.

\usepackage{listings}

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.

\end{lstlisting}

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

\lstinputlisting{main.java}

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

\lstlistoflistings

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:

\usepackage{listings}

\usepackage{courier}

\lstset{

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=\color{red},

frame=b,

%        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 ?

xleftmargin=17pt,

framexleftmargin=17pt,

framexrightmargin=5pt,

framexbottommargin=4pt,

%backgroundcolor=\color{lightgray},

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.

\usepackage{subfig}

To define subfigures use the following steps to configure it.

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

\begin{figure}[h]

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

\centering

%%% %%           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

}\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    %%%%%

\end{figure}

Image below shows an example of subfigures in latex:

Categories: Latex Tags: , ,

Decimal point alignment in Latex

Decimal point alignment in Latex can be done in two different ways. But I prefer using dcolumn package because you will have the advantage of creating your own column type.

Include the package dcolumn and create a new column using the following command (you can add this in your document class).

\usepackage{dcolumn}

\newcolumntype{.}{D{.}{.}{-1}}

For defining table and heading you can use multicolumn as shown below:

\begin{tabular}{| c | . | . |}

\textbf{header 1} & \multicolumn{1} {|c|}{heading 2 } &  \multicolumn{1}{|c|} {Heading 3} \\

1 & 2563.05 & 2095.22 \\

…. (more data)

\end tabular

The image below illustrates the decimal point alignment in latex.

First non-technical post – Nothing Special

Just thought about writing a non-technical post but couldn’t find anything special to write. With extreme pressures and workloads, I am living a despondent life and hoping for good days to come again in life. I am going to overlook my second valentine’s day, as you know; Valentine ’s day is just another ordinary day for researchers :(.

Categories: Non-Technical
Follow

Get every new post delivered to your Inbox.