Skip to main content

a silhouette of a person's head and shoulders, used as a default avatar

LaTeX useful Tips/Tricks

In my previous post I discussed a "small" but, I would say "complet" template to start your document. If you want to include also movies in your pdf documents, then this post can help you. If you need a good program for bibliographic management check this post.

Below I will post a lot of tips, tricks and useful stuff which helps me when I am using LaTeX, for details check the documentation of coresponding package name, or Google .

Customize your header and footer

\pagestyle{fancy}
\lhead{}
% \chead{}
\rhead{\leftmark}
% \lfoot{}
% \cfoot{}
% \rfoot{}

More packages

\usepackage{latexsym} % use \Box, \Join
\usepackage{setspace}
\usepackage{subfigure} % include subfigures
\usepackage{amsmath} % equation
% table of contents, list of figures
\usepackage[titles,subfigure]{tocloft} 
\usepackage{lastpage} % total page count
\usepackage{makeidx} % create index

Old Makefile which I used, you can modify it for your needs

dvi: poster.tex
    latex poster.tex
bib: 
    bibtex poster
view:
    kdvi poster.dvi
ps:
    dvips poster.dvi -o poster.ps
pdf:
    ps2pdf poster.ps poster.pdf
mp:
    psnup -9 -l -d2 poster.ps multpage.ps
a4:
    psresize -H118.9cm -W91.4cm -pa4 poster.ps a4.ps
    ps2pdf a4.ps poster_a4.pdf
.PHONY: clean
clean:
    @echo Cleaning...
    $(RM) *.log *.aux *.dvi *.bbl *.blg *~
    @echo Cleaning... done

Indexes and Glossaries

% first include the makeidx command in the preamble
\usepackage{makeidx}
\makeindex

To index something, use the command:

\index{Index Entry}

When the document has been processed through LaTeX, it will create a .idx file. You will then need to run the .idx file through the makeindex program:

makeindex filename

No file extension for the name. The program will look for the .idx file and will output a .ind file. This file is used by the command:

\printindex

Glossaries simply use the commands:

\makeglossary (used in the preamble, like the \makeindex command)
\glossary (used for the particular entries, like the \index command)

Include/Rotate/Reflect images

\includegraphics{image.png}
\includegraphics[angle=45]{image.png}
\includegraphics*[viewport=30 30 120 120]{image.png}
\includegraphics[scale=0.25]{image.png}
\includegraphics[width=5in,height=1in]{image.png}
% no explicit size for image
\includegraphics[width=0.88\hsize]{image.png}
% horizontally reflect a image
\reflectbox{\includegraphics{myimage.png}}
% strange text behaviour
\scalebox{2}{\rotatebox{60}{\reflectbox{Check this text!}}}

Complet environment with two images left-right

\begin{figure}[htbp]
\centering
\includegraphics[width=0.8\hsize]{image}\  
\includegraphics[width=0.8\hsize]{image}
\caption{image caption}
\label{fig:mylabel}
\end{figure}


:::latex
\begin{figure*}[t]
\centerline{\includegraphics[width=0.8\textwidth]{figures/image}}
\caption{Caption title. {\it Caption text.}}
\label{fig:image}
\end{figure*}

Labeling sections in the document

\section{Introduction}
\label{sec:intro}
.....
% reference to section 
\ref{sec:intro}

Adding external files to the document

\section{Introduction}
\label{sec:intro}
\input{sections/intro}

Math

\[...\] % produces an unnumbered formula
\(...\)
$...$
\begin{math} ... \end{math}

Type properties

\bf % bold
\sf % sans serif
\sc % small caps
\tt % typewriter
\tiny
\normalsize
\large
\Large
\LARGE

Lists

\begin{enumerate}
   \item First item
   \item Second item
\end{enumerate}
%
\begin{itemize}
   \item First item
   \item Second item
\end{itemize}
%
\begin{description}
   \item[first] A definition for the first item.
   \item[second] A definition for the second item.
\end{description}

Columns

\begin{tabbing}
text \= some text \  
  \> text  \= text,
   \>       \> text; \  
  \> text  \> text. \  
endif 
\end{tabbing}
%
\begin{tabular}{|l|c|c|}
   \hline
   {Row 1,Col1} & {Row1,Col2} & {Row1,Col3} \  
  \hline
   {Row 2,Col1} & {Row2,Col2} & {Row2,Col3} \  
  \cline{2-3}
   {Row 3,Col1} & {Row3,Col2} & {Row3,Col3} \  
  \hline
\end{tabular}
%
\begin{tabular}{|l|c|c|}
   \hline
   {Row 1,Col1} & {Row1,Col2} & {Row1,Col3} \  
  \hline
   {Row 2,Col1} & \multicolumn{2}{c}{Row2,Col2-3} \  
  \cline{2-3}
   {Row 3,Col1} & {Row3,Col2} & {Row3,Col3} \  
  \hline
\end{tabular}

Tables

{\protect
   \begin{table}[t]
      % Table body
      \caption{Caption title. {\it The caption text.}}
      \label{tab:schema}
   \end{table}
}
%
{\protect
   \begin{table}[t]
      \centering
      \footnotesize
      \begin{tabular}{|l|c|c|}
         \hline
         {Row 1,Col1} & {Row1,Col2} & {Row1,Col3} \  
        \hline
         {Row 2,Col1} & {Row2,Col2} & {Row2,Col3} \  
        \cline{2-3}
         {Row 3,Col1} & {Row3,Col2} & {Row3,Col3} \  
        \hline
      \end{tabular}
      \caption{Caption title. {\it The caption text.}}
      \label{tab:schema}
   \end{table}
}

References:

a silhouette of a person's head and shoulders, used as a default avatar

Starting with LaTeX/PdfTeX, a small template

Just a short template with some packages included:

\documentclass[a4paper,12pt]{article}

% let's use some nice packages
\usepackage{times}
\usepackage{amssymb}
\usepackage{amsmath}
% set all margins to 2.5 cm
\usepackage[margin=2.5cm]{geometry}
% for fancy and easy modification of header and footer
\usepackage{fancyhdr}
% include hyperlinks in pdf file
\usepackage{hyperref}
% decide if run PdfTeX or LaTeX
\ifx\pdfoutput\undefined
% we are running LaTeX, not pdflatex
\usepackage{graphicx}
\else
% we are running pdflatex, so convert .eps files to .pdf
\usepackage[pdftex]{graphicx}
\usepackage{epstopdf}
\fi

% also include colors
\usepackage{color}
% define bottom line of paper, for DRAFT option
\usepackage{prelim2e}\usepackage[none,bottom]{draftcopy}
\draftcopyName{preprint / }{1.2}
\renewcommand{\PrelimWords}{Draft%
 -- contact: user@mail.yoursite.com -- www.yoursite.com}

% define a path for your images
\graphicspath{{.},{../blog/images/},,{../../blog/images/}{../../anotherdir/}}

% define a new command
\newcommand{\mylab}[1]{\label{#1}}

\title{Your Title}
\author{Your Name}
\date{\today}

\begin{document}
% show the title, author and date
\maketitle

% article's abstract
\begin{abstract}
body of abstract
\end{abstract}

\section{Section Name}
\subsection{Subsection Name}

% include the bibliography but using bibtex
\bibliographystyle{plain}
\bibliography{bibfile1,bibfile2,bibfile3}

\end{document}

Next step is to look at this nice book. That's all. Bye!

a silhouette of a person's head and shoulders, used as a default avatar

Installing Enthought Tool Suite (ETS) on OpenSUSE 11

Today, I tried to install Enthought Tool Suite on OpenSUSE 11, with the help of my old post. For the moment there are no packages for OpenSUSE. I had to checkout their repository and build the eggs, in order to install the suite. The mentioned tutorial worked but of course that I had some minor problems. Now, the last version is ETS_3.0.3 and during the build of Enable_3.0.2 a small surprise on the screen:

` kage caller_level = caller_level + 1) File "/usr/lib64/python2.5/site-packages/numpy/distutils/misc_util.py", line 781, in _get_configuration_from_setup_py config = setup_module.configuration(*args) File "enthought/kiva/agg/setup.py", line 146, in configuration if int(gcc_version_head[2][0]) < 4: ValueError: invalid literal for int() with base 10: 'L'` 

The solution was:

vim Enable_3.0.2/enthought/kiva/agg/setup.py

comment the line 146 and 147, Run the build again and everything went smoothly.

a silhouette of a person's head and shoulders, used as a default avatar

PageRank 6 for Indonesian openSUSE Community Website

openSUSE-ID PRToday, I have a good news for Indonesian (and for all off) openSUSE community, our community website have PageRank 6 (PR 6). It would be not an important news for all of us, but it’s a good news for me because I know how difficult to get PR 6 with my personal blog 😛

Indonesian openSUSE community website built on July 23, 2007 and serve as the first place for discussion, finding tutorial and supporting openSUSE fans.

Google PageRank trend is consistent with the increase in the number of users of openSUSE (user who install openSUSE in their PC or laptop) in Indonesia and in tune with the increasing number of forums and mailing lists user. It’s also consistent with the frequency of users who accessing the page tutorial on website.

Hopefully PR 6 can be the extra spirit to continue the improvement of the openSUSE community in Indonesia. We hope to provide best support for users of openSUSE and it’s variants distro.

Our next project is increasing tutorial page and encourage the member to create their personal blog within openSUSE blogger community. We hope to see more and more openSUSE related articles, with English or Indonesian or another language.

a silhouette of a person's head and shoulders, used as a default avatar

openSUSE Board Elections : Campaign for Pascal Bleser

openSUSE Board Elections phase 1 will be finally over at 1200 UTC on 09 October 2008. I’m quite silent with the elections discussion on openSUSE mailing list (marketing, project and another mailing list) due to my job, my project in Indonesian openSUSE community and due to Happy Eid Mubarak holiday here in Indonesia, but as openSUSE lovely user, I will vote for somebody who will be stand for openSUSE board, as our (or me as openSUSE user) gateway between community and Novell.

I’m really appreciated for everyone who take the opportunity as openSUSE board candidate. It should be a great job.  All of openSUSE board candidate have technical or supporting background, active in the community and show their great effort and participation in the past.

One of openSUSE board candidate is Pascal Bleser (well known as yaloki on IRC). I have a nice discussion by IRC and by mail with him and get a good response. He is an incumbent of openSUSE board, means that he was currently openSUSE board member with AJ, Coolo, Federico and Francis.

Pascal BleserI know he has good technically background (describing zypper stuff for about 1 hour 😛 ), active on FOSDEM, good dad for his baby (look at the photos 😀 ) and don’t forget, he has been actively on merging and joining Packman repositories for openSUSE.

I don’t see any reason why I could not choose him as openSUSE member for next period. With his experience as first openSUSE board member; his technically background; his connection to another person in various open source project; and his good position to understand relation between Novell and the community, he would be the best choice for next openSUSE member.

Vote and campaign for Pascal Bleser as openSUSE Board member !

a silhouette of a person's head and shoulders, used as a default avatar

Geeko’s Scary Movie!

Poor Geeko can’t stand in front of such terrible picture and seeks shelter under Tux’s right wing.

Click on “More…” to see the picture…

Click on the picture to enlarge it. 🙂

a silhouette of a person's head and shoulders, used as a default avatar

Parralel processing in zypper

I have been on leave for a couple of days and today when I booted my laptop the openSUSE updater notified me of 4 security updates. While I was watching zypper updating the system (I prefer the command line client) I wondered if it would be possible for zypper to download and install patches/programs/etc asynchronously.  To explain better: instead of downloading a patch and then installing it, why can’t zypper download the patch and then start a process/tread to install it while it immediately starts to download the next file ? I have no knowledge of the internals of zypper or yast, so I don’t know it it even feasible, but it would decrease the time needed to patch the system.

a silhouette of a person's head and shoulders, used as a default avatar

openSUSE Buildservice: cross-build

There is some good news for you: in cooperation with Marcus Hüwe the download on demand feature is now working seamlessly with cross-build, making it a combined “super feature”.

Also, I have put together a “condensed” cross-build in OBS document in the OBS Wiki Concepts collection.

New OBS cross-build installation packages will be provided inside openSUSE:Tools:Devel soon.

Have fun.

a silhouette of a person's head and shoulders, used as a default avatar

Personal bibliographic management software

Handling references and bibliographic information is an essential part of all research. If you are writing just one article or just your diploma thesis maybe you don't need to use this kind of software because you will not have a lot of references. BUT, if you are writing A LOT of articles, reports, master/diploma/phd thesis then you definitevely will need a good software to manage your bibliographic database.

Here is how a bibliographic manager works. An author creates a document and cites his document with entries form a bibliographic database created earlier. After the author completed writing the paper he passes the document and the database through some application and the application incorporates all the references cited in the document from the database. This produces a final version of the document containing the text, graphics, etc. the author created along with the references he cited in a specific format.

I will not try here a comparison of free and non-free software available, just I would like to point some interesting links which I found when I started to use bibliographic management software. So here are the links:

I hope that the above links will be useful.

What do I prefer? I am using LaTeX for everything (presentations, posters, reports, letters, ... ) and BibTeX, so I need something which can use plain bibtex file. I am searching and download references from ISI Web of Knowledge. The naming convention for citation key (for the bib-keywords) which I am using (thanks to my supervisor for the suggestion) is the following:

  • One author: First four letters AND last two digits of publication year (Prot08)
  • Two authors: First two letters of both authors AND last two digits of publication year (TePr05)
  • Three or four authors: First letter of each author AND last two digits of publication year (TRPS07)
  • More than four authors: First four letters of first author AND last two digits of publication year
  • If a key already exists: the next entries get a small letter behind the publication year, starting with b. (RoTe07b, RoTe07c)

I've been using KBibTex and KBib for a while now since I use linux. For me it's quite useful because it has a simple, no bloat GUI that does one thing - let's you add and maintain references. The minor point here is that they are available just for linux/bsd. Now, I played in the last weeks with Jabref (it is writen in Java and it can run on every platform: bsd/linux/mac/win). I still didn't find how to use it in order to search in ISI Web of Knowledge, but I thing I will change to it anyway, to have the same software on all platforms.

That's all and good luck in managing your bibliographic database.

a silhouette of a person's head and shoulders, used as a default avatar

Animations in PDF using LaTeX

I am using LaTeX (started with LaTeX 2.09, followed by LaTeX 3e) for everything technical and scientific (reports, articles, master/diploma thesis, presentations - yes, I am preparing my presentation with it, posters, letters, ..). In the last year I changed to pdfTeX in order to obtain directly pdf file output without intermediate steps like dvi and ps, and to replace eps files from my computer with pdf files. For Windows I am using MiKTeX with TeXnicCenter which is a great editor.

Of course that I need to include animations in my presentations (for example some simulations movies). I use all the time .avi files so here are just two methods to include them in pdf.

I saw that a lot of people included as well swf, mpeg, wmv, mpg, but in my case doesn't work with the second method, avi worked in both cases. Adobe Acrobat Reader (version 8.1.0) doesn't want to play this kind of movies (file unsuported). I couldn't include gif file. So, here are the methods:

  • using "movie15" package:
    %include the package
    \usepackage{movie15}
    ....
    ....
    Click bellow to start the movie:\  
    % we can use also: mpeg wmv mpg swf
    \includemovie[poster]{5cm}{5cm}{movie.avi}
  • using "multimedia" package:
    %include the packages
    \usepackage{multimedia}
    \usepackage{hyperref}
    ....
    ....
    Click bellow to start the movie:\  
    \movie[height=5cm,width=5cm,loop]{}{movie.avi}

If you know how to include gif in pdf files and to work in Acroread on Linux, then, please let me know.