동일한 TeX 파일로 생성되지 않은 PDF를 나열하는 목차를 만드는 방법은 무엇입니까?

동일한 TeX 파일로 생성되지 않은 PDF를 나열하는 목차를 만드는 방법은 무엇입니까?

소스 TeX 파일 없이 30페이지의 PDF로 구성된 5개의 논문이 있다고 가정할 때, LaTeX로 각 항목을 나열하는 목차를 어떻게 만들 수 있습니까? 또한 포함된 각 PDF에 페이지 번호를 할당하는 방법은 무엇입니까?

답변1

tocloft 패키지를 사용한 다음 \tableofcontents마스터 문서에 목차를 표시할 위치에 추가하세요.

목차에 섹션을 추가하려면 자동으로 선택되지 않는 경우 아래 코드를 사용할 수 있습니다. 목차에 표시하려는 각 섹션 제목 아래에 섹션 제목을 section_name으로 바꿔서 추가하세요.

\addcontentsline{toc}{Chapter}{\protect\numberline{}section_name}

장을 섹션이나 하위 섹션과 같은 다른 섹션 유형으로 대체하여 목차에 나타나는 수준을 정의할 수 있습니다.

잘 정의된 섹션이 없으면 다음과 같은 것을 사용하십시오.

\clearpage
\phantomsection\addcontentsline{toc}{chapter}{\protect\numberline{section_name}

목차에 대한 앵커 포인트를 제공하고 목차에 대한 참조 포인트에 대한 section_name을 추가합니다.

답변2

패키지를 사용하여 PDF를 포함하고 명령 옵션 pdfpages에 섹션화 또는 내용에 추가 명령을 포함합니다 .pagecommand\includepdf

.tex예를 들어, 하위 디렉터리 에 첨부할 기본 파일과 두 개의 PDF가 있다고 가정합니다 pdfs. (반드시 두 번 컴파일하세요.)

\documentclass{article}
\usepackage{pdfpages}

\begin{document}

\tableofcontents

\section{Main Text}

Two attachments follow. % I show two different ways below.

% (1) With a section command in the main file 
% (the heading will be printed on a separate page, 
%  but will not overlap with inserted PDF content)

\clearpage\section{First Attachment}
\includepdf[pages=-]{pdfs/doc1} % pages=- means all pages

% (2) With a pagecommand (heading will be printed ON 
% the inserted PDF, so may overlap with content)

\includepdf[pages=1, pagecommand={\section{Second Attachment}}]{pdfs/doc2}
\includepdf[pages=2-last]{pdfs/doc2}

\end{document}

PDF 1(pdfs/doc1.tex에서 컴파일)

\documentclass{article}
\usepackage{lipsum}
\begin{document}
\lipsum[1-19]
\end{document}

PDF 2(pdfs/doc2.tex에서 컴파일)

\documentclass{article}
\usepackage{lipsum}
\begin{document}
\lipsum[20-29]
\end{document}

여기에 이미지 설명을 입력하세요

관련 정보