아이폰블로깅

Etc 2010. 3. 13. 22:08
흐흐잘된다





iPhone 에서 작성된 글입니다.
:

LaTeX Source Code Listing

카테고리 없음 2010. 3. 10. 17:27

LaTeX Source Code Listing

LaTeX에서 소스코드를 넣어야 할때가 많았는데 그동안 fancyvrb만 쓰다가 캡션을 넣을수 없어서 http://faq.ktug.or.kr/faq/SourceCodeListing을 참고하여 하나 만들어봤습니다. 이쁘게 잘나오는군요.
float에서 나오는 형식대로 만들어봤습니다. float경우는 떠다니는 객체이기 때문에 소스코드가 1페이지 이상되면 위치를 결정하기가 힘든반면에 아래의 방식을 쓰면 원하는 위치에 넣을수 있다는 장점이 있습니다.

\newcounter{mysourcecounter}[section]
\setcounter{mysourcecounter}{1}
\makeatletter
\newcommand{\listofsources}{\@starttoc{xmp}}
\newenvironment{Source}[1]{\addcontentsline{xmp}{source}{#1}
\vskip 1em
\noindent\hrule height 1pt
\vskip 2pt
\noindent{\bf Source \thesection .\themysourcecounter} #1\stepcounter{mysourcecounter}
\vskip 2pt
\noindent\hrule height 0.4pt
\begin{list}{}{\setlength\leftmargin{0pt}}\item[]}
{\end{list}
\vskip 2pt
\noindent\hrule height 1pt
\vskip 1em}
\newcommand{\l@source}[2]{\par\noindent#1 \dotfill {\itshape #2}}
\makeatother

사용법은 \begin{Source}{캡션} 이런식입니다.
아래는 간단한 예제.. documentclass같은건 직접 지정해줘야겠죠.

\begin{document}
\fvset{fontsize=\footnotesize}
\listofsources
\newpage
\begin{Source}{Hello World!}
\begin{Verbatim}
#include <stdio.h>

int main()
{
printf("Hello, World!");
}
\end{Verbatim}
\end{Source}
\end{document}


\listofsources로 사용된 소스코드의 목록을 자동으로 만들수 있습니다.

fvset에 numbers=left를 추가하면 아래와 같이 라인넘버도 출력할 수 있습니다.

:

Bash profile

OSX 2010. 3. 9. 11:22

쉘을 써보려면 당연히 Terminal 이 필요 하다.


Terminal 은 위의 스샷과 같이 Application-> Utility 에 존재 한다

> export
declare -x SHELL='/bin/bash'

위에서 보는 바와 같이 Mac OS X 의 default Shell은 Fedora나 Ubuntu 와 마찬가지로 Bash Shell 이다.

Bash shell 은 bashrc 라는 파일을 이용해서 Customizing 할 수 있다.

/etc/bashrc 라는 파일이 모든 유저에게 적용되는 bashrc 파일이고

Ubuntu 나 Fedora 에서는 $HOME/.bashrc 파일을 생성 ( 대부분 이미 생성되어 있다 ) 하여 유저별 Customizing 이 가능하다.

내가 이글을 쓰고 있다는 얘기는 $HOME/.bashrc 가 동작하지 않는 다는 얘기다.

.bashrc 를 불러 주는 건 .bash_profile 이다..

그래서 .bash_profile 을 찾아 보았는데 , 이것도 없다 ㅎㅎ

# .bash_profile

if [ -f ~/.bashrc]; then
        . ~/.bashrc
fi


위와 같이 .bash_profile 을 생성해주면

이제 Terminal 을 실행 실킬때 bashrc 를 실행 해주게 된다. :)
: