doc

\documentclass{beamer}
 
\usepackage{tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{calc}
 
\begin{document}
 
\begin{frame}{A New System}
\begin{figure}[h]
\centering
\begin{tikzpicture}%[node distance=16mm]
    \tikzstyle{box1} = [rectangle, thick, text centered ,
    minimum width=15mm, minimum height=14mm,
    top color=white, bottom color=blue!30, draw=blue!40]
 
    \tikzstyle{box2} = [rectangle, thick, text centered ,
    minimum width=15mm, minimum height=14mm,
    top color=white, bottom color=red!30, draw=red!40]
 
    \tikzstyle{box3} = [rectangle, thick, text centered ,
    text width=50mm, minimum height=14mm,
    top color=white, bottom color=green!30, draw=green!40]
 
    \tikzstyle{box4} = [rectangle, thick, text centered ,
    minimum width=15mm, minimum height=14mm,
    top color=white, bottom color=cyan!30, draw=cyan!40]

    \coordinate (P1) at (0cm, 0cm);
 
    \node [box1] (B1) at (P1) {Team1}; 
    \node [box2, anchor=west] (B2) at (B1.east) {Team2};
    \node [box3, anchor=west] (B3) at (B2.east) {\begin{tabular}{c} Team3 \\ in two lines\end{tabular}};
    \node [box4, anchor=west] (B4) at (B3.east) {Team4};

\end{tikzpicture}
\end{figure}
\end{frame}
\end{document}
Comments Off on PGF Drawing with anchor

Screen Shot 2016-06-14 at 1.05.51 AM

\documentclass{article}
% for graph drawing
\usepackage{tikz}
\usetikzlibrary{shapes}
\usetikzlibrary{circuits.ee.IEC}
% for two subfigures in one figure
\usepackage{subcaption}

\begin{document}
\begin{figure}[h]
	\centering
  \begin{subfigure}[b]{.48\textwidth}
	\centering
	\begin{tikzpicture}
		[
			circuit ee IEC,
			set resistor graphic=var resistor IEC graphic,
			small circuit symbols, semithick, 
			vertex/.style = {circle, draw=blue!40, fill=blue!10},
		]
		\coordinate (P4) at (0cm,  0mm);
		\coordinate (P1) at (150: 18mm);
		\coordinate (P2) at ( 30: 18mm);
		\coordinate (P3) at (270: 18mm);

		\node [vertex] (V1) at (P1) {1};
		\node [vertex] (V2) at (P2) {2};
		\node [vertex] (V3) at (P3) {3};
		\node [vertex] (V4) at (P4) {4};

		\draw (V1) to [resistor={info={$R_{1}$}}] (V4);
		\draw (V2) to [resistor={info={$R_{2}$}}] (V4);
		\draw (V3) to [resistor={info={$R_{3}$}}] (V4);
	\end{tikzpicture}
	\caption{a $Y$-shape resistor network}
	\label{fig:y-shape}
	\end{subfigure}
	\begin{subfigure}[b]{.48\textwidth}
	\centering
	\begin{tikzpicture}
		[
			circuit ee IEC,
			set resistor graphic=var resistor IEC graphic,
			small circuit symbols, semithick, 
			vertex/.style = {circle, draw=blue!40, fill=blue!10},
		]
		\coordinate (P1) at (150: 15mm);
		\coordinate (P2) at ( 30: 15mm);
		\coordinate (P3) at (270: 15mm);

		\node [vertex] (V1) at (P1) {1};
		\node [vertex] (V2) at (P2) {2};
		\node [vertex] (V3) at (P3) {3};

		\draw (V1) to [resistor={info={$R_{12}$}}] (V2);
		\draw (V2) to [resistor={info={$R_{23}$}}] (V3);
		\draw (V3) to [resistor={info={$R_{31}$}}] (V1);
	\end{tikzpicture}
	\caption{a $\Delta$-shape resistor network}
	\label{fig:delta-shape}
	\end{subfigure}
	\caption{A $Y$-$\Delta$ transform.}
\end{figure}
\end{document}
Comments Off on Delta-Wye Transform

Screen Shot 2015-11-01 at 8.49.58 PM

\documentclass{beamer}

\usepackage{tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{calc}

\begin{document}

\begin{frame}{A New System}
\begin{figure}[h]
\centering
\begin{tikzpicture}[node distance=0.7cm]
    \tikzstyle{box1} = [rectangle, thick, text centered ,
    text width=1.5cm, minimum height=.7cm,
    top color=white, bottom color=blue!30, draw=blue!40]

    \tikzstyle{box2} = [rectangle, thick, text centered ,
    text width=1.5cm, minimum height=.7cm,
    top color=white, bottom color=red!30, draw=red!40]

    \tikzstyle{box3} = [rectangle, thick, text centered ,
    text width=1.5cm, minimum height=.7cm,
    top color=white, bottom color=green!30, draw=green!40]

    \tikzstyle{box4} = [rectangle, thick, text centered ,
    text width=1.5cm, minimum height=.7cm,
    top color=white, bottom color=cyan!30, draw=cyan!40]

    \coordinate (A) at (-3cm, 0cm);
    \coordinate (B) at ( 0cm, 0cm);
    \coordinate (C) at ( 3cm, 0cm);

    \node [box1] (A1) at (A) {Team1}; 
    \node [box1] (B1) at (B) {Team4};
    \node [box1] (C1) at (C) {Team8};

    \node [box2] (A2) [below of=A1] {Team2};
    \node [box2] (B2) [below of=B1] {Team5};
    \node [box2] (C2) [below of=C1] {Team9};

    \node [box3] (A3) [below of=A2] {Team3};
    \node [box3] (B3) [below of=B2] {Team6};
    \node [box3] (C3) [below of=C2] {Team10};

    \node [box4] (B4) [below of=B3] {Team7};
    
    \node [above of=A1] {A};
    \node [above of=B1] {B};
    \node [above of=C1] {C};
\end{tikzpicture}
\end{figure}

\begin{figure}
\begin{tikzpicture}[node distance=1.8cm]
    \tikzstyle{box1} = [rectangle, thick, text centered ,
    text width=1cm, minimum height=.7cm, rounded corners,
    top color=white, bottom color=blue!30, draw=blue!40]

    \tikzstyle{line} = [thick, draw=black]

    \coordinate (O) at (0cm, 0cm);

    \node [box1] (A1) at (O) {\small A1};
    \node [box1] (B1) [right of=A1] {\small B1};
    \node [box1] (C1) [right of=B1] {\small C1};
    \node [box1] (W1) [right of=C1] {\small W1};
    \node [box1] (W2) [right of=W1] {\small W2};

    \path [line] (A1.north) |- ++(18mm, 5mm) coordinate [pos=.75] (m-1-2) -| (B1.north);

    \path [line] (W1.north) |- ++(10mm, 5mm) coordinate (m-4-5) -| (W2.north);

    \path [line] (C1.north) |- ++(15mm, 10mm) coordinate (m-3-4) -| (m-4-5);

    \path [line] (m-1-2) |- ++(20mm, 10mm) coordinate (m-final) -| (m-3-4);

    \node [below] at (m-1-2) {\small Game 1};
    \node [below] at (m-3-4) {\small Game 2};
    \node [below] at (m-4-5) {\small Game 3};
    \node [above] at (m-final) {\small Korean Series};
\end{tikzpicture}
\end{figure}
\end{frame}
\end{document}
Comments Off on Baseball Elimination Figure

Screen Shot 2015-11-01 at 8.41.20 PM

%\documentclass{standalone}
\documentclass{article}
\usepackage{booktabs}
\newcommand{\ramuno}{\ensuremath{\iota}}

\begin{document}
\begin{table}[h]
  \centering
  \begin{tabular}{l|llll}
    \toprule
    \multicolumn{1}{c|}{order} &
    \multicolumn{1}{c}{$+1$} &
    \multicolumn{1}{c}{$-1$} &
    \multicolumn{1}{c}{$+\ramuno$} &
    \multicolumn{1}{c}{$-\ramuno$} \\
    \midrule
    $4m$   & $m+1$ & $m$   & $m$   & $m-1$ \\
    $4m+1$ & $m+1$ & $m$   & $m$   & $m$   \\
    $4m+2$ & $m+1$ & $m+1$ & $m$   & $m$   \\
    $4m+3$ & $m+1$ & $m+1$ & $m+1$ & $m$   \\
    \bottomrule
  \end{tabular}
\end{table}
\end{document}
Comments Off on Booktabs + Multicolumn

doc

\documentclass{article}

\usepackage[papersize={5.2in, 1.6in}, text={5in, 1.4in}]{geometry}

% for choosing the proper font encoding
\usepackage[T1]{fontenc}
% for proper encoding
\usepackage[utf8]{inputenc}
% enhanced font Latin Modern
\usepackage{lmodern}
% multi-language support
\usepackage[english]{babel}
% for inline and display quotations.
\usepackage[autostyle]{csquotes}

\usepackage{doi}
\usepackage[ocgcolorlinks,pdfusetitle]{hyperref}
\usepackage[
  backend=biber,
  style=alphabetic,
  citestyle=alphabetic,
  backref=true]{biblatex}

%%%
\usepackage{filecontents}  
\begin{filecontents}{bib.bib}
@article{black1973,
  author = {Black, Fishcer and Scholes, Myron},
  doi = {10.1086/260062},
  journal = {Journal of political economy},
  number = 3,
  pages = {637--654},
  publisher = {UChicago Press},
  title = {The pricing of options and corporate liabilities},
  volume = 81,
  year = 1973
}
\end{filecontents}

\addbibresource{bib.bib}

\begin{document}
Lorem ipsum dolor sit amet, consectetuer adipiscing elit
\cite{black1973}.
Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis.

\printbibliography

\end{document}
Comments Off on BibLaTeX + backref + biber + doi

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 on Equation numbering in itemized list

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 on Beamer theorem numbering

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 on Math Greek Letters Boldface

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 on Divina Commedia, Inferno, Canto I, 1-9

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 on Compressed Sensing