newclude(여전히)가 사용하기에 좋은 패키지인가요?

newclude(여전히)가 사용하기에 좋은 패키지인가요?

나는 저널 논문의 편집 속도를 높이기 위해 내 코드를 여러 섹션 파일로 구성하려고 시도하면서 바로 이 MWE를 생각해 냈습니다( sections가 아니라 chapters!).

\documentclass{article}
\usepackage{filecontents}
%\usepackage{newclude}
\begin{filecontents}{\jobname-ext.tex}
    \section{A section}
    \label{sec:A}
    References to this section \ref{sec:A} do not work.
\end{filecontents}
\begin{document}
    \begingroup
    \let\clearpage\relax
    \include{\jobname-ext}
    \endgroup

    \section{Another section}
    No page break after section \ref{sec:A}, please!
\end{document}

놀랍게도 (처음에는) 결과에 올바른 참조가 부족합니다. 보면 덜 놀랍다여러 파일을 포함하기 위해 include t 명령을 사용할 때 상호 참조 문제그리고포함된 파일과 편안한 클리어 페이지가 포함된 참조 라벨, 특히,이 답변.

이제 위의 질문과LaTeX에서 "\let\clearpage\relax"로 "\clearpage"를 끈 후 다시 활성화하기, 단일 답변이나 의견(또는 질문 ) 에서 newclude. 업데이트되지 않았으므로 이 패키지를 사용해도 괜찮은지 궁금합니다.\include*\clearpage1999년 이후.

재정의 없이 작동하는 또 다른 코드는 다음과 같습니다 \clearpage.

\documentclass{article}
\usepackage{filecontents}
\usepackage{newclude}
\begin{filecontents}{\jobname-ext.tex}
    \section{A section}
    \label{sec:A}
    References to this section \ref{sec:A} DO work.
\end{filecontents}
\begin{document}
    \include*{\jobname-ext}

    \section{Another section}
    No page break after section \ref{sec:A}, please!
\end{document}

그리고 그렇지 않은 두 가지가 더 있습니다:

\documentclass{article}
\makeatletter
\def\include#1{\relax
  \ifnum\@auxout=\@partaux
    \@latex@error{\string\include\space cannot be nested}\@eha
  \else \@include#1 \fi}
\def\@include#1 {%
  %\clearpage
  \if@filesw
    \immediate\write\@mainaux{\string\@input{#1.aux}}%
  \fi
  \@tempswatrue
  \if@partsw
    \@tempswafalse
    \edef\reserved@b{#1}%
    \@for\reserved@a:=\@partlist\do
      {\ifx\reserved@a\reserved@b\@tempswatrue\fi}%
  \fi
  \if@tempswa
    \let\@auxout\@partaux
    \if@filesw
      \immediate\openout\@partaux #1.aux
      \immediate\write\@partaux{\relax}%
    \fi
    \@input@{#1.tex}%
    %\clearpage
    \@writeckpt{#1}%
    \if@filesw
      \immediate\closeout\@partaux
    \fi
  \else
    \deadcycles\z@
    \@nameuse{cp@#1}%
  \fi
  \let\@auxout\@mainaux}
\makeatother
\usepackage{filecontents}
\begin{filecontents}{\jobname-ext.tex}
    \section{A section}
    \label{sec:A}
    References to this section \ref{sec:A} do not work.
\end{filecontents}
\begin{document}
    \include{\jobname-ext}

    \section{Another section}
    No page break after section \ref{sec:A}, please!
\end{document}

그리고

\documentclass{article}
\usepackage{xpatch}
\makeatletter
\patchcmd{\@include}{\clearpage}{}{}{error}
\patchcmd{\@include}{\clearpage}{}{}{error}
\makeatother
\usepackage{filecontents}
\begin{filecontents}{\jobname-ext.tex}
    \section{A section}
    \label{sec:A}
    References to this section \ref{sec:A} do not work.
\end{filecontents}
\begin{document}
    \include{\jobname-ext}

    \section{Another section}
    No page break after section \ref{sec:A}, please!
\end{document}

관련 정보