2011年10月3日 星期一

footnote reference in beamer

作者: hantis (呢呢是豬) 看板: Hantis
標題: [隨寫] Note: footnote referenece in beamer
時間: Mon Oct  3 21:12:45 2011


   如何在 Beamer 的投影片下面以footnote的形式放reference:

   1. \usepackage{bibentry}

   2. 在開始引用之前 \begin{document}之後的任何位置
      放:

       \bibliographystyle{phjcp}
       \nobibliography{mhl2}%

      phjcp這個style還挺適合的 不會把標題也給列出來 比較短
      有些style不相容 會出錯 例如apsrev4-1之類的
      mhl2是 .bib 的資料庫

   3. 別忘了在preamble裡要把\newblock給取消掉
      也就是放 \newcommand{\newblock}{}
      否則compile的時候會有個不致命的錯誤出現

   4. 在要引用的地方放 \footnote{\bibentry{...}}
      ... 即 例如 Yamakage2009, Liu2010, ...

   5. 建議放 2 的部分在某一頁內 也就是 \begin{frame} \end{frame}之間
      否則如果放在頁與頁之間會跑出多餘的空白頁

2011年9月25日 星期日

color definition and usage in latex

作者: hantis (呢呢是豬) 看板: Hantis
標題: [隨寫] Note: color
時間: Sun Sep 25 22:40:12 2011


   \usepackage{color}

   This allows easy text coloring, like: {\red This is red.}

   To define other colors, simply

   \definecolor{violet}{rgb}{1,0,1}

   and then

   {\color{violet} This text is in violet.}

2011年9月12日 星期一

top-aligning imported graphics

作者: hantis (呢呢是豬) 看板: Hantis
標題: [隨寫] Note: top-aligning imported graphics
時間: Mon Sep 12 21:58:26 2011


   要把圖靠上對齊可以用

\vtop{%
 \vskip0pt
 \hbox{%
   \includegraphics{figure}%
 }%
}

   不需要用 parbox 或 minipage 什麼的
   直接用即可

   for more details, see:

   http://www.tex.ac.uk/cgi-bin/texfaq2html?label=topgraph

2010年5月27日 星期四

verbatim in beamer

作者: hantis (呢呢是豬) 看板: Hantis
標題: [隨寫] Note: verbatim in beamer
時間: Thu May 27 10:47:12 2010


   In beamer, if one tries to use verbatim in some slide, simply

   \begin{frame} --> \begin{frame}[containsverbatim]

   Otherwise error when compiling.

2010年5月26日 星期三

\href to open a local target

作者: hantis (呢呢是豬) 看板: Hantis
標題: [隨寫] Note: \href
時間: Wed May 26 13:58:29 2010


   \href{URL}{showing text}

   URL can be http something

   and a local target as well, like D:/temp.pdf.

   The file name can be a problem.

   If the target is in the same folder, simply

   \href{temp.pdf}{Open the file.}

   somehow 點超連結之後 原來的檔會被關掉

   可以按 alt + shift + <- 以檢視前一文件

   (如此 acrobat 保持只開著一個文件)

2010年4月16日 星期五

MATLAB colormap

作者: hantis (呢呢是豬) 看板: Hantis
標題: [隨寫] Note: MATLAB colormap
時間: Fri Apr 16 09:15:47 2010


   contourf 之類的 color shading 圖
   有兩個東西會混淆: colormap, caxis

   colormap 是給定一個顏色矩陣
   讓作圖的時候依據data的值是多少來填色
   所以 hot, gray, hsv, winter, autumn, ...
   這些其實是產生顏色矩陣的函數
   例如有個顏色矩陣產生函數叫做 cmatrix
   其色調是從黑色到白色
   那麼

   colormap cmatrix

   作用等同於

   colormapt(cmatrix(128))

   cmatrix(128)所產生的東西是 [R,G,B]
   其中 R,G,B 三個 element 都是從 0 到 1 的 column matrix
   也就是 linspace(0,1,128)'

   所以想使用任意色調來著色
   只需自行產生色調矩陣
   然後放進 colormap 即可

   例如最高值是藍色 [0 0 1]
   最低值是白色 [1 1 1] 的色調
   可以用
   cmatrix = [linspace(1,0,Nc);linspace(1,0,Nc);ones(1,Nc)]';
   colormap(cmatrix)
   這樣就行了
   其中 Nc 是想要分割出來的色段數
   MATLAB內定值是 128

   至於 caxis
   是定義了 colormap 之後
   自行調整 data 中哪個數字視為 colormap 的最高值或最低值
   MATLAB內定是把 data 中的最高值
   以 colormap 的最下面一個顏色來填
   而 data 中的最低值則以第一個顏色來填
   例如上面的 cmatrix
   第一個顏色是白色 [1 1 1]
   最後一個顏色是藍色 [0 0 1]
   假如 contourf 的 Z data 是
   [1 2 3 4;
    5 6 7 8;
    9 8 7 6;
    5 4 3 2]
   那麼在 9 對應到的位置就會填上藍色
   在 1 的地方會填上白色

   假如希望3以下的都用白色來填
   7以上的都用藍色來填
   則可以
   caxis([3 7])
   也就是說
   沒下這道命令的話內定值是 caxis([1 9])
   或者說是 caxis([min(min(Z)),max(max(Z))])

2010年4月8日 星期四

amscd

作者: hantis (呢呢是豬) 看板: Hantis
標題: [隨寫] Note: amscd
時間: Thu Apr  8 11:54:55 2010


   This is an extremely useful package for communative diagrams,
   such as

      after 10 years
   A ----------------> B

   The above example can be obtained by

   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   ...
   \usepackage{amscd}
   ...

   \[
   \begin{CD}
   A @>\text{after 10 years}>> B
   \end{CD}
   \]
   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   Note that the CD environment must be inside the math mode.
   So \begin{align*}\begin{CD} XXX \end{CD}\end{align*} is ok,
   and so is $\begin{CD} XXX \end{CD}$.