Thursday, October 20, 2011

When writing my thesis i faced a problem, how to avoid displaying Appendix section from TOC, i found a coding solution in StackOverflow.com and i modified it to allow up to 3 levels.
Just add these Command after the preamble of your document and use them as following:

\newcommand{\hiddensection}[1]{
\stepcounter{section}
\subsection*{\arabic{section}\hspace{1em}{#1}}}

\newcommand{\hiddensubsection}[1]{
\stepcounter{subsection}
\subsection*{\arabic{section}.\arabic{subsection}\hspace{1em}{#1}}}


\newcommand{\hiddensubsubsection}[1]{
\stepcounter{subsubsection}
\subsection*{\arabic{section}.\arabic{subsection}
.\arabic{subsection} \hspace{1em}{#1}}}

Now you can use the new commands as following:

\hiddensection{Sectionname}
instead of \section{SectionName}

\hiddensubsection{SubSectionName}
instead of \subsection{SubSectionName}

\hiddensubsubsection{SubSubSectionName}
instead of \subsubsection{SubSubSectionName}

Monday, October 03, 2011

To allow good Appendix table of content view and writing professional documents, follow this piece of code:

Note that , appendix1 and appendix2 is a normal .tex files like any chapter files start with \chapter and contains sections

\usepackage[titletoc]{appendix}

\begin{document}  
\begin{appendices}

\include{appendix1}

\include{appendix2}
\end{appendices}

\end{document}

To allow code Listing in Latex, follow this block of code , like a professional books

\documentclass{unlthesis} 
\usepackage{color}
\usepackage{xcolor}
\usepackage{listings}
\usepackage{caption}
\DeclareCaptionFont{white}{\color{white}}
\DeclareCaptionFormat{listing}{\colorbox{gray}{\parbox{\textwidth}{#1#2#3}}}
\captionsetup[lstlisting]{format=listing,labelfont=white,textfont=white}

\begin{document}

\begin{lstlisting}[language=java,
caption=XYZ.java, label=code:XYZ_Code, frame=b,
breaklines=true, showstringspaces=false,
basicstyle=\footnotesize]

class Doing
{
public static void main(string [] args)
{
int x = 0 ;
}
}
\end{lstlisting}
\end{document}


While exploring my old data, i discovered an old source code for a game developed in 2003 by me and only me. :)

The game was Selem w Te3ban (سلم و تعبان)(Snake and Stairs), it coded by Visual Studio 2003 and C# .NET 1.1. It support up to two players and really i was talented in graphics, i made some pretty images in it. Sorry if you find any bug, i was just a new pie in programming ;)

For try and play it , follow this link.