内联 LaTeX \input 命令

发布于 2024-09-02 18:31:28 字数 356 浏览 8 评论 0原文

我正在寻找一个程序来递归内联 LaTeX 文件中的所有 \input{} 命令。我所说的“递归”是指迭代地进行内联,直到最终的 LaTeX 文件中不再有 \input{} 命令为止。

我已经遇到过 flatten 包。但是,由于某种原因,我的 TeXLive 发行版没有安装它。当我执行命令 sudo tlmgr show flatten 时,收到错误消息:tlmgr: 找不到 flatten。因此,我正在寻找更标准且更易于安装的替代工具。

I'm looking a program to recursively inline all \input{} commands in a LaTeX file. By "recursively", I mean doing the inlining iteratively until no \input{} command remains in the final LaTeX file.

I've already come across the flatten package. But, for some reason, my TeXLive distribution doesn't install it. When I execute the command sudo tlmgr show flatten, I get the error message: tlmgr: cannot find flatten. So, I'm looking for alternative tools that are more standard and easier to install.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

窗影残 2024-09-09 18:31:28

为什么不直接从 CTAN(您在问题中提供的链接)下载扁平化并手动安装?

编辑:应用以下补丁来修复构建错误。

commit 4d62b79c5145d2b5556487b483d92df797564a18
Author: Ken Bloom <[email protected]>
Date:   Thu May 27 12:45:49 2010 -0500

    fix build errors

diff --git a/flatten.l b/flatten.l
index 85ffee5..da12d2d 100644
--- a/flatten.l
+++ b/flatten.l
@@ -62,6 +62,7 @@ char FILE_DATE[] = "October 1995";
  */


+#include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <ctype.h>
@@ -641,7 +642,7 @@ FILE *f3;
 char *strsave(s)
 char *s;                           /* string to be saved */
 {
-  char *p, *malloc();
+  char *p;

   if ((p = malloc(strlen(s)+1)) != NULL) {
      strcpy(p, s);
@@ -834,4 +835,4 @@ void initialise_senv()
   strcpy(path_sep," :;");                /* path seperators */
   dir_cat = '/';                         /* directory catenation char */
   senv_debug = 0;                        /* debugging off */
-}                                      /* end INITIALISE_SENV */
\ No newline at end of file
+}                                      /* end INITIALISE_SENV */
diff --git a/getopt.c b/getopt.c
index 5131cfa..b35cf51 100644
--- a/getopt.c
+++ b/getopt.c
@@ -6,6 +6,7 @@
 /* getopt()  from Don Libes "Obfuscated C" */


+#include <string.h>
 #include <stdio.h>

 /* getopt()  -- parse command line arguments */
@@ -21,10 +22,6 @@
      fprintf(stderr, s, (unsigned)strlen(s));\
      fprintf(stderr, errbuf, 2);}

-extern int strcmp();
-extern char *strchr();
-extern int strlen();
-
 int opterr = 1;    /* getopt prints errors if this is one */
 int optind = 1;    /* token pointer */
 int optopt;        /* option character passed back to user */
diff --git a/srchenv.c b/srchenv.c
index fa3e8d8..f8acd48 100644
--- a/srchenv.c
+++ b/srchenv.c
@@ -4,6 +4,7 @@
 /* strtol() from C standard library (not all compilers find this)  */


+#include <string.h>
 #include <stdio.h>

Why don't you just download flatten from CTAN (the link you gave in the question) and install it manually?

EDIT: Apply the following patch to fix the build errors.

commit 4d62b79c5145d2b5556487b483d92df797564a18
Author: Ken Bloom <[email protected]>
Date:   Thu May 27 12:45:49 2010 -0500

    fix build errors

diff --git a/flatten.l b/flatten.l
index 85ffee5..da12d2d 100644
--- a/flatten.l
+++ b/flatten.l
@@ -62,6 +62,7 @@ char FILE_DATE[] = "October 1995";
  */


+#include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <ctype.h>
@@ -641,7 +642,7 @@ FILE *f3;
 char *strsave(s)
 char *s;                           /* string to be saved */
 {
-  char *p, *malloc();
+  char *p;

   if ((p = malloc(strlen(s)+1)) != NULL) {
      strcpy(p, s);
@@ -834,4 +835,4 @@ void initialise_senv()
   strcpy(path_sep," :;");                /* path seperators */
   dir_cat = '/';                         /* directory catenation char */
   senv_debug = 0;                        /* debugging off */
-}                                      /* end INITIALISE_SENV */
\ No newline at end of file
+}                                      /* end INITIALISE_SENV */
diff --git a/getopt.c b/getopt.c
index 5131cfa..b35cf51 100644
--- a/getopt.c
+++ b/getopt.c
@@ -6,6 +6,7 @@
 /* getopt()  from Don Libes "Obfuscated C" */


+#include <string.h>
 #include <stdio.h>

 /* getopt()  -- parse command line arguments */
@@ -21,10 +22,6 @@
      fprintf(stderr, s, (unsigned)strlen(s));\
      fprintf(stderr, errbuf, 2);}

-extern int strcmp();
-extern char *strchr();
-extern int strlen();
-
 int opterr = 1;    /* getopt prints errors if this is one */
 int optind = 1;    /* token pointer */
 int optopt;        /* option character passed back to user */
diff --git a/srchenv.c b/srchenv.c
index fa3e8d8..f8acd48 100644
--- a/srchenv.c
+++ b/srchenv.c
@@ -4,6 +4,7 @@
 /* strtol() from C standard library (not all compilers find this)  */


+#include <string.h>
 #include <stdio.h>
流星番茄 2024-09-09 18:31:28

或者,您可以使用 FLaP。它内联 \input\include 指令,并支持使用 \includeonly。此外,它还移动图形文件,以便将生成的“合并”LaTeX 项目包含在单个平面目录中。它支持 \graphicspath\includesvg 并处理 SVG、EPS 和 PDF 图像。

Alternatively, you can use FLaP. It inlines \input and \include directives, and supports the use of \includeonly. Besides, it moves graphics files around so that the resulting "merged" LaTeX project is contained in a single flat directory. It supports \graphicspath, \includesvg and processes SVG, EPS and PDF images.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文