Thursday, November 15, 2012

Using TeXlipse to work with Latex



General

When I first time wrote my paper, I spent some hours to be familiar with Latex. My friend suggested me to look into TeXlipse and I found that it is easier for a Java programmer as me who have used Eclipse for long time. This article will show you how to setup and prepare to use TeXlipse with Eclipse. Moreover, I will show some very principle syntaxes to write on Latex.

Software

Everything I need is:

After downloading MiKTex, you install it to your system. For instance, on my computer, I install it on C:\Program Files\MiKTeX 2.9 (MIKTEX_HOME). We do not need to add any environment variables to our system.
To install TeXlipse, we could download from the Marketplaces or install it as new software (From Help menu of Eclipse).


Figure 1: Install TeXlipse from the Yoxos Marketplace.
(You should restart Eclipse after installing TeXlipse.)

Configuration

The next step is to configure Eclipse to work with TeXlipse: Builder Settings (find paths to MiKTex) and Viewer Setting (find paths to Pdf readers).

Builder Settings

We open menu Window à Preferences, expand Texlipse category and choose Builder Settings.
Here you click the Browse button to find the bin directory of MiKTex. It should be MIKTEX_HOME\miktex\bin. After that, Eclipse will map automatically programs’ paths as picture below:

Figure 2: Builder Settings

Viewer Settings

This configuration is to map a (or many) pdf reader tool with MiKTex. Click Viewer Settings of Texlipse, then remove all default viewer configurations because I do not have any tools like that. Click the new button to add Foxit Reader configuration. The viewer configuration panel will be displayed:


Figure 3: Add Forxit Reader configuration.

What we need to do is type a viewer name and browse to the installed location. We will have result after hitting the OK button:

Figure 4: Viewer Settings.
Hit OK to finish configuration step.

Demo

To easy work, we change perspectives to Latex. Click File à New à LaTeX Project:

Figure 5: Create LaTex Project

After that, we type a name for our project. The important option is output format. We change from default to pdf and build commands will be changed to pdflatex.exe (on Window). You could change templates on the list box and hit Next:

Figure 6: Choose output formats and tempaltes.

The last step for the project creation is to type names for output file and main tex file. Then, hit Finish:
Figure 7: Set output file name.

Eclipse will run and there are some logs generated on the Console view. If there is no error (suppose not if you configuration succeed), the project will have a structure as below (including a pdf file):

Figure 8: The Latex project structure on Eclipse.

Now you can happily work with Latex. Every time you change the main tex file (demo.tex) and save it, the pdf file (New paper.pdf) will be deleted and regenerated. In case you are opening the pdf file and you try to save the tex file, Eclipse will have an error. Therefore, make sure that there is no application opening your pdf file when you want to modify your tex file.

Some principle syntax of Latex

Comment

% The percent sign (%) is for comments.

Heading

\section{Big Heading}
\subsection{Small Heading}
Figure 9: Headings

Item

\begin{enumerate} % For oder by number
     \item
          Number one
     \item
          Number two
     \begin{itemize} % For order by bullets
          \item
              Bullet one
          \item
          Bullet two
     \end{itemize}
     \item
          Number three
     \begin{description} % Description keywords
          \item[Latex]
              It is great tool for writing papers.
          \item[Eclipse]
              It is powerful tool for developers.
     \end{description}
\end{enumerate}

Figure 10: Items

Some text sizes

\emph{Italic}
\textbf{Bold}
\tiny{Tiny}
\scriptsize{Scriptsize}
\footnotesize{footnotesize}
\small{small}
\normalsize{normalsize}
\large{large}
\Large{Large}
\LARGE{LARGE}
\huge{huge}
\Huge{Huge}
\textup{TextUp}
\textit{textit}
\textsl{textsl}
\textsc{textsc}
\textmd{textmd}
\textbf{textbf}

Figure 11: Text sizes

Font families

\textrm{Roman family}\\  
\rmfamily{Roman family}\\
\textsf {Sans serif family}  \\
\sffamily  {Sans serif family}  \\


Figure 12: Font families

References

Here you could find more Latex syntaxes: http://www.maths.tcd.ie/~dwilkins/LaTeXPrimer/

1 comment:

  1. Good tutorial, it is easy to follow. Thank you for sharing!

    ReplyDelete