2009年8月29日 星期六

citation overfull

作者: hantis (呢呢是豬) 看板: Hantis
標題: [隨寫] Technical Notes: citation overfull
時間: Sat Aug 29 13:28:32 2009


   有的不是 cite 數字形式的 bibliographystyle 會讓 citation 太長而超出去
   用 cite 這個 package 即可解決

2009年8月15日 星期六

Theorem envirenment

作者: hantis (呢呢是豬) 看板: Hantis
標題: [隨寫] Technical Notes: theorem enviorenment
時間: Sat Aug 15 22:52:59 2009


   Example, Lemma, Exercise,...
   這些都是 theorem environment
   大部分的shell都內定讓他們用同一個counter
   所以不加設定的話會 Example 1, Lemma 2, Exercise 3, ...
   但是我們通常會希望
   Example 1, Example 2, ..., Lemma 1, Lemma 2, ...

   要獨立count的只需在preamble的地方稍作修改
   例如要讓Example獨立count則
   \newtheorem{example}[theorem]{Example}
                                          擦掉即可

   有時候我們甚至希望以章節來重設某個theorem environment的counter
   例如想要以section為單位來得到
   Exercise 1.1, Exercise 1.2, ...
   則除了跟上面一樣擦掉[theorem]之外
   在最後面加上[section]
   所以變成
   \newtheorem{exercise}{Exercise}[section]

2009年8月13日 星期四

MATLAB imread

作者: hantis (呢呢是豬) 看板: Hantis
標題: [隨寫] Technical Notes: imread
時間: Thu Aug 13 15:12:16 2009


   imread:

   可以把影像讀入MATLAB
   影像可以是jpg bmp之類的
   執行
   A = imread(file.bmp);
   即把file.bmp讀入儲存成A
   如果是單色A就是一個二維的方陣
   如果是RGB則會讀成三層方陣
   分別是R、G、B
   即 R = A(:,:,1); G = A(:,:,2); B = A(:,:,3);
   陣列的原點定在左上角
   所以例如
   image(A(1:N,1:N,:))會得到以左上角
   開始部分的影像

   image是把陣列直接map成影像的指令
   最簡單的就直接是image(A)
   如果直接放二維方陣的A進去image
   會得到只有某種顏色的圖層(似乎是藍色那層)

   要把pdf的檔案擷取黑白圖讀入MATLAB並轉成小而美的ps圖檔的步驟:
   一、開PDF擷取要的部份
   二、複製影像並貼到小畫家
   三、另存新檔並選擇「單色」
   四、讀到MATLAB後A矩陣存的不是0就是1,0即黑色;1即白色
   五、找出黑色部份:n = find(A==0);
   六、塗上黑色部份:
       Nx = size(A)*[1;0]; %這是找出影像寬度
       line(n,mod(n,Nx),'linestyle','none','marker','.', ...
           'color','k','markersize',mk)
   七、調整markersize大小:轉出ps後要再看看mk要多大,
       會依當初bmp的解析度而定,太大會毛毛的。

   如果不介意擷取轉成ps圖檔的容量大小,直接用印的即可。

2009年7月20日 星期一

fancyhdr

作者: hantis (呢呢是豬) 看板: Hantis
標題: [隨寫] Technical Notes
時間: Mon Jul 20 15:56:26 2009


   關於fancyhdr
   可以在Preamble先設定style
   例如
   \fancypagestyle{plain}{
   ...
   ...}
   如此一來只要宣告
   \pagestyle{plain}
   就會依照所設定的格式
   但是會有問題的是第一頁
   因為通常第一頁 或者說Chapter開頭第一頁
   會是內定為empty

   所以要在那一頁宣告\thispagestyle{plain}
   來強制執行該頁的page style

   第一頁有時也需要跟其他頁不一樣
   常常是某個小差別而已
   例如第一頁有\copyright
   之後沒有
   那麼可以在設定style時直接引入了\copyright
   然後在\thispagestyle{plain}之後
   把\copyright擦掉
   後面的頁就不會有了

   例如在Preamble最後打
   \fancypagestyle{plain}{
   \fancyhf{} %清除所有頁眉頁腳
   \cfoot{\copyright} %在中央頁腳放\copyright
   \fancyfoot[LE,RO]{\thepage} %奇數頁左邊,偶數頁右邊放頁碼
   }
   \pagestyle{plain} %設定所有頁面格式為剛剛設定的plain格式

   ...

   來到首頁的部份打
   \thispagestyle{plain} %強制此頁為plain格式
   \cfoot{} %把中間的頁腳擦掉 因為是在上面的宣告之後 所以會影響到這頁以後的

   此外
   [LE,RO]這種寫法必須要確定文件的print side已經設為both sides
   否則無效

2009年7月18日 星期六

PS generation + MATLAB coneplot

作者: hantis (呢呢是豬) 看板: Hantis
標題: [隨寫] Technical Notes
時間: Sat Jul 18 12:56:19 2009


   1. How to generate PS figures from PDF documents.

   打開PDF檔,圈選要的影像,右鍵列印
   選WMF2EPS Color PS L2
   頁面縮放:符合可列印區域
   下面「自動旋轉並置中」的都不要勾
   縮小圖看起來會大大的空白但沒關係
   確定之後填入路徑+檔名.ps即可

   2. MATLAB: How to use coneplot for a 2D array.

   h = coneplot(X,Y,Z,Vx,Vy,Vz,s,'nointerp');
   s是scaling factor
   再去調cone的細部調整即可
   重點是後面的'nointerp'
   Z不一定是要平的

   加了'nointerp'之後 2D array 1D array都可以用
   例如 x = 1:5; y = 1; z = 0;
   [X,Y,Z] = meshgrid(x,y,z);
   coneplot(X,Y,Z,Vx,Vy,Vz,s,'nointerp')
   也不會有問題
   當然Vx,Vy,Vz的dimension要跟X,Y,Z一樣
   此外
   x,y,z都不需要monotonically increasing

   其實加了'nointerp'
   語法就跟quiver3一樣了
   XYZ直接放vector都沒關係

2008年6月21日 星期六

Beamer文字上色

作者: hantis (小劉) 看板: Hantis
標題: Notes for beamer
時間: Sat Jun 21 00:58:21 2008


   1. 不支援subfig
   2. 似乎不能讓子方程式連續編號,否則compile會錯誤
   3. \alert{...}可以讓...變紅色(看colortheme而定)
      但是有對齊的equation左右(還有中間的等號之類的)要分開上色
      直接用\color應該也是一樣不能橫跨左右 否則會出錯
   4. 多行的equation 要對齊的東西用&&包起來 例如&=&
      這也意味著斷行後以&&開頭 則會對齊上一行的&=&
   5. equation著色只要有&&都要分開著

2008年6月2日 星期一

How to define new font size?

作者: hantis (小劉) 看板: Hantis
標題: swp notes
時間: Mon Jun  2 11:53:19 2008


   How to define new font size?

   In the preamble, type: \newfont{\newfontname}{fontname scaled X}
   newfontname is the new font name you want, such as newhuge, newlarge, ...
   fontname is the existing fontname installed, such as times, timesbd, ...
   existing fontname is written in the Tex Name, not in Windows Full name.
   One can check in the TrueTeX DVI Previewer from the Installed Font List
   to see what names should be typed. X is the scale number, such as 300.

   Example: \newfont{\whuge}{times scaled 5000}
   Then putting "\whuge" in front of "HALLO" will take effect of the newly
   defined font on the text HALLO.

   Palatino font is with normal font weight is named, pplr8r.
   Bold face Palatino is named pplb8r. These cannot be shown in the DVI
   previewer, and are not consistent with the one shown in the Installed
   Font List, where "pala, palab, etc." appear but not work. These two
   names are found from the warning when trying to use Palatino (by using
   package "mathpazo") and preview by DVI previewer. They are okay only
   when doing PDF.