\label position for figures and tables

February 17, 2010 - Leave a Response

I learned this after wasting few minutes on why auto-numbering in hyperlinks to figures and tables happened incorrectly.

The \label{} MUST always come after \caption{} of a table/figure.

The reason is that the \label command points to an entity like \caption or \section or \subsection or something similar preceding it.

So if \section{Section A} is before \label{fig:A} and \caption{Figure A} is after the \label command, using \ref{fig:A} will point to the location of \label but will show the section number associated with \section{Section A}.

On the other hand, if \caption{Figure A} is before \label{fig:A}, using \ref{fig:A} will point to the location of \label and show the figure number associated with the figure with \caption{Figure A}.

INCORRECT:

\begin{figure}[h!]
\centering
\includegraphics[width=1.0\textwidth]{phy/lplpf}
\label{fig:phy:lplpf}
\caption{LP low-pass filter I/O}
\end{figure}

CORRECT:

\begin{figure}[h!]
\centering
\includegraphics[width=1.0\textwidth]{phy/lplpf}
\caption{LP low-pass filter I/O}
\label{fig:phy:lplpf}
\end{figure}

Feel Human!

January 14, 2010 - Leave a Response

I feel good now :)

I donated for a good cause.  Like you, I also had qualms that what if I donate unknowingly to a scam, which in fact will NOT help the people in Haiti.

So I did a small research (googling).

After reading about Doctors Without Borders from many sources, I decided to donate to this organization.  What’s pitiful is that this organization already had 3 hospitals in Haiti but all all of them have become inoperable because of the earthquake; 1 fell down, 2 are too unstable and unsafe and so, got abandoned.

More Doctors Without Borders volunteers are being flown to Haiti as they are short in staff and supplies [/source].

Support Doctors Without Borders in Haiti

So there you go, click on the above pic, donate, do your good deed of the day!

Command Line Calculator for csh (C Shell)

November 3, 2009 - Leave a Response

Just add

alias calc ‘awk “BEGIN{ print \!:1 }”;’

to your .alias or whatever-your-default-shell-file-is file.

Restart the terminal.

Example usage:

  • calc 4*4

Though, it gets a bit cluttery if you want to use parenthesis.

  • calc “1000000\*\(1.45\+6.2\)\/100″

You need to put the whole expression in double quotes and use the escape character “\” for every symbol (*,/,),(,+,-) you use in the expression.

But in the end, it works! :)

Update 1:

Just add

   alias calc ‘echo "\!:*" | bc -l’

to your .alias or whatever-your-default-shell-file-is file.

Restart the terminal.

Example usage:

  • calc 4*4
  • calc 1000000*(6.2+1.45)/100
  • calc 4^4 ( calculation of powers also works using bc! )

References: 1 2