Friday, May 3, 2013

More on Latex

Latex Macro
Finally, when you grow tired of keep typing \left[\begin{array} \end{array}\right], here is what we can do: Latex macro. Just define a new command with a much shorter name. In future, you are done.


How to write algorithm and pseudocode in Latex ?\usepackage{algorithm},\usepackage{algorithmic}

http://www.math-linux.com/latex-26/faq/latex-faq/How-to-write-algorithm-and

Single line statements
\STATE <text>
If-statements
\IF{<condition>} <text> \ENDIF
\IF{<condition>} <text> \ELSE <text> \ENDIF
\IF{<condition>} <text> \ELSIF{<condition>} <text> \ELSE <text> \ENDIF
For-loops There are two forms
\FOR{<condition>} <text> \ENDFOR
\FORALL{<condition>} <text> \ENDFOR
While-loops
\WHILE{<condition>} <text> \ENDWHILE
Repeat until condition
\REPEAT <text> \UNTIL{<condition>}
Infinite loops
\LOOP <text> \ENDLOOP
Precondition
\REQUIRE <text>
Postcondition
\ENSURE <text>
Returning variables
\RETURN <text>
Printing variables
\PRINT <text>


IguanaTex & Beamer

http://www.technion.ac.il/~zvikabh/software/iguanatex/
IguanaTex is a power point add-in. So we can now add Latex based equation in PPT. Well, you can of course use Beamer to create a presentation completely by Latex.
Both are great.


Write computer program code in Latex

The following comments are copied from the net:

To write a code in latex, you can use \begin{verbatim} \end{verbatim} environtment. A similar approach is by doing this

\usepackage{fancyvrb}
\DefineVerbatimEnvironment{code}{Verbatim}{fontsize=\small}
\DefineVerbatimEnvironment{example}{Verbatim}{fontsize=\small}

and then you can type your code in the body

\begin{code}
c+=1;
\end{code}


It works great!

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.