KTUG 한국 텍 사용자 그룹

Menu

KTUG :: 마당정보글 › 조건부 컴파일

DohyunKim | 2012.11.13 09:44:08 | 메뉴 건너뛰기 쓰기

배치파일이 굳이 필요치 않다.

\ifHandout
\documentclass[a4paper]{article}
\usepackage{beamerarticle, ...}
\else
\documentclass{beamer}
\usetheme{....}
\fi
\begin{document}
\begin{frame}
...
\end{frame}
\end{document}

test.tex 파일을 이와 비슷하게 만들어 두면 다음과 같이 조건을 주어 컴파일할 수 있다.

xelatex "\newif\ifHandout\Handoutfalse\input test.tex"
xelatex "\newif\ifHandout\Handouttrue \input test.tex"


한편 좀 더 효율적인 방법으로는 test.tex의 첫 줄을

\ifx\Handout y

이렇게 바꾸고 다음처럼 명령을 내리는 것이다.

xelatex "\let\Handout=y \input test.tex"
xelatex "\let\Handout=n \input test.tex"

이때 후자는 xelatex test.tex 이라고 하는 것과 동일한 결과를 보여준다.

\newif는 매크로를 세 개나 새로 만들기 때문에 아주 조금 비효율적이다.

댓글 쓰기

목록

KTUG 한국 텍 사용자 그룹