'Latex'에 해당되는 글 5건

  1. 2012.01.31 레이텍 목차의 스타일 조정 latex toc style 2
  2. 2012.01.30 xetex에서 숫자 영문 폰트까지 모두 바꾸기
  3. 2011.05.26 Reference sheet for natbib usage
  4. 2011.05.26 Latex on OSX 에서 맑은 고딕 쓰기 1
  5. 2011.04.14 Beamer with beutiful equations

레이텍 목차의 스타일 조정 latex toc style

Latex 2012. 1. 31. 10:32

latex으로 한글 문서를 작성할 때 차례(목차) 부분에 '제 1 장' 같은 식으로 2자이상이 되면

이 부분과 그 장의 제목부분이 겹쳐지게 된다.

이 때 toc(table of content)의 세부 스타일 조정이 필요하다.

toc의 세부 스타일 조정은 두 가지 방법으로 할 수 있다.

1. \@dottedtocline 을 정의하기

\renewcommand*\l@chapter[2]{%
    \ifnum \c@tocdepth > \m@ne
        \addpenalty{-\@highpenalty}%
        \vskip 1.0em \@plus\p@
        \if@isKorean                     % <-- 변경 부분
            \setlength\@tempdima{5.0em} % korean  옵션일 때는 5.0em
        \else
            \setlength\@tempdima{1.5em} % english 옵션일 때는 1.5em
        \fi
        \begingroup
            \parindent \z@ \rightskip \@pnumwidth
            \parfillskip -\@pnumwidth
            \leavevmode \HUGE \bfseries
            \advance\leftskip\@tempdima
            \hskip -\leftskip
            #1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
            \penalty\@highpenalty
        \endgroup
    \fi}
    
\def\l@section{\@dottedtocline{0}{0em}{4em}}
\def\l@subsection{\@dottedtocline{1}{1em}{1.5em}}
\def\l@subsubsection{\@dottedtocline{2}{2em}{2em}}

2. 'tocloft' 패키지 이용하기

\renewcommand\cftsectionindent{1.0em}
\renewcommand\cftsectionnumwidth{4em}
\renewcommand\cftsubsectionindent{2.5em}
\renewcommand\cftsubsectionnumwidth{1.2em}
\renewcommand\cftsubsubsectionindent{3em}
\renewcommand\cftsubsubsectionnumwidth{1.5em}

\usepackage{tocloft}를 쓰면 2번이 안먹어서 삽질끝에 1번을 알아냈다.

그런데 \usepackage{tocloft}를 지우면 2번이 잘 작동한다.

2번이 깔끔하고 쉬워보인다.

:

xetex에서 숫자 영문 폰트까지 모두 바꾸기

Latex 2012. 1. 30. 15:30

원하는 한글폰트를 한글/영문/숫자 모두에 적용시키고 싶을때

\disablekoreanfonts
\setmainfont{나눔명조}
:

Reference sheet for natbib usage

카테고리 없음 2011. 5. 26. 21:18
For a more detailed description of the natbib package, LATEX the source file natbib.dtx.

Overview

The natbib package is a reimplementation of the LATEX \cite command, to work with both author-year and numerical citations. It is compatible with the standard bibliographic style files, such as plain.bst, as well as with those for harvard, apalike, chicago, astron, authordate.

Loading

Load with \usepackage[options]{natbib}. See list of options at the end.

Replacement bibliography styles

I provide three new .bst files to replace the standard LATEX numerical ones:
plainnat.bst         abbrvnat.bst         unsrtnat.bst

Basic commands

The natbib package has two basic citation commands, \citet and \citep for textual and parenthetical citations, respectively. There also exist the starred versions \citet* and \citep* that print the full author list, and not just the abbreviated one. All of these may take one or two optional arguments to add some text before and after the citation.
\citet{jon90}     -->     Jones et al. (1990)
\citet[chap. 2]{jon90}     -->     Jones et al. (1990, chap. 2)
\citep{jon90}     -->     (Jones et al., 1990)
\citep[chap. 2]{jon90}     -->     (Jones et al., 1990, chap. 2)
\citep[see][]{jon90}     -->     (see Jones et al., 1990)
\citep[see][chap. 2]{jon90}     -->     (see Jones et al., 1990, chap. 2)
\citet*{jon90}     -->     Jones, Baker, and Williams (1990)
\citep*{jon90}     -->     (Jones, Baker, and Williams, 1990)

Multiple citations

Multiple citations may be made by including more than one citation key in the \cite command argument.
\citet{jon90,jam91}     -->     Jones et al. (1990); James et al. (1991)
\citep{jon90,jam91}     -->     (Jones et al., 1990; James et al. 1991)
\citep{jon90,jon91}     -->     (Jones et al., 1990, 1991)
\citep{jon90a,jon90b}     -->     (Jones et al., 1990a,b)

Numerical mode

These examples are for author-year citation mode. In numerical mode, the results are different.
\citet{jon90}     -->     Jones et al. [21]
\citet[chap. 2]{jon90}     -->     Jones et al. [21, chap. 2]
\citep{jon90}     -->     [21]
\citep[chap. 2]{jon90}     -->     [21, chap. 2]
\citep[see][]{jon90}     -->     [see 21]
\citep[see][chap. 2]{jon90}     -->     [see 21, chap. 2]
\citep{jon90a,jon90b}     -->     [21, 32]

Suppressed parentheses

As an alternative form of citation, \citealt is the same as \citet but without parentheses. Similarly, \citealp is \citep without parentheses. Multiple references, notes, and the starred variants also exist.
\citealt{jon90}     -->     Jones et al. 1990
\citealt*{jon90}     -->     Jones, Baker, and Williams 1990
\citealp{jon90}     -->     Jones et al., 1990
\citealp*{jon90}     -->     Jones, Baker, and Williams, 1990
\citealp{jon90,jam91}     -->     Jones et al., 1990; James et al., 1991
\citealp[pg. 32]{jon90}     -->     Jones et al., 1990, pg. 32
\citetext{priv. comm.}     -->     (priv. comm.)
The \citetext command allows arbitrary text to be placed in the current citation parentheses. This may be used in combination with \citealp.

Partial citations

In author-year schemes, it is sometimes desirable to be able to refer to the authors without the year, or vice versa. This is provided with the extra commands
\citeauthor{jon90}     -->     Jones et al.
\citeauthor*{jon90}     -->     Jones, Baker, and Williams
\citeyear{jon90}     -->     1990
\citeyearpar{jon90}     -->     (1990)

Forcing upper cased names

If the first author's name contains a von part, such as ``della Robbia'', then \citet{dRob98} produces ``della Robbia (1998)'', even at the beginning of a sentence. One can force the first letter to be in upper case with the command \Citet instead. Other upper case commands also exist.
when \citet{dRob98}     -->     della Robbia (1998)
then \Citet{dRob98}     -->     Della Robbia (1998)
\Citep{dRob98}     -->     (Della Robbia, 1998)
\Citealt{dRob98}     -->     Della Robbia 1998
\Citealp{dRob98}     -->     Della Robbia, 1998
\Citeauthor{dRob98}     -->     Della Robbia
These commands also exist in starred versions for full author names.

Citation aliasing

Sometimes one wants to refer to a reference with a special designation, rather than by the authors, i.e. as Paper I, Paper II. Such aliases can be defined and used, textual and/or parenthetical with:
\defcitealias{jon90}{Paper I}
\citetalias{jon90} -> Paper I
\citepalias{jon90} -> (Paper I)
These citation commands function much like \citet and \citep: they may take multiple keys in the argument, may contain notes, and are marked as hyperlinks.

Selecting citation style and punctuation

Use the command \bibpunct with one optional and 6 mandatory arguments:
  1. the opening bracket symbol, default = (
  2. the closing bracket symbol, default = )
  3. the punctuation between multiple citations, default = ;
  4. the letter `n' for numerical style, or `s' for numerical superscript style, any other letter for author-year, default = author-year;
  5. the punctuation that comes between the author names and the year
  6. the punctuation that comes between years or numbers when common author lists are suppressed (default = ,);

The optional argument is the character preceding a post-note, default is a comma plus space. In redefining this character, one must include a space if one is wanted.

Example 1, \bibpunct{[}{]}{,}{a}{}{;} changes the output of

\citepjon90,jon91,jam92
into [Jones et al. 1990; 1991, James et al. 1992].

Example 2, \bibpunct[; ]{(}{)}{,}{a}{}{;} changes the output of

\citep[and references therein]{jon90}
into (Jones et al. 1990; and references therein).

Other formatting options

  • Redefine \bibsection to the desired sectioning command for introducing the list of references. This is normally \section* or \chapter*.
  • Define \bibpreamble to be any text that is to be printed after the heading but before the actual list of references.
  • Define \bibfont to be a font declaration, e.g. to apply to the list of references.
  • Define \citenumfont to be a font declaration or command like \itshape or \textit.
  • Redefine \bibnumfmt as a command with an argument to format the numbers in the list of references. The default definition is [#1].
  • The indentation after the first line of each reference is given by \bibhang; change this with the \setlength command.
  • The vertical spacing between references is set by \bibsep; change this with the \setlength command.

Automatic indexing of citations

If one wishes to have the citations entered in the .idx indexing file, it is only necessary to issue \citeindextrue at any point in the document. All following \cite commands, of all variations, then insert the corresponding entry to that file. With \citeindexfalse, these entries will no longer be made.

Use with chapterbib package

The natbib package is compatible with the chapterbib package which makes it possible to have several bibliographies in one document.

The package makes use of the \include command, and each \included file has its own bibliography.

The order in which the chapterbib and natbib packages are loaded is unimportant.

The chapterbib package provides an option sectionbib that puts the bibliography in a \section* instead of \chapter*, something that makes sense if there is a bibliography in each chapter. This option will not work when natbib is also loaded; instead, add the option to natbib.

Every \included file must contain its own \bibliography command where the bibliography is to appear. The database files listed as arguments to this command can be different in each file, of course. However, what is not so obvious, is that each file must also contain a \bibliographystyle command, preferably with the same style argument.

Sorting and compressing citations

Do not use the \cite package with natbib; rather use one of the options sort or sort&compress.

These also work with author-year citations, making multiple citations appear in their order in the reference list.

Long author list on first citation

Use option longnamesfirst to have first citation automatically give the full list of authors.

Suppress this for certain citations with \shortcites{key-list}, given before the first citation.

Local configuration

Any local recoding or definitions can be put in natbib.cfg which is read in after the main package file.

Options that can be added to \usepackage

  • round: (default) for round parentheses;
  • square: for square brackets;
  • curly: for curly braces;
  • angle: for angle brackets;
  • colon: (default) to separate multiple citations with colons;
  • comma: to use commas as separaters;
  • authoryear: (default) for author-year citations;
  • numbers: for numerical citations;
  • super: for superscripted numerical citations, as in Nature;
  • sort: orders multiple citations into the sequence in which they appear in the list of references;
  • sort&compress: as sort but in addition multiple numerical citations are compressed if possible (as 3-6, 15);
  • longnamesfirst: makes the first citation of any reference the equivalent of the starred variant (full author list) and subsequent citations normal (abbreviated list);
  • sectionbib: redefines \thebibliography to issue \section* instead of \chapter*; valid only for classes with a \chapter command; to be used with the chapterbib package;
  • nonamebreak: keeps all the authors' names in a citation on one line; causes overfull hboxes but helps with some hyperref problems.

About this document ...

:

Latex on OSX 에서 맑은 고딕 쓰기

OSX 2011. 5. 26. 19:26

LaTex에서 한글을 쓸 수 있도록 하는 ko.tex은 기본적으로 은글꼴을 지원한다. 그런데 만약 은글꼴 이외의 한글 폰트를 사용하고 싶을 경우 아래와 같은 방법으로 임의의 한글 트루타입 폰트로부터 tfm(Tex font metric)을 추출하고 설정을 해주면 된다.

우선 kotex이 당연히 깔려있어야 하고 다음과 같이 font.conf 라는 파일을 만든다.


FOUNDRY: b
FONTmj: m=m=malgun.ttf b=malgunbd.ttf

FOUNDRY: b의 b는 새로 생기는 폰트명의 제일 앞에 붙는다.
둘째줄의 의미는 m=malgun.ttf 라는 폰트를 bmg라는 이름으로 만들겠다는 것인데 FONTmj의 mj는 명조체를 의미하는 것으로 f=bnewname을 지정해주지 않으면 자동으로 mj가 폰트 이름이 된다. mj가 포함된 이 첫 줄은 꼭 있어야하고 폰트 이름을 mj가 아닌 다른 것으로 정하고 싶다면 f=name하고 따로 지정해주면 된다. 폰트 파일이 기본모양 뿐 아니라 볼드체 파일도 있다면 첫 줄 제일 뒤에 b=malgunbd.ttf하고 추가해준다.

그래서 이 파일과 ttf파일들을 같은 폴더에 넣고 터미널에서 다음을 입력하면,
(같은 디렉토리에 UCS2.sfd도 필요한데 Unicode.sfd를 이름바꿔서 사용하면 잘 된다)
ttf2kotexfont -c font.conf

obmj****.tfm 라는 tfm이 붙은 파일이 완전 많이 생성되고 myttf.sty, ttf2pk.cfg, ****.fd 등등의 파일이 생긴다. myttf.sty은 tex 문서 내에서 새로 만든 이 폰트들을 사용을 지정하기 위한 파일이고 ttf2pk.cfg는 (아마도) tex문서 내에서 지정한 폰트 사이즈에 맞는 ****pk파일들을 만들어내기 위한 파일, ****.fd는 새로 생긴 폰트들을 정의해주는 파일이다.

이렇게 만든 폰트를 이용하기 위해 tex문서의 앞부분에 넣어줘야 하는 명령들은 다음과 같다.

\documentclass[10pt,a4paper]{book}
\usepackage[hangul]{kotex}
\usepackage{myttf}
\SetHangulFonts{bmj}{utgt}{uttz} % 한글 기본폰트 윤명조120
\begin{document}
.............

위에서 만든 *.tfm파일들과 myttf.sty 등 새로 만들어진 파일과 이 tex문서는 같은 디렉토리 안에 있어야 하고 \SetHangulFonts에서 한글 기본폰트로 맑은고딕을 설정하였다.
\SetHangulFonts가 필요로 하는 인자는 \SetHangulFonts{명조폰트}{고딕폰트}{타자폰트}인데 이 폰트에 대해서 고딕체과 타자체에 대응하는 폰트가 따로 없으므로 그것들은 그냥 은글꼴을 사용한다는 의미에서 {utgt}{uttz}를 써준것이다.

이렇게 문서를 만들고 컴파일을 하면 ******pk 가 붙은 파일들이 또 마구마구 만들어지면서 원하는 한글 폰트가 들어간 문서가 만들어진다.


http://afnastica.tistory.com/336
를 참조했음
:

Beamer with beutiful equations

카테고리 없음 2011. 4. 14. 15:33

from

http://www.texample.net/tikz/examples/beamer-arrows/

Example: Beamer arrows

Published 2006-11-09 | Author: Kjell Magne Fauske

With PGF/TikZ version 1.09 and later, it is possible to draw paths between nodes across different pictures. This is a useful feature for presentations with the Beamer package. In this example I've combined the new PGF/TikZ's overlay feature with Beamer overlays. Download the PDF version to see the result.

Note. This only works with PDFTeX, and you have to run PDFTeX twice.

Author: Kjell Magne Fauske

Download as: [PDF] [TEX]

Beamer arrows
\documentclass{beamer} %
\usetheme{CambridgeUS}
\usepackage[latin1]{inputenc}
\usefonttheme{professionalfonts}
\usepackage{times}
\usepackage{tikz}
\usepackage{amsmath}
\usepackage{verbatim}
\usetikzlibrary{arrows,shapes}
\author{Author}
\title{Presentation title}
\begin{document}
% For every picture that defines or uses external nodes, you'll have to
% apply the 'remember picture' style. To avoid some typing, we'll apply
% the style to all pictures.
\tikzstyle{every picture}+=[remember picture]

% By default all math in TikZ nodes are set in inline mode. Change this to
% displaystyle so that we don't get small fractions.
\everymath{\displaystyle}
\begin{frame}
\frametitle{Rigid body dynamics}
\tikzstyle{na} = [baseline=-.5ex]

\begin{itemize}[<+-| alert@+>]
    \item Coriolis acceleration
        \tikz[na] \node[coordinate] (n1) {};
\end{itemize}
% Below we mix an ordinary equation with TikZ nodes. Note that we have to
% adjust the baseline of the nodes to get proper alignment with the rest of
% the equation.
\begin{equation*}
\vec{a}_p = \vec{a}_o+\frac{{}^bd^2}{dt^2}\vec{r} +
        \tikz[baseline]{
            \node[fill=blue!20,anchor=base] (t1)
            {$ 2\vec{\omega}_{ib}\times\frac{{}^bd}{dt}\vec{r}$};
        } +
        \tikz[baseline]{
            \node[fill=red!20, ellipse,anchor=base] (t2)
            {$\vec{\alpha}_{ib}\times\vec{r}$};
        } +
        \tikz[baseline]{
            \node[fill=green!20,anchor=base] (t3)
            {$\vec{\omega}_{ib}\times(\vec{\omega}_{ib}\times\vec{r})$};
        }
\end{equation*}
\begin{itemize}[<+-| alert@+>]
    \item Transversal acceleration
        \tikz[na]\node [coordinate] (n2) {};
    \item Centripetal acceleration
        \tikz[na]\node [coordinate] (n3) {};
\end{itemize}
% Now it's time to draw some edges between the global nodes. Note that we
% have to apply the 'overlay' style.
\begin{tikzpicture}[overlay]
        \path[->]<1-> (n1) edge [bend left] (t1);
        \path[->]<2-> (n2) edge [bend right] (t2);
        \path[->]<3-> (n3) edge [out=0, in=-90] (t3);
\end{tikzpicture}
\end{frame}
\end{document}
: