Tag Archives: Latex

Some LaTeX Tweaks…

Here are some \LaTeX tweaks I used to prepare a template for one of our lab reports recently. Most of the help was received from http://tex.stackexchange.com/.

Adding more columns to the index page than the default ‘Chapter No.- Chapter Name- Page’

\documentclass[10pt,letterpaper]{article}
\usepackage{lipsum,titletoc}

\titlecontents{section}
[0em]
{}
{}
{}
{\titlerule*[0.5em]{.}\contentspage}

\begin{document}

 \noindent\begin{minipage}[c]{0.7\textwidth}
\renewcommand{\contentsname}{\Large \centerline{CONTENTS}}
\tableofcontents

\addtocontents{toc}{\textbf{No.}\hspace{2cm}\textbf{Experiment}~\hfill\textbf{Page}\par}

\end{minipage}
%
\hspace{0.05\textwidth}
%
\begin{minipage}[c]{0.2\textwidth}
\begin{tabular}{lr}
\textbf{Date} & \textbf{Signature} \\[1em]

\end{tabular}
\vspace{3.02in}  %adjust this to align date & sign in the contents page
\end{minipage}$

Putting a Border Around Each Page

\begin{document}
\fancypage{%
\setlength{\fboxsep}{10pt}\doublebox}{}

Preventing \chapter{} from beginning on a new page

\makeatletter
 \patchcmd{\chapter}{\if@openright\cleardoublepage\else\clearpage\fi}{}{}{}
 \makeatother

\begin{document}
.......................
Tagged

LaTeX trickz

Here are some ‘fine-tuning’ stuff for LaTeX that I recently learned. Was in the process of making a report for college, which required me to do the following formatting with LaTeX:

  • Center the Chapter Headings
  • Center the ‘Table of Contents ‘ caption
  • Easily adjust the basic left, right, top and bottom margins.

Here is what i did for each of my requirement (obviously, learned from the vast knowledge base of the INTERNET 🙂 )

Center the Chapter Headings

\usepackage{titlesec}

\titleformat{\chapter}[display]

{\normalfont\huge\bfseries\centering}{\chaptertitlename\ \thechapter}{20pt}{\Huge}

Center the ‘Table of Contents ‘ caption

\renewcommand{\contentsname}{\centerline{Table of contents}}

\tableofcontents

Easily adjust the basic left, right, top and bottom margins.

\usepackage{simplemargins} %simplemargins.sty has to be copied to your local LaTeX directory or working directory
\setleftmargin{4cm}
\setrightmargin{3cm}
\settopmargin{3cm}
\setbottommargin{3cm}
Tagged , , ,

LaTeX: Survival Skills

I write this not because I’m an expert but ‘cos of my love towards this ‘LaTeX’ tool and the fact that it is very useful and efficient for students. Once you get used with this tool, creation of professional  project reports, seminar reports, abstracts, presentations etc. becomes a child’s play.

So, lets start.

Basic Requirements:
1) A Linux Distro ( I use openSUSE 11.3 which comes preloaded with LATEX, for those distros that don’t come preloaded with LATEX, you can always download and install it from the Latex website).
2) A basic text editor (like gedit,vim,nano etc.)
3) A small amount of patience

Getting Started

Create a folder “mylatex” (yeah this name can be anything). Now this will be the workplace for your Latex project. Create a text file named ‘first.tex’ (only the .tex extension is important). This is your source file.

Open the first.tex file. Lets create a basic document

Type the following into the file:

\documentclass[12pt,a4paper,oneside]{article} %this instructs instructs latex to create an article with base font size 12pt,on an A4 paper to be printed on single side.
\begin{document}
This is my first \LaTeX{} document.
\end{document}

Now save the file and exit.

Now open a terminal (Application->System->terminal in openSUSE, find it somewhere under the Applications category in other Distros). Suppose you created the ‘mylatex’ folder in your Desktop, then type the following command into your terminal:

cd ~/Desktop/mylatex //this changes directory (cd) to the mylatex directory in the Desktop directory)
latex first.tex //this creates a .dvi version of your document
dvipdf first.tex //this converts the .dvi to the .pdf version

Now lets add some sections and subsections to our document. Open the first.tex file and edit it as follows:(add the following between the \begin{document} and \end{document})

\section{This is my first section}
This is my first section.
\subsection{This is my first subsection}
This is my first subsection.
\section{This is my second section}
This is my second section
\subsection{This is my first subsection in the second section}
This is my first subsection in the second section
\subsubsection{This is my first subsubsection in the first subsection of the second section}
This is my first subsubsection in the first subsection of the second section

All the sections, subsections, subsubsections are numbered automatically (that’ s great right? It even creates a Contents page automatically with correct numbers and page numbers, wow!, now that’c cool!)

For the contents page to appear, add this line to the place where you want your Contents page to appear:

\tableofcontents

Now, your file should look like this:

\documentclass[12pt,a4paper,oneside]{article}
\begin{document}
\tableofcontents
\newpage            %self explained

This is my first \LaTeX{} document.

\section{This is my first section}
This is my first section.
\subsection{This is my first subsection}
This is my first subsection.
\section{This is my second section}
This is my second section
\subsection{This is my first subsection in the second section}
This is my first subsection in the second section
\subsubsection{This is my first subsubsection in the first subsection of the second section}
This is my first subsubsection in the first subsection of the second section
\end{document}

Run

latex first.tex

two or three time and use dvipdf as earlier

Now that I’ve given you a taste Latex, work with it, play with it and explore it. You can always google to get lotcha help on Latex. Next we’ll learn how to import graphics to our article.

Till then, take care and enjoy the power of Freedom. Power 2 u!

Tagged

LaTeX

LaTeX is a high quality typesetting system is the de facto standard for the communication and publication of scientific documents. Latex is available as free software.

I was introduced to LaTeX by a friend of mine a few months ago. Since then I was working with it & learning stuff. Initially one finds it too complex. But that is  not the case after one works with it for say, an hour. It is  very easy to work with, yet powerful.

It can be used to create documents with a high level of professionalism. The term document used here is a general tag which can include anything ranging from articles, books, reports, letters to presentations, and what not!

Mathematical typesetting feature of latex is highly rated. In fact , Latex is derived from
Tex written by Donald Knuth ( of the Art of Computer Programming fame ) and the term
literate programming (writing documentation as you go ) was coined by Knuth ( spelled as “Kanooth” ) while writing the software. Modern Documentation extractors like JavaDoc,CppDoc and NDoc owes it origin to this (excerpt from a mail from Praseed Pai http://praseedp.blogspot.com/ ).

Beamer is a Latex class that is  used to create presentations. When i say presentations, they are something that stand a class apart!

Latex documents can be fine tuned to any level, though this needs thorough knowledge of the latex commands and syntax.

There are plenty of resources available  in the WWW for a thorough self study of LaTeX.

Here are some tutorials:

LaTeX

beamer

Enjoy the power of Free Software…Power to You!


Tagged
%d bloggers like this: