Pages

Monday, October 29, 2012

Algorithm package of LaTeX

\usepackage{algorithm}% http://ctan.org/pkg/algorithms
\usepackage{algpseudocode}% http://ctan.org/pkg/algorithmicx

\subsubsection{group 1 : rename/move}
\begin{algorithm}
\caption{Euclid's algorithm}\label{euclid}
\begin{algorithmic}[1]
\Procedure{Euclid}{$a,b$}\Comment{The g.c.d. of a and b}
   \State $r\gets a\bmod b$
   \While{$r\not=0$}\Comment{We have the answer if r is 0}
      \State $a\gets b$
      \State $b\gets r$
      \State $r\gets a\bmod b$
   \EndWhile\label{euclidendwhile}
   \State \textbf{return} $b$\Comment{The gcd is b}
\EndProcedure
\end{algorithmic}
\end{algorithm}
Screen Shot 2012 10 29 at 10 02 37 PM

Algorithm2e package of LaTeX

\usepackage[ruled,vlined]{algorithm2e}

\begin{algorithm}
 \SetAlgoLined
 \KwData{this text}
 \KwResult{how to write algorithm with \LaTeX2e }
 initialization\;
 \While{not at end of this document}{
  read current\;
  \eIf{understand}{
   go to next section\;
   current section becomes this one\;
   }{
   go back to the beginning of current section\;
  }
 }
 \caption{How to write algorithms}
\end{algorithm}
Screen Shot 2012 10 29 at 10 00 07 PM

References

  1. http://www.tex.ac.uk/tex-archive/macros/latex/contrib/algorithm2e/algorithm2e.pdf
  2. Algorithms in Latex

Adding local git repository to remote server

When you have a remote repository in bitbucket, you need to push the local repository for the first time.
You can use git remote add "BRANCH", to add the branch, and then push it.
git remote add origin ssh://git@bitbucket.org/smcho/refactoringvalidatorpaper.git
git push -u origin master   # to push changes for the first time

After this, you'll find that the config file in .git has the new section.
[core]
	repositoryformatversion = 0
	filemode = true
	bare = false
	logallrefupdates = true
	ignorecase = true
[remote "origin"]
	url = ssh://git@bitbucket.org/smcho/refactoringvalidatorpaper.git
	fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
	remote = origin
	merge = refs/heads/master

Writing a paper with LaTeX

Writing a paper accompanies bibliography, and it makes the $latex:\LaTeX$ compilation process a little more complicated.
In short, one needs to three LaTeX compilation, and one bibtex compilation.
latex refvalidator.tex
bibtex refvalidator
latex refvalidator.tex
latex refvalidator.tex # resolve all the references
dvipdfmx refvalidator.dvi
You can use \cite{} for citation, and you can have the bibliography style and bibliography for correct referencing.
You don't need \section as it will be generated automatically.
\bibliographystyle{abbrv}
\bibliography{refvalidator}