test

\documentclass[10pt]{article}

% for smallper page
\usepackage[papersize={4.2in, 1.4in}, text={4in, 1.3in}]{geometry}
% for fancy math
\usepackage{amsmath}

% rank operator
\DeclareMathOperator*{\rank}{rank}

% Matrix transpose
\newcommand{\trans}[1]{\ensuremath{{#1}^\top}}

% for extra space at the end of abbreviation
\usepackage{xspace}

% positive semi-definite
\newcommand{\psd}{\textsc{psd}\xspace}

% boldface uppercase letters for matrices
\newcommand{\Abf}{\ensuremath{\mathbf A}}
\newcommand{\Bbf}{\ensuremath{\mathbf B}}

% boldface lowercase letters for vectors
\newcommand{\xbf}{\ensuremath{\mathbf x}}

% for math blackboard font
\usepackage{amssymb}
% set of real numbers
\newcommand{\Rbb}{\ensuremath{\mathbb R}}

\usepackage{palatino}
\usepackage[sc]{mathpazo}

\begin{document}
\noindent
For any real symmetric matrcies $\Abf$ such that $\rank(\Abf_{n\times n})=r$,
the following statements are equivalent
and any one of them can serve as the definition of
\emph{positive semi-definite} (\psd) matrices.
\begin{itemize}
  \item $\trans\xbf \Abf\xbf \geq 0$ for any non-zero vector
    $\xbf\in\Rbb^{n\times 1}$.
    \hfill\refstepcounter{equation}\textup{(\theequation)}%
  \item All the $n$ eigenvalues of $\Abf$ are non-negative.
    \hfill\refstepcounter{equation}\textup{(\theequation)}%
  \item $\Abf=\trans\Bbf \Bbf$ for some $\Bbf$ with $\rank(\Bbf)=r$.
    \hfill\refstepcounter{equation}\textup{(\theequation)}%
\end{itemize}

\end{document}
Comments Off

doc

\documentclass{beamer}
\usepackage{hyperref}
\setbeamertemplate{theorems}[numbered]
\usetheme{CambridgeUS}

\begin{document}
\begin{frame}
  \frametitle{Test}
  \begin{theorem}[Fermat's Last Theorem]
    $x^n + y^n = z^n$.
    \label{thm:fermat}
  \end{theorem}
  As shown in Theorem \ref{thm:fermat}...

  \begin{example}
    Here goes an example!
  \end{example}

  \begin{theorem}
    $e^{i\pi} + 1 = 0$
  \end{theorem}

  \begin{corollary}
    Corollary!
  \end{corollary}
\end{frame}

\end{document}
Comments Off

boldface

\documentclass{minimal}
% for smallper page
\usepackage[papersize={2.6in, 1.2in}, text={2.6in, 1.2in}]{geometry}
% for fancy math
\usepackage{amsmath}

% Greek letter lowercase boldface
\newcommand{\alphabf}{\ensuremath{\boldsymbol{\alpha}}}
\newcommand{\betabf}{\ensuremath{\boldsymbol{\beta}}}
\newcommand{\gammabf}{\ensuremath{\boldsymbol{\gamma}}}
\newcommand{\deltabf}{\ensuremath{\boldsymbol{\delta}}}
\newcommand{\epsbf}{\ensuremath{\boldsymbol{\epsilon}}}
\newcommand{\epsilonbf}{\ensuremath{\boldsymbol{\epsilon}}}
\newcommand{\zetabf}{\ensuremath{\boldsymbol{\zeta}}}
\newcommand{\etabf}{\ensuremath{\boldsymbol{\eta}}}
\newcommand{\thetabf}{\ensuremath{\boldsymbol{\theta}}}
\newcommand{\iotabf}{\ensuremath{\boldsymbol{\iota}}}
\newcommand{\kappabf}{\ensuremath{\boldsymbol{\kappa}}}
\newcommand{\lambdabf}{\ensuremath{\boldsymbol{\lambda}}}
\newcommand{\mubf}{\ensuremath{\boldsymbol{\mu}}}
\newcommand{\nubf}{\ensuremath{\boldsymbol{\nu}}}
\newcommand{\xibf}{\ensuremath{\boldsymbol{\xi}}}
\newcommand{\pibf}{\ensuremath{\boldsymbol{\pi}}}
\newcommand{\rhobf}{\ensuremath{\boldsymbol{\rho}}}
\newcommand{\sigmabf}{\ensuremath{\boldsymbol{\sigma}}}
\newcommand{\taubf}{\ensuremath{\boldsymbol{\tau}}}
\newcommand{\upsilonbf}{\ensuremath{\boldsymbol{\upsilon}}}
\newcommand{\phibf}{\ensuremath{\boldsymbol{\phi}}}
\newcommand{\chibf}{\ensuremath{\boldsymbol{\chi}}}
\newcommand{\psibf}{\ensuremath{\boldsymbol{\psi}}}
\newcommand{\omegabf}{\ensuremath{\boldsymbol{\omega}}}

% Greek letter uppercase boldface
\newcommand{\Gammabf}{\ensuremath{\boldsymbol{\Gamma}}}
\newcommand{\Deltabf}{\ensuremath{\boldsymbol{\Delta}}}
\newcommand{\Thetabf}{\ensuremath{\boldsymbol{\Theta}}}
\newcommand{\Lambdabf}{\ensuremath{\boldsymbol{\Lambda}}}
\newcommand{\Xibf}{\ensuremath{\boldsymbol{\Xi}}}
\newcommand{\Pibf}{\ensuremath{\boldsymbol{\Pi}}}
\newcommand{\Sigmabf}{\ensuremath{\boldsymbol{\Sigma}}}
\newcommand{\Upsilonbf}{\ensuremath{\boldsymbol{\Upsilon}}}
\newcommand{\Phibf}{\ensuremath{\boldsymbol{\Phi}}}
\newcommand{\Psibf}{\ensuremath{\boldsymbol{\Psi}}}
\newcommand{\Omegabf}{\ensuremath{\boldsymbol{\Omega}}}

\begin{document}
\begin{equation*}
\alphabf
\betabf
\gammabf
\deltabf
\epsbf
\epsilonbf
\zetabf
\etabf
\thetabf
\iotabf
\kappabf
\lambdabf
\mubf
\nubf
\xibf
\pibf
\rhobf
\sigmabf
\taubf
\upsilonbf
\phibf
\chibf
\psibf
\omegabf
\end{equation*}

\begin{equation*}
\Gammabf
\Deltabf
\Thetabf
\Lambdabf
\Xibf
\Pibf
\Sigmabf
\Upsilonbf
\Phibf
\Psibf
\Omegabf
\end{equation*}
\end{document}
Comments Off

dante

\documentclass{article}

\usepackage[papersize={80mm, 80mm}, text={75mm, 70mm}]{geometry}

\usepackage{verse}
\newcommand{\attrib}[1]{\nopagebreak{\raggedleft\footnotesize #1\par}}

\usepackage{fontspec,xltxtra}
\newcommand{\old}[1]{%
  \fontspec[Alternate=1,Ligatures={Common,Rare}]%
  {Hoefler Text}\fontsize{12pt}{12pt}\selectfont #1}%

\begin{document}
\thispagestyle{empty}

\old
\itshape
\settowidth{\versewidth}{Ahi quanto a dir qual era \`e cosa dura}
\begin{verse}[\versewidth]
Nel mezzo del cammin di nostra vita \\
mi ritrovai per una selva oscura, \\
ch\'e la diritta via era smarrita. \\
\vspace{3mm}

Ahi quanto a dir qual era \`e cosa dura \\
esta selva selvaggia e aspra e forte \\
che nel pensier rinova la paura! \\
\vspace{3mm}

Tant'\`e amara che poco \`e pi\`u morte; \\
ma per trattar del ben ch'i' vi trovai, \\
dir\`o de l'altre cose ch'i' v'ho scorte. \\
\end{verse}
\attrib{\textit{Divina Commedia, Inferno, Canto I, 1-9}}
\attrib{Dante Alighieri}
\end{document}
Comments Off

compressed.sensing

\documentclass{standalone}

\usepackage{tikz}

\begin{document}
  \begin{tikzpicture}
    \tikzstyle{abox} = [rectangle, thick, text centered ,
    text width=3.5cm, minimum height=1cm,
    top color=white, bottom color=blue!30, draw=blue!40]
    \tikzstyle{xbox} = [rectangle, thick, text centered ,
    text width=.3cm, minimum height=3.5cm,
    top color=white, bottom color=red!30, draw=red!40]
    \tikzstyle{bbox} = [rectangle, thick, text centered ,
    text width=.3cm, minimum height=1cm,
    top color=white, bottom color=green!30, draw=green!40]
    
    \coordinate (A) at (0cm, 0cm);
    \coordinate (X) at (3cm, 0cm);
    \coordinate (E) at (4cm, 0cm);
    \coordinate (B) at (5.2cm, 0cm);

    % measurement
    \node [abox] (ABox) at (A) {$\mathbf{A}$};
    \node [left]  at (ABox.west)  {$\scriptstyle m$};
    \node [below] at (ABox.south) {$\scriptstyle n$};
    \node [yshift=-2.5cm] at (A) {measurement};

    % input
    \node [xbox] (XBox) at (X) {$\mathbf{x}$};
    \node [left]  at (XBox.west)  {$\scriptstyle n$};
    \node [below] at (XBox.south) {$\scriptstyle 1$};
    \node [yshift=-2.5cm] at (X) {input};

    % equal
    \node at (E) {=};

    % observation
    \node [bbox] (BBox) at (B) {$\mathbf{b}$};
    \node [left]  at (BBox.west)  {$\scriptstyle m$};
    \node [below] at (BBox.south) {$\scriptstyle 1$};
    \node [yshift=-2.5cm] at (B) {observation};
  \end{tikzpicture}
\end{document}
Comments Off

matrix

\documentclass[12pt]{article}

\usepackage[papersize={35mm, 45mm}, text={30mm, 40mm}]{geometry}
\usepackage{concrete}
\usepackage{amsmath}

\DeclareMathOperator*{\AAbf}{\ensuremath{\mathbf{A}}}
\DeclareMathOperator*{\xxbf}{\ensuremath{\mathbf{x}}}
\DeclareMathOperator*{\bbbf}{\ensuremath{\mathbf{b}}}

\begin{document}
\begin{equation*}
\AAbf_{\scriptscriptstyle m\times n} \medspace
\xxbf_{\scriptscriptstyle n\times 1} =
\bbbf_{\scriptscriptstyle m\times 1}
\end{equation*}

\begin{equation*}
\AAbf_{m\times n} \medspace
\xxbf_{n\times 1} =
\bbbf_{m\times 1}
\end{equation*}

\end{document}
Comments Off

Sometimes, we want to see disk usage in a human readable form (KB, MB, GB) for each subdirectory.

[ytyoun@ladon: ~]# find . -maxdepth 1 -type d -exec du -sh {} \; | sort -h
4.0K	./nsmail
8.0K	./Downloads
8.0K	./.eggcups
8.0K	./.gnome2_private
8.0K	./.gvfs

...

120M	./.mozilla
186M	./emacs-24.2
223M	./.cache
240M	./Desktop
284M	./Work
444M	./.config
1.9G	.

How it works.

  1. find: a linux command to search for files or directories in a directory hierarchy.
  2. find .: runs the find command on the current directory
  3. find . -maxdepth 1 -type d: searches for all the directories contained in the current directory without descending to subdirectories below the current directory
  4. find (condition) -exec (command) {} \;: for each file or directory satisfied by the (condition), run (command).
    {} \; is replaced by each directory satisfied by the find command.
  5. du -sh (dir): displays the disk usage statistics of the directory (dir) in a human readable form.
    In this example, we just feed {} \; as we want to run du command for each directory obtained by the find command.
  6. | : linux pipe
  7. sort -h: sorts the human readable numbers such as KB, MB and GB.
Comments Off

1. Make sure you have Haskell module loaded.

[yuy121@cyberstar231: ~]# module list
Currently Loaded Modulefiles:
  1) realvnc/4.5r21561   6) matlab/R2012a      11) emacs/23.2
  2) java/1.6.0_45       7) mkl/10.3.10.319    12) git/1.7.3.1
  3) intel/11.1.073      8) netcdf/gcc/4.1.1   13) gcc/4.7.0
  4) pgi/10.9            9) python/2.7.3       14) haskell/4.0.0
  5) gstreamer/0.10.32  10) latex/051112

2. update cabal

[yuy121@cyberstar231: ~]# cabal update
Config file path source is default config file.
Config file /gpfs/home/yuy121/.cabal/config not found.
Writing default configuration to /gpfs/home/yuy121/.cabal/config
Downloading the latest package list from hackage.haskell.org
Note: there is a new version of cabal-install available.
To upgrade, run: cabal install cabal-install

Note that all the cabal-related files are stored in ~/.cabal

3. cabal reinstall

[yuy121@cyberstar231: ~]# cabal install cabal-install
Resolving dependencies...
Downloading Cabal-1.16.0.3...
[ 1 of 65] Compiling Distribution.Compat.Exception ( /tmp/Cabal-1.16.0.3-10477/Cabal-1.16.0.3/Distribution/Compat/Exception.hs, /tmp/Cabal-1.16.0.3-10477/Cabal-1.16.0.3/dist/setup/Distribution/Compat/Exception.o )
[ 2 of 65] Compiling Distribution.Compat.TempFile ( /tmp/Cabal-1.16.0.3-10477/Cabal-1.16.0.3/Distribution/Compat/TempFile.hs, /tmp/Cabal-1.16.0.3-10477/Cabal-1.16.0.3/dist/setup/Distribution/Compat/TempFile.o )


...

[64 of 65] Compiling Distribution.Client.Install ( Distribution/Client/Install.hs, dist/build/cabal/cabal-tmp/Distribution/Client/Install.o )
[65 of 65] Compiling Main             ( Main.hs, dist/build/cabal/cabal-tmp/Main.o )
Linking dist/build/cabal/cabal ...
Installing executable(s) in /gpfs/home/yuy121/.cabal/bin

4. Install biosff

[yuy121@cyberstar231: ~]# cabal install biosff
Resolving dependencies...
Downloading cmdargs-0.10.3...
Configuring cmdargs-0.10.3...
Building cmdargs-0.10.3...
Preprocessing library cmdargs-0.10.3...
[ 1 of 25] Compiling System.Console.CmdArgs.Implicit.Ann ( System/Console/CmdArgs/Implicit/Ann.hs, dist/build/System/Console/CmdArgs/Implicit/Ann.o )

...

[8 of 8] Compiling Main             ( src/Flower/Main.hs, dist/build/flower/flower-tmp/Main.o )
Linking dist/build/flower/flower ...
Installing library in /gpfs/home/yuy121/.cabal/lib/biosff-0.3.3/ghc-7.4.2
Installing executable(s) in /gpfs/home/yuy121/.cabal/bin
Registering biosff-0.3.3...

5. Check flower

[yuy121@cyberstar231: ~]# ~/.cabal/bin/flower 
flower: Please provide an input file - or use --help for more information.
Comments Off

# main document
#SRC=doc
SRC=temp
# latex compilier
LATEX=pdflatex
# bibliography generator
BIBTEX=bibtex
# pdf viewer
PDFVIEW=evince

COLOR="\\033[32m"
NORMAL_COLOR="\\033[0m"

OPT="-e"

UNAME := $(shell uname)

ifeq ($(UNAME), Darwin)
PDFVIEW=open
LATEX=xelatex
OPT=""
endif

pdf:$(SRC).pdf
@echo $(OPT) "$(COLOR)===> Viewing PDF… $(NORMAL_COLOR)"
$(PDFVIEW) $(SRC).pdf &

$(SRC).pdf:$(SRC).tex $(SRC).bbl
@echo $(OPT) "$(COLOR)===> Running LaTeX… $(NORMAL_COLOR)"
$(LATEX) $(SRC)
@echo $(OPT) "$(COLOR)===> Running LaTeX once more… $(NORMAL_COLOR)"
$(LATEX) $(SRC)

$(SRC).bbl:$(SRC).aux $(SRC).tex
@echo $(OPT) "$(COLOR)===> Running BibTeX… $(NORMAL_COLOR)"
$(BIBTEX) $(SRC)

$(SRC).aux:$(SRC).tex
@echo $(OPT) "$(COLOR)===> Running LaTeX for BibTeX… $(NORMAL_COLOR)"
$(LATEX) $(SRC)

clean:
@echo $(OPT) "$(COLOR)===> Tidy up!… $(NORMAL_COLOR)"
rm -f *~
find . -maxdepth 1 -type f -name "$(SRC).*" ! -name "$(SRC).tex" -exec rm -f {} \;
# remove AucTeX-related files.
rm -rf _region_* $(DOC).prv prv_$(DOC).log

Comments Off
C-x C-f /ssh:you@cyberstar.psu.edu:~/scratch/blah
Comments Off

Switch to our mobile site