\Ifexist*{\accessories}{accessories}{\pinput{accessories}}
- \accessories가 정의되어 있다면 그 내용이 식자된다.
- 그것이 정의되어 있지 않다면---현재 디렉토리에 accessories.tex 파일이 있다면 그것을 삽입한다.
- 그 파일이 존재하지 않는다면, 특정한 경로에서 accessories.tex 파일을 가져온다.
\newcommand\Ifexist{\@ifstar{\IfFileExist}{\IfMacroExist}}
\newcommand\IfMacroExist[2]{\ifthenelse{\isundefined{#1}}{#2}{#1}}
\newcommand\IfFileExist[3]{%
\ifthenelse{\isundefined{#1}}%
{\InputIfFileExists{#2}{}{#3}}%
{#1}}
\NewEnviron{IfExist}[1]{\IfMacroExist{#1}{\BODY} }
\NewEnviron{IfExist*}[2]{\IfFileExist{#1}{#2}{\BODY} }
\newcommand\rootpath{../../Common/}
\newcommand\setrootpath[1]{\renewcommand\rootpath{#1}}
\newcommand\langpath{}
\newcommand\setlangpath[1]{\renewcommand\langpath{\rootpath#1}}
\newcommand\pinput{\@ifstar{\rootinput}{\langinput}}
\newcommand\rootinput[1]{\input{\rootpath#1}}
\newcommand\langinput[1]{\input{\langpath#1}}