TeX
목차
- 1 양면 인쇄 추천 양식
- 2 페이지 크기 조정
- 3 폰트 크기 조정
- 4 줄 간격 설정
- 5 외부 그림 첨부
- 6 공백 조절
- 7 목록
- 8 환경 설정
- 9 비머 (Beamer)
- 10 = 색인 항목 간격 조절하기
- 11 트루타입 폰트를 변환하여 TeX에서 쓰기
- 12 ~ 기호 삽입하기
- 13 구문 강조(Syntax Highlighting)
- 14 []와 {}
- 15 UML(Unified Modeling Language) 그리기
- 16 사용자 정의 명령에 밑줄(_) 사용하기
- 17 패키지 만들기
- 18 patchcmd, xpatch
- 19 글루 스트레칭
- 20 같이 보기
- 21 바깥 고리
양면 인쇄 추천 양식
\documentclass[a4paper,11pt]{article}
\usepackage[scale=0.75,twoside,bindingoffset=5mm]{geometry}
\usepackage[onehalfspacing]{setspace}
\begin{document}
blar blar...
\end{document}
페이지 크기 조정
geometry 패키지를 사용하면 손 쉽게 조정할 수 있다.
\usepackage[paperheight=11in,paperwidth=8.5in]{geometry}
폰트 크기 조정
아래로 갈수록 커진다.
- \tiny
- \scriptsize
- \footnotesize
- \small
- \normalsize
- \large
- \Large
- \LARGE
- \huge
- \Huge
줄 간격 설정
setspace 패키지를 사용한다.
\usepackage{setspace}
\setstretch{#factor} % 여기에서 factor는 줄간격 수치를 의미한다.
특이한게, factor를 지정할 때 폰트 사이즈에 따라 그 값도 달라지게 된다는 점이다.
1.5를 값으로 준다고 해도 150%인게 아니라는 것이다.
상세한 내용은 아래에 나와있다.
외부 그림 첨부
graphicx 패키지를 사용한다.
- JPEG or PDF + PDFTeX : \usepackage[pdftex]{graphicx}
- EPS + DVIPS : \usepackage{graphicx}
- JPEG or PDF + dvipdfmx : \usepackage[dvipdfm]{graphicx}
다단에서 한쪽 열에만 넣기
- figure 번호는 자동으로 매겨짐
\begin{figure}[그림의 위치] %%% 그림의 위치로 들어갈 수 있는 값들 : t(top), b(bottom), h(here)
\begin{center}
\includegraphics[width=1.0\linewidth]{파일 경로}
\end{center}
\caption{캡션}
\label{fig:long}
\label{fig:onecol}
\end{figure}
다단에서 두 열에 걸쳐서 넣기
그림을 길쭉하게 넣고싶을 경우, 아래와 같이 작성하면 된다~
\begin{figure*} %%%
\begin{center}
\includegraphics[width=0.8\linewidth]{파일 경로}
\end{center}
\caption{캡션}
\label{fig:short}
\end{figure*} %%% Figure 9.
가로 및 세로로 여러 그림 넣기
여러 개의 그림을 가로 혹은 세로로 열거할 수도 있는데, width 값을 조절하면 자동으로 배열된다.
\begin{figure}[t] %%% 1행 2열 (즉, 가로로 2개의 그림 파일을 배열)
\centering
\subfigure[]{
\includegraphics[width=0.35\linewidth]{파일 경로}
}
\centering
\subfigure[]{
\includegraphics[width=0.35\linewidth]{파일 경로}
}
\caption{캡션}
\label{fig:long}
\label{fig:onecol}
\end{figure}
natheight, natwidth
natural height, width를 설정하는 변수로서, bounding box의 크기를 조정하는 기능이라는데... 바운딩 박스를 잘 모르겠다...
label 없애기
그림에 캡션을 달면 기본으로 딸려오는 레이블이 있다.
이걸 없애는 방법은 아래와 같다.
\usepackage[labelformat=empty]{caption}
%%% 혹은
\usepackage{caption}
\captionsetup{labelformat=empty}
공백 조절
목록
들여쓰기
- Indentation within an itemized list - TeX - LaTeX Stack Exchange
- Identing item in enumerate environment
다중 열거 목록 머릿기호 바꾸기
들여쓰기 및 간격 조절
\begin{itemize} % itemize, description, enumerate에서만 적용된다.
\setlength{\itemsep}{20pt} % 항목별 줄간격
\setlength{\parskip}{0pt} % 절(paragraphs)에서 참조하는 간격
\setlength{\parsep}{0pt} % 목록 내에서 참조하는 간격
\end{itemize}
환경 설정
비머 (Beamer)
비머 (Beamer) 는 프레젠테이션 자료를 만드는 LaTeX의 클래스다.
템플릿
템플릿을 불러오는 방법은 아래와 같다.
\usepackage{beamerthemesplit}
기본 글꼴 크기
% 기본 글꼴 크기를 11포인트로 설정하는 예
\documentclass[11pt]{beamer}
목차에 한글 표시
아래 코드를 추가하면 목차 부분이 한글로 표시된다.
\usepackage{hyperref}
\hypersetup{
unicode=true, %
}
Font shape `OT1/cmss/m/n' in size <4> not available 경고
% Font shape `OT1/cmss/m/n' in size <4> not available 오류 제거를 위한 매크로
\let\Tiny=\tiny
수식 폰트가 바뀌는 문제
% 수식 폰트를 serif로 유지
\usefonttheme[onlymath]{serif}
itemize의 스타일 변경
\setbeamertemplate{itemize item}{\color{yellow}$\blacksquare$}
\setbeamertemplate{itemize subitem}{\color{orange}$\blacktriangleright$}
- frame 안에서 적용하면 해당 프레임만 적용을 받는 것 같다. 스코프가 짧게 적용되는 명령인만큼 매크로로 정의해놓고 즉시 호출해서 변경하면 편할 듯!
글꼴 크기 변경
\documentclass{beamer}
\usepackage{lipsum}
\newcommand\Fontvi{\fontsize{6}{7.2}\selectfont}
\begin{document}
\begin{frame}
\frametitle{Frame with reduced font size}
\Fontvi
\lipsum[1]
\end{frame}
\begin{frame}
\frametitle{Frame with regular font size}
\lipsum[1]
\end{frame}
\end{document}
- \Fontvi라는 명령을 정의하는 것과, 그 내용이 포인트...
-
\fontsize{<폰트 크기>}{<\baselineskip에 대한 값>}\selectfont
템플릿 재정의
= 색인 항목 간격 조절하기
트루타입 폰트를 변환하여 TeX에서 쓰기
- Use truetype font with pdfLaTeX
- Using TrueType fonts with TeX (LaTeX) and pdfTeX (pdfLaTeX)
- 위키북스의 LaTeX/Fonts#TrueType (ttf) fonts
- [1]
- [2]
~ 기호 삽입하기
\textasciitilde{}를 넣거나, $\sim$을 넣는 방법이 일반적인 듯.
그런데...
와, 이런 대단한 사람들... 문자 하나 넣는 방법을 저렇게 창의적으로... ㅡㅡ;
구문 강조(Syntax Highlighting)
- http://stackoverflow.com/questions/1966425/source-code-highlighting-in-latex
- https://www.sharelatex.com/learn/Code_Highlighting_with_minted
- https://en.wikibooks.org/wiki/LaTeX/Source_Code_Listings
- minted 매뉴얼
- snare/gdb_lexer - A Pygments lexer for GDB output
[]와 {}
UML(Unified Modeling Language) 그리기
tikz-uml이나 pgf-umlsd, pgf-umlcd와 같은 패키지를 통해 편리하게 그릴 수 있다.
다만 패키지가 발전하는 면에서나 매뉴얼 면에서나 tikz-uml이 더 현명한 선택이 아닐까 싶다.
사용자 정의 명령에 밑줄(_) 사용하기
패키지 만들기
\makeatletter, \makeatother
\makeatletter % changes the catcode of @ to 11
<your changes here>
\makeatother % changes the catcode of @ back to 12
patchcmd, xpatch
글루 스트레칭
같이 보기