Total Pageviews

Showing posts with label Latex. Show all posts
Showing posts with label Latex. Show all posts

Thursday, 4 August 2011

Excel Graph to EPS (MS Office 2007)

Here is how I convert an excel (MS Office 2007) graph to EPS so that I can use that graph in a TEX file.

1. Open MS Excel. Copy the graph to a new sheet and be careful so that it fits in one page (you can double check if the graph fits in a page from print preview option).

2. Go to File-> Print-> Properties-> Advanced-> Postscript Option and select EPS.

3. The file will be saved as EPS so give the file an extension .eps

4. Open the GSview and open the .eps file you just saved. Go to File and select ps to eps. The file should be given an extension of .eps. This is the final eps file that you can insert in your TEX code.

From Tex to PDF

There are several ways to generate a PDF from a TEX file. I am stating the most popular 4 ways here.

Method 1

If you do not have bibliography file

% latex myfile (to generate myfile.dvi from myfile.tex)
% dvips myfile (to generate myfile.ps from myfile.dvi)
% ps2pdf myfile.ps (to generate the file myfile.pdf)

Method 2

If you have bibliography file

% latex myfile (to generate myfile.dvi from myfile.tex)
% bibtex myfile (uses the .aux file to extract cited publications from the database in the .bib file, formats them according to the indicated style, and puts the results into in a .bbl file)
% dvips myfile (to generate myfile.ps from myfile.dvi)
% ps2pdf myfile.ps (to generate the file myfile.pdf)

Method 3

If you want to convert a TEX file directly to PDF and do not have a bibliography file


% pdflatex myfile

N.B. If you have images in EPS format, you need to convert it into PDF format with the following command-

% epstopdf image.eps

Method 4

If you want to convert a TEX file directly to PDF and have a bibliography file


% pdflatex myfile
% bibtex myfile
% pdflatex myfile
% pdflatex myfile


N.B. If you have images in EPS format, you need to convert it into PDF format with the following command-

% epstopdf image.eps

Wednesday, 3 August 2011

Two Figures Side-by-Side in Latex

Many times you can come across a situation where you need to put two figures side-by-side in a paper written in latex format. Well, of course, they are two different figures: one is say Figure 1 and the other is say Figure 2. How are you going to achieve this? Well, simply the following latex code helps.



\begin{figure}[b]
\begin{minipage}[t]{0.48\linewidth}
\centering
\includegraphics[scale=0.4]{\string"Path and file name without extension\string".pdf}
\caption{Number of new connections in five chunks for six papers on Ischemia
and Glutamate}
\label{fig:figure1}
\end{minipage}
\hspace{0.5cm}
\begin{minipage}[t]{0.48\linewidth}
\centering
\includegraphics[scale=0.4]{\string"Path and file name without extension\string".pdf}
\caption{Number of dropped connections in five chunks for six papers on Ischemia
and Glutamate}
\label{fig:figure2}
\end{minipage}
\end{figure}


The thing to remember is to create minipages. One minipage serves the purpose of putting one figure. All you need to adjust here is the position of the figure (here, I chose the bottom of the page), position of the linewidth of the minipage (mine here is 0.48, yours definitely depend on the page size), and the graphics size.