Sophanatprime / cus

CusTeX
8 stars 4 forks source link

`\setinputpath` 的调用问题 #21

Closed xkwxdyy closed 1 month ago

xkwxdyy commented 1 month ago
\documentclass{ctexbook}
\setinputpath{{./library},{./module}}
\usepackage{cus}

\begin{document}
test
\end{document}

xelatex 编译后报错

! Package cus Error: The module `ltx' you try to load does not exist.

Type <return> to continue.
 ...                                              

l.400 \CUSLoadModule
                     { util }
? 

f8709e38a8963cd3bc41ecca104e55ff415e100c 更新了 \setinputpath 命令,但是在 ltx 模块里,而 ltx 模块移到了 module 目录下。而如果想要调用 \setinputpath 来设置 {./module} 的话首先要加载 ltx 模块,但是不设置 {./module} 的话又无法加载 ltx 模块,陷入了无法调用的死循环了。

Sophanatprime commented 1 month ago

不可能使用一个未定义的命令。不用它就行了。 https://github.com/Sophanatprime/cus/blob/f8709e38a8963cd3bc41ecca104e55ff415e100c/cus-cn.tex#L7-L11 \setinputpath 虽然不能用在 cus 加载之前使用,但可以在 cus.sty\CUSLoadModule 之前使用上面这几行代码。

xkwxdyy commented 1 month ago

哦抱歉,MWE写错了,应该是:

\documentclass{ctexbook}
\usepackage{cus}
\setinputpath{{./library},{./module}}

\begin{document}
test
\end{document}

然后这个也报错

! Package cus Error: The module `ltx' you try to load does not exist.

Type <return> to continue.
 ...                                              

l.400 \CUSLoadModule
                     { util }
? 

原因应该就是我分析的那样?

xkwxdyy commented 1 month ago

\setinputpath 虽然不能用在 cus 加载之前使用,但可以在 cus.sty\CUSLoadModule 之前使用上面这几行代码。

所以我这个问题应该是在 cus 加载后使用 \setinputpath 的问题

Sophanatprime commented 1 month ago

对。\CUSLoadModule 执行时,还没有执行 \setinputpath,自然找不到模块文件。

xkwxdyy commented 1 month ago

不可能使用一个未定义的命令。不用它就行了。

https://github.com/Sophanatprime/cus/blob/f8709e38a8963cd3bc41ecca104e55ff415e100c/cus-cn.tex#L7-L11

\setinputpath 虽然不能用在 cus 加载之前使用,但可以在 cus.sty\CUSLoadModule 之前使用上面这几行代码。

但现在目录模式下每次都要额外写这个才能调用 cus 宏包,

\documentclass{ctexbook}
\usepackage{cus}
% \setinputpath{{./library},{./module}}

\begin{document}
test
\end{document}

这样也是同样的报错。从宏包使用上这算是一个问题吧

Sophanatprime commented 1 month ago

放在 TDS 目录下可以找到模块和库文件。像 pgf 宏包这种也是需要放在 TDS 目录里的,不能放在工作目录。而且,如果需要在工作目录下使用,可以直接在 cus.sty 文件里加上这两行代码。

xkwxdyy commented 1 month ago

好的了解了,谢谢。