> For the complete documentation index, see [llms.txt](https://overleaf-pro.ayaka.space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://overleaf-pro.ayaka.space/latex/ko/document-structure/07-management-in-a-large-project.md).

# 대규모 프로젝트에서의 관리

## 소개

책과 같은 대규모 프로젝트에서는 문서의 일부를 여러 .tex 파일로 나누어 두면 오류를 수정하고 추가 변경을 하는 일이 더 쉬워집니다. 짧은 파일에서 특정 단어나 요소를 찾기가 더 간단하기 때문입니다. 이 글에서는 이런 목적을 위해 큰 프로젝트를 관리하는 방법을 설명합니다.

## 파일 입력 및 포함

한 LaTeX 파일을 다른 파일에 삽입하는 표준 도구는 `\input` 및 `\include`.

**input 명령**

\input{filename}

문서 본문에서 이 명령을 사용하여 다음 이름의 다른 파일 내용을 삽입합니다 `filename.tex`; 이 파일에는 어떤 LaTeX 프리앰블 코드도 포함되어서는 안 됩니다(즉, `\documentclass`, `\begin{document}` 또는 `\end{document}` ). LaTeX는 `filename.tex`. `\input` 를 사용하면 중첩할 수 있습니다 `\input` 명령을, 루트 파일에 의해 이미 입력되고 있는 파일 안에서.

**include 명령**

\include{filename}

문서 본문에서 이 명령을 사용하여 다음 이름의 다른 파일 내용을 삽입합니다 `filename.tex`; 역시 이 파일에는 어떤 LaTeX 프리앰블도 포함되어서는 안 됩니다. LaTeX는 `filename.tex`. 확장자를 포함하지 않도록 주의하세요 `.tex` 파일 이름에, 그렇게 하면 파일 입력이 중단됩니다(확장자는 선택적으로 `입력` 및 `import`와 함께 포함할 수 있습니다). 중첩하는 것은 불가능합니다 `include` 입력되는 각 파일은 `\include`자체 .aux 파일을 가지며, 생성된 레이블과 목차, 그림 목록 등의 정보를 저장합니다. 다음을 사용할 수 있습니다 `\includeonly` 쉼표로 구분된 파일 이름 목록과 함께 사용합니다(앞뒤에 공백이 없도록 하세요). 이렇게 하면 LaTeX는 해당 목록에 포함된 파일만 처리합니다. 더 큰 문서의 일부만 작업하는 경우 컴파일 속도를 높이는 데 사용할 수 있습니다. 그러나 제외된 파일의 .aux 파일도 계속 처리되므로 페이지 번호와 상호 참조는 여전히 작동합니다.

[Overleaf에서 대규모 프로젝트의 예시 열기](https://www.overleaf.com/project/new/template/20618?id=70769185\&templateName=Managing+a+large+project+on+Overleaf\&latexEngine=pdflatex\&texImage=texlive-full%3A2020.1\&mainFile=)

## 별도의 파일에 있는 프리앰블

문서의 프리앰블에 사용자가 정의한 명령이나 용어집에 대한 용어 정의가 많다면 [용어집](/latex/ko/document-structure/05-glossaries.md), 이를 별도의 파일에 둘 수 있습니다. 올바른 방법은 .sty 확장자를 가진 파일인 사용자 정의 패키지를 만드는 것입니다. 예를 보겠습니다:

```latex
\ProvidesPackage{example}

\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage[latin1]{inputenc}
\usepackage[spanish, english]{babel}
\usepackage{graphicx}
\usepackage{blindtext}
\usepackage{textcomp}
\usepackage{pgfplots}

\pgfplotsset{width=10cm,compat=1.9}

%헤더 스타일
\usepackage{fancyhdr}
\setlength{\headheight}{15pt}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{#1}{}}
\fancyhf{}
\fancyhead[LE,RO]{\thepage}
\fancyhead[RE]{\textbf{\textit{\nouppercase{\leftmark}}}}
\fancyhead[LO]{\textbf{\textit{\nouppercase{\rightmark}}}}
\fancypagestyle{plain}{ %
\fancyhf{} % 모든 것을 제거
\renewcommand{\headrulewidth}{0pt} % 줄도 제거
\renewcommand{\footrulewidth}{0pt}}

%\proof, \qedsymbol 및 \theoremstyle 명령을 사용할 수 있게 함
\usepackage{amsthm}

%자
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}

%레마 정의 및 레마 번호
\newtheorem{lemma}{레마}[section]

%정의 번호
\theoremstyle{definition}
\newtheorem{definition}{정의}[section]

%따름정리 번호
\newtheorem{corolary}{따름정리}[section]

%자연수, 정수, 위상, hull, Ball, Disc, 차원, 경계 및 몇 가지 더를 위한 명령
\newcommand{\E}{{\mathcal{E}}}
\newcommand{\F}{{\mathcal{F}}}
...

%예제 환경
\theoremstyle{remark}
\newtheorem{examle}{예제}

%예제 번호
\newcommand{\reiniciar}{\setcounter{example}{0}}
```

이 파일의 모든 명령은 프리앰블에 넣을 수도 있었지만, 이렇게 많은 코드 때문에 메인 파일이 혼란스러워졌을 것이고, 그런 큰 파일에서 문서의 실제 본문을 찾는 것은 번거로운 일이었을 것입니다.

이 파일은 일반 .tex 파일에 넣어 다음 명령으로 가져올 수도 있습니다 `import` (다음을 참조하세요 [다음 섹션을 읽어 보세요](#importing-files)), 그러나 .sty 파일은 파일이 실수로 두 번 이상 가져와질 때 발생할 수 있는 오류를 방지합니다.

예제의 첫 줄은

```latex
\ProvidesPackage{example}
```

이는 이 패키지를 다음과 같이 가져와야 함을 의미합니다 *example* 메인 파일에서, 즉 다음 명령으로

```latex
\usepackage{example}
```

에서 보인 것처럼 [소개](#introduction).

*참고: .sty 파일은 훨씬 더 유연하여 자체 매크로를 정의하는 데 사용할 수 있고 선택적 매개변수를 전달할 수도 있습니다. 다음을 참조하세요* [*자신만의 패키지 작성하기*](/latex/ko/class-files/03-writing-your-own-package.md).

[Overleaf에서 대규모 프로젝트의 예시 열기](https://www.overleaf.com/project/new/template/20618?id=70769185\&templateName=Managing+a+large+project+on+Overleaf\&latexEngine=pdflatex\&texImage=texlive-full%3A2020.1\&mainFile=)

## import 패키지 사용

위에서 언급했듯이, 한 LaTeX 파일을 다른 파일에 삽입하는 표준 도구는 `\input` 및 `\include`, 그러나 중첩된 파일 가져오기가 필요하면 오류가 발생하기 쉽습니다. 이런 이유로 다음 패키지를 고려해 볼 수 있습니다 **import**.

아래는 각 장의 절과 사용자 정의 명령이 별도의 파일에 저장되어 있고, 각 장의 이미지 파일도 해당 장의 .tex 파일과 함께 별도의 폴더에 저장되어 있는 책의 예입니다.

```latex
\documentclass[a4paper,11pt]{book}
\usepackage{import}
\usepackage{example}

\usepackage{makeidx}
\makeindex

\begin{document}

\frontmatter
\import{./}{title.tex}

\clearpage
\thispagestyle{empty}

\tableofcontents

\mainmatter
\chapter{첫 번째 장}
\import{sections/}{section1-1.tex}
\import{sections/}{section1-2.tex}

\chapter{추가 장}
\import{sections/}{section2-1.tex}

\chapter{마지막 장}
\import{sections/}{section3-1.tex}

\backmatter

\import{./}{bibliography.tex}

\end{document}
```

보시다시피, 이 예제는 세 개의 장과 여러 절로 이루어진 책으로, 깔끔한 메인 파일이 외부 파일을 불러와 최종 문서를 생성합니다. 명령 `\frontmatter` 은 book 문서 클래스에서 문서의 첫 페이지들에 사용되며, 이 명령으로 페이지 번호 스타일은 로마 숫자로 설정됩니다. 명령 `\mainmatter` 은 페이지 번호를 다시 시작하고 스타일을 아라비아 숫자로 바꿉니다, `\backmatter` 은 장 번호 매기기를 비활성화합니다(참고문헌과 부록에 적합합니다).

```latex
\chapter{첫 번째 장}
\import{sections/}{section1-1.tex}
\import{sections/}{section1-2.tex}
```

먼저, 문서의 프리앰블에 다음 줄을 추가하세요:

```latex
\usepackage{import}
```

그다음 다음을 사용합니다 `\import{ }{ }`. 중괄호 안의 첫 번째 매개변수는 파일이 있는 디렉터리이며, 현재 작업 디렉터리에 상대적일 수도 있고 절대 경로일 수도 있습니다. 두 번째 매개변수는 가져올 파일의 이름입니다

다음 명령도 사용할 수 있습니다 `\subimport` 이는 동일한 구문을 가지지만, 메인 파일에 가져와진 파일들 중 하나에서 사용하면 경로는 해당 하위 파일을 기준으로 상대 경로가 됩니다. 예를 들어, 아래는 이전 예제에서 가져온 "section1-1.tex" 파일의 내용입니다:

```latex
\section{First section}

아래는 간단한 3D 플롯입니다

\begin{figure}[h]
\centering
\subimport{img/}{plot1.tex}
\caption{캡션}
\label{fig:my_label}
\end{figure}

[...]
```

보시다시피, 이 파일은 다음을 가져옵니다 [pgf 플롯](/latex/ko/field-specific/08-pgfplots-package.md) 3D 플롯을 만드는 "plot1.tex"라는 파일입니다. 이 파일은 다음에서 가져와집니다

```latex
\subimport{img/}{plot1.tex}
```

"sections" 폴더 안에 있는 "img" 폴더에서.

만약 `\import` 대신 사용되었다면, 경로 *img/* 는 "section1-1.tex"가 저장된 "sections" 폴더가 아니라 메인 파일을 기준으로 상대 경로가 됩니다.

[Overleaf에서 대규모 프로젝트의 예시 열기](https://www.overleaf.com/project/new/template/20618?id=70769185\&templateName=Managing+a+large+project+on+Overleaf\&latexEngine=pdflatex\&texImage=texlive-full%3A2020.1\&mainFile=)

## 추가 읽을거리

자세한 내용은 다음을 참고하세요:

* [다중 파일 LaTeX 프로젝트](/latex/ko/document-structure/08-multi-file-latex-projects.md)
* [섹션과 방정식의 상호 참조](/latex/ko/document-structure/03-cross-referencing-sections-equations-and-floats.md)
* [색인](/latex/ko/document-structure/04-indices.md)
* [용어집](/latex/ko/document-structure/05-glossaries.md)
* [하이퍼링크](/latex/ko/document-structure/09-hyperlinks.md)
* [페이지 번호 매기기](/latex/ko/formatting/03-page-numbering.md)
* [단면 및 양면 문서](/latex/ko/formatting/08-single-sided-and-double-sided-documents.md)
* [다단 구성](/latex/ko/formatting/09-multiple-columns.md)
* [문단 서식](/latex/ko/formatting/04-articles-how-to-change-paragraph-spacing-in-latex.md)
* [페이지 크기와 여백](/latex/ko/formatting/07-page-size-and-margins.md)
* [카운터](/latex/ko/formatting/10-counters.md)
* [여백 노트](/latex/ko/formatting/15-margin-notes.md)
* [굵게, 기울임꼴 및 밑줄](/latex/ko/latex/03-bold-italics-and-underlining.md)
* [글꼴 크기, 패밀리 및 스타일](/latex/ko/fonts/01-font-sizes-families-and-styles.md)
* [글꼴 서체](/latex/ko/fonts/02-font-typefaces.md)
* [XeLaTeX로 현대 글꼴 지원](/latex/ko/fonts/03-xelatex.md)
* [국제 언어 지원](/latex/ko/languages/03-international-language-support.md)
* [글꼴 크기, 패밀리 및 스타일](/latex/ko/fonts/01-font-sizes-families-and-styles.md)
* [자신만의 패키지 작성하기](/latex/ko/class-files/03-writing-your-own-package.md)
* [자신만의 클래스 작성하기](/latex/ko/class-files/04-writing-your-own-class.md)
* [LaTeX2ε에 대한 그리 짧지 않은 소개](http://www.ctan.org/tex-archive/info/lshort/)
* [`import` 패키지 문서](ftp://sunsite.icm.edu.pl/pub/CTAN/macros/latex/contrib/import/import.pdf)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://overleaf-pro.ayaka.space/latex/ko/document-structure/07-management-in-a-large-project.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
