我想尝试使用相对路径进行一些输入(例如在导入包中,但我想写它)
当我编译时,Tex 容量超出了。你能帮我解决这个问题吗?
我在 overleaf 上的项目结构/代码是这里。
谢谢,抱歉我的英语不好。
编辑 :
这是主要代码
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{ifthen}
\usepackage{etoolbox}
\usepackage{xparse}
\title{import}
\author{mathias.cabiochdelalande }
\date{December 2019}
\newcounter{recursion}
\newcounter{minusrecursion}
\setcounter{recursion}{0}
\setcounter{minusrecursion}{-1}
\newcommand{\importdebug}{0}
\NewDocumentCommand{\import}{O{.} m}{%
\setcounter{recursion}{0}%
\setcounter{minusrecursion}{-1}%
%
\expandafter\def\csname Handler\arabic{recursion}\endcsname{#1}%
%
\typeout{import #2 -> path(\therecursion:\theminusrecursion) : \csuse{Handler\arabic{recursion}}}%
\ifthenelse{\equal{\importdebug}{0}}{%
\input{\csuse{Handler\arabic{recursion}}/#2}%
}{%
\input{#2}%
}%
}
\NewDocumentCommand{\subimport}{O{.} m}{%
\typeout{subimport #2 -> path(\therecursion:\theminusrecursion) : \csuse{Handler\arabic{recursion}}}%
\stepcounter{recursion}%
\stepcounter{minusrecursion}%
\typeout{subimport before #2 -> path(\therecursion:\theminusrecursion) : \csuse{Handler\arabic{minusrecursion}}}%
%
\expandafter\def\csname Handler\arabic{recursion}\endcsname{\csuse{Handler\arabic{minusrecursion}}/#1}%
%
\typeout{subimport #2 -> path(\therecursion:\theminusrecursion) : \csuse{Handler\arabic{recursion}}}%
\ifthenelse{\equal{\importdebug}{0}}{%
\input{\csuse{Handler\arabic{recursion}}/#2}%
}{%
\input{#2}%
}%
%
\addtocounter{recursion}{-1}%
\addtocounter{minusrecursion}{-1}%
}
\begin{document}
\ifthenelse{\equal{\importdebug}{0}}{%
\import[other]{other}
}{%
\import[other]{other/other}
}
\ifthenelse{\equal{\importdebug}{0}}{%
\import[dira]{other}
}{%
\import[dira]{dira/other}
}
% \bibliographystyle{plain}
\end{document}
other/other.tex、dira/dirb/dirc/other.tex、dira/dirb/dird/other.tex 中的代码
\section{a simple section}
dira/other.tex 中的代码
\section{dira}
\subimport[dirb]{dira/dirb/other}
\subimport[dirc]{dira/dirc/other}
dira/dirb/other.tex 中的代码
\section{dirb}
\subimport[dird]{dira/dirb/dird/other}