Linux/Shell/Latex/Vim Tips


Tablolarda hucre renklendirme:
Latex'teki tablo hucresini renklendirmek icin.. anladigim kadariyla bir ara colortbl paketi \cellcolor diye bir command destekliyormus. ama simdi (yine anladigim kadariyla) yok. neyse tablodaki cell'leri su kotu yolla renklendirebiliriz:

yeni komutumuzun adi hop olsun:

..
\newcommand{\hop}[2]{%                                                      
\multicolumn{1}{>{\columncolor{#1}}c|}{#2}}  
..
..
\begin{document}
..
...
\begin{tabular}{|c|c|}
\hline
 \hop{red}{selam} & \hop{blue}{helam} \\ \hline
 \hop{red}{kelam} & \hop{blue}{haram} \\ \hline
\end{tabular}
....

seklinde yapabilirsiniz. fakat bu cok ugrastiriyor, ben tum tablomdaki Yes iceren cell'leri renklendirmek istiyorum, ama her seferinde teker keter, uzun uzun \hop{renk}{Yes} yazmak istemiyorum diyorsaniz da... Once tabloyu renksiz bir sekilde olusturursunuz:

\begin{tabular}{|c|c|}
\hline
 No & Yes & ceeee & .... \\ \hline
 Yes & No & ceeee & .... \\ \hline
\end{tabular}

seklinde, sonra da bi substitution yaparsiniz:

:s,Yes,\\hop\{blue\}\{Yes\},g

Multi-line search: 
Vim'de arama yaparken satirlarin sizi sinirlandirmamasini istiyorsaniz, yani multi-line search sonrasinda da belki substitute yapmak istiyorsaniz, size lazim olan karakter \_

Mesela, bir dosyada,  XX ile baslayip YY ile biten aralik yerine, HOBA yazmak istiyorsunuz...
:%s,XX.*\_.*YY,HOBA,g

derseniz bam diye olur. Fakat bu, ilk gordugu degil, son gordugu YY'de duracagi icin, birden fazla XX - YY 'yi atlarsiniz. Ilk gordugun YY'de dur demek icin ise sunu kullaniyoruz:

:%s,XX.*\_.\{-\}YY,HOBA,g
Spell-check:
:set spell

Biraz daha karmasik isler yapmak istiyorsaniz asagidakileri de okuyun:

Eger kendi isim listenizin spelling yaparken goz onunde bulundurulmasini  istiyorsaniz, isim listenizi (mesela) .vim/spell/en.latin1.add dosyasina  yazin:
---
    Emre
    emre/!
    printf(              (so printf is invalid, but printf( is ok)
    nextLine()
    ArrayList/=          (the /= means always match case)
    focussed/!           (the /! says treat this as a misspelling)
----

bu dosyaya her kelime eklediginizde:

:mkspell! ~/.vim/spell/en.latin1.add

komutunu cagirmaniz gerekecek, bu komut
~/.vim/spell/en.latin1.add.spl

isimli bir dosya olusturacak. Bu dosyayi her seferinde spelling icin kullanmak icin yazmaniz gereken komut ise (.vimrc'ye ekleyebilirsiniz)

:set spellfile=~/.vim/spell/en.latin1.add

NOT: Her vim komutu gibi karisik gibi gorunuyor olabilir, ama kullanin memnun kalacaksiniz :)

Bir NOT daha: Ctrl-x Ctrl-k komutlarini da otomatik tamamlama icin kullanabilirsiniz..

-emre

Kaynaklar:
http://www.linuxfromscratch.org/lfs/view/development/chapter06/vim.html
http://web.cs.swarthmore.edu/help/vim/vim7.html
http://articles.techrepublic.com.com/5100-10877_11-6121347.html
http://blog.interlinked.org/tutorials/vim_tutorial.html
http://vimdoc.sourceforge.net/htmldoc/spell.html
.bashrc:
export KODEX_HEADERs=/home/emre/kodex/include/*

.vimrc:
set complete+=k
set dictionary+=$KODEX_HEADERS
  • How to run specified applications in specified virtual desktops on startup
    • kstart command is used for such type of applications. In ~/.kde/Autostart, open a file dene.sh, make it executable chmod 700 dene.sh, write you desired applications inside the file dene.sh:
      • <>#bin/bash
        kstart --desktop 1 kontact
        kstart --desktop 2 konsole
        kstart --desktop 3 opera
        kstart --desktop 4 gnome-volume-control

  • How to convert from one file format to another using convert command (ie. from ppm to tif)
    • mkdir snapshots_tif
      cd snapshots_ppm
      for i in `ls *ppm`
      do
           l=`expr length $i - 3`
           #echo ${i:0:l}
           convert $i ../snapshots_tif/${i:0:l}tif
      done

  • How to install moslate (in order to link from one content to another in Mambo)
    • Download newest version
    • Mambots -> Site Mambots -> Legacy Mambot Includer (publish)
    • Components -> Install -> com_moslate_0.4.2.zip
    • Components -> Moslates -> Import -> samples_export.xml
      • Overwrite Categories: Yes
        Overwrite Moslates: Yes
        Overwrite Files:  Yes
    • Components -> Moslates -> Manage Moslates
      • Only publish linkcontent, unpublish others
    • Some corrections in components/com_moslate/moslate.class.php
      • Comment line 1065 and 1067:
      • Replace == with = in line 1108
      • Replace startpos with startPos
  • Usage of linkcontent:
    {moslate}
    {linkcontent title_alias=Research}Link Text{/linkcontent}
    {/moslate}
    {moslate}
    {linkcontent id=30}Link Text{/linkcontent}
    {/moslate}

  • Various commands in vi
    • for substitution of all words starting with A:
      • 100,200s,A\(.*\),sub A\1 sub
    • for substitution of wewewewe's
      • 100,200s,A\([we]*\),sub A\1 sub
  • Some latex tips and keywords
    • (from Onur Tolga Sehitoglu) instead of xdvi or xpdf, for preview, you can use evince. For reloading Ctrl-R, only loses zoom..
    • (from OTS again)For including pdf or eps files, in compilation of respectively with commands latex and pdflatex, you can use package graphics.sty. When you issue \includegraphics{hede}, it will dynamically load hede.eps for latex, and hede.pdf for pdflatex.