Thursday, September 28, 2006

rectangular emacs

Just now had the occasion to use the rectangular select/cut /paste

C-x r * where * is k for kill , y for yank(paste)

to select the rectangle you have to mark(C-space) one corner of the rectangle and then take the cursor to the opposite corner).

Monday, June 26, 2006

cross-compiler hell

cross-compiler are a pain in the ass .

kegel.com/crosstool is helpful in such cases

anyway if you ever build powerpc-eabi cross compiler and you get the error

powerpc-eabi-gcc hello.c -static
hello.c:(.text+0x24): undefined reference to `printf'
/opt/ppcsim/lib/gcc-lib/powerpc-eabi/3.2.1/libgcc.a(eabi.o): In function `__eabi':

use the -msim switch when compiling

dont ask me the logic behind it ..but I got it from
http://sources.redhat.com/ml/crossgcc/2002-09/msg00096.html
and it worked for me.

Monday, May 29, 2006

wrapped text in tables

use package tabulary for wrapped text in tables

\begin{table}
\caption{capshon}
\begin{tabulary}{\textwidth}{lL}...
\hline
\hline
A & B \\hline
A & bbbbbbbbbbbbbbbbbbb\ X & ccccccccccccccccccccc\
\hline
\end{tabulary}...
\label{label}
\end{table}


--
for some odd reason, the label has to be where it is, when i triedto move it up below the caption i ended up with more than 100 errors

install new latex package

1.Download
2. move .sty file to ..textmf/tex/latex/package-name/
3. if no .sty file .run latex on the .ins file
4. type texhash

longtable

For tables of size more than one page , use package longtable

Sunday, May 28, 2006

rar

To extract with rar with full path use the 'x' switch
else extract using 'e'

Tuesday, March 14, 2006

hyperref warnings : LaTeX

Package hyperref Warning: Token not allowed in a PDFDocEncoded string,
(hyperref) removing `\-command' on input line 46.


\texorpdfstring{LATEX text}{PDF text}



can be used to vary the text, depending on whether it is to be processed by LATEX or whether it will appear in the PDF bookmark. The above section heading could then be changed to

\subsubsection{An Example Heading\texorpdfstring{: $a^2+b^2=c^2$}{}}

In this case, the equation will be printed in the section heading within the document, but will not appear in the bookmark.

Tuesday, March 07, 2006

Reset $. at EOF

When using perl $. variables, you may need to reset $. for each new file.

for example to add #!/usr/bin/perl to each .pl in the current dir do

perl -i -lpe 'print "#!/usr/bin/perl\n" if $. ==1 ; close ARGV if eof' *.pl

Monday, March 06, 2006

mget/mput with ftp

While uploading/downloading multiple files using mput and mget in ftp, you prolly have to type 'y' for each file transfer. If you find it annoying you can toggle it off/on by the 'prompt' command.

Wednesday, November 23, 2005

Adding to table of contents ( LaTeX)

Starred versions of the sectioning commands are not added to the table of contents by default, but they can be added using:

\addcontentsline{file}{type}{text}
file
This should be the extension of the file where the contents are written. So this will be toc for the table of contents, lof for the list of figures and lot for the list of tables.

type
This is the type of object you are adding to the contents. e.g. chapter, section, figure.

text
This is the text that should go in the contents.

For example, the bibliography is generated using a starred version of the \chapter command, so it doesn't get added to the table of contents. To add it to the table of contents, you can do

\addcontentsline{toc}{chapter}{\bibname}

The counter tocdepth controls the section level depth in the table of contents.

The report class file sets tocdepth to 2, which means that only the parts, chapters, sections and subsections will be entered into the table of contents. You can use \setcounter to change the value of tocdepth. For example, to also include the subsubsections, paragraphs and subparagraphs, do:

\setocounter{tocdepth}{5}

Wednesday, September 28, 2005

perl special variables ..ARGV

just had a reason to use $ARGV in a perl one liner


ARGV The special filehandle that iterates over command-line file-filenames
names in @ARGV. Usually written as the null filehandle in the
angle operator "<>". Note that currently "ARGV" only has its
magical effect within the "<>" operator; elsewhere it is just a
plain filehandle corresponding to the last file opened by "<>".
In particular, passing "\*ARGV" as a parameter to a function
that expects a filehandle may not cause your function to
automatically read the contents of all the files in @ARGV.


more perl special variables can be found in the perlvar manpage

Wednesday, August 24, 2005

Float spanning columns in LaTeX

Use figure* and table* to produce floats which spans across both the columns in a two column article

Monday, August 08, 2005

diff/patch

copied from http://kegel.com/academy/opensource.html

Making Patches

To create a patch, you run a program called diff, and save its output to a file. For instance, if the original source tree is in directory "foobar.old", and your new sources are in directory "foobar.new", the command
diff -Naur foobar.old foobar.new > blarg.patch
will create the file 'blarg.patch' containing your changes in 'unified context diff' format.

Using Patches

To use a patch -- that is, to automatically carry out the changes described in a patch file -- you run a program called patch. For instance, if you're trying to apply the patch 'blarg.patch' to a package called foobar-0.17, you might say
cd foobar-0.17; patch -p1 < ../blarg.patch
That would merge the changes from blarg.patch into your source tree. (The -p1 tells patch to ignore the first directory in filenames in the patch; that way a patch generated against the directory foobar-0.11 will still apply properly.)

Thursday, August 04, 2005

indentations

So, you can either get rid of GNU emacs, or change it to use saner
values. To do the latter, you can stick the following in your .emacs file:

(defun linux-c-mode ()
"C mode with adjusted defaults for use with the Linux kernel."
(interactive)
(c-mode)
(c-set-style "K&R")
(setq c-basic-offset 8))

use -kr and -i8 options with indent

(stands for "K&R, 8 character indents"). 

Spacing in Math Mode (LaTeX)

n a math environment, LaTeX ignores the spaces you type and puts in the spacing that it thinks is best. LaTeX formats mathematics the way it's done in mathematics texts. If you want different spacing, LaTeX provides the following four commands for use in math mode:

1. \; - a thick space

2. \: - a medium space

3. \, - a thin space

4. \! - a negative thin space

Wednesday, July 20, 2005

calculating average using perl

perl -lan -e 'BEGIN{$sum=0;$num = 0}' -e '$sum += $F[0]; $num++; END{$avg=$sum/$num;print "avg:$avg"}' data.dat

to find the average of the first column in a file

Monday, June 20, 2005

search in Emacs [ word under the cursor]

C-s C-w , appends the rest of the word under the cursor to the search pattern.

Tuesday, June 14, 2005

\[ or $$ instead of displaymath

You can use \[ math formula \] or $$math formula$$ instead of
\begin{displaymath}
math formula
\end{display math}

this is particularlty useful if you dont want to write small formula and don't want to break the paragraph to type it.

Monday, June 13, 2005

Redirections in Bash

command > filename 2>&1
directs both standard output and standard error to the file filename

command 2>&1 > filename
directs only the standard output to file, filename because the standard error was duplicated as standard output before the standard output was redirected

Sunday, June 12, 2005

setting page ranges while printing

`lp` allows you to give the page ranges to print ,

-P page-list
Specifies which pages to print in the document. The list can contain a list of numbers and ranges (#-#) separated by commas (e.g. 1,3-5,16).